Skip to content

Commit b4bac7c

Browse files
committed
SREP-4417: Add AVO operator e2e as Prow postsubmit with ephemeral cluster
Create reusable step registry components for operator e2e testing: - rosa-operator-install: installs operator via PKO ClusterPackage - rosa-operator-e2e: runs Ginkgo e2e binary (supports ephemeral and persistent clusters) - rosa-operator-e2e-workflow: provisions ROSA Classic STS, installs operator, runs tests, deprovisions Add AVO as the first consumer. Runs as a postsubmit on every merge to openshift/aws-vpce-operator main, so SAPM can poll the result for the deployed commit SHA to gate production promotion. No osde2e dependency -- runs the Ginkgo binary directly. Jira: SREP-4417
1 parent 049eeb2 commit b4bac7c

14 files changed

Lines changed: 347 additions & 0 deletions

ci-operator/config/openshift/aws-vpce-operator/openshift-aws-vpce-operator-main.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ images:
44
items:
55
- dockerfile_path: build/Dockerfile
66
to: unused
7+
- dockerfile_path: test/e2e/Containerfile.prow
8+
to: operator-e2e
79
resources:
810
'*':
911
limits:
@@ -53,6 +55,17 @@ tests:
5355
container:
5456
from: src
5557
skip_if_only_changed: ^(?:\.tekton|\.github)|\.md$|^(?:\.gitignore|OWNERS|LICENSE)$
58+
- as: avo-e2e-stage
59+
postsubmit: true
60+
steps:
61+
cluster_profile: rosa-e2e-01
62+
env:
63+
CHANNEL_GROUP: stable
64+
OCM_LOGIN_ENV: staging
65+
OPERATOR_NAME: aws-vpce-operator
66+
OPERATOR_PKO_IMAGE: "quay.io/redhat-services-prod/openshift/aws-vpce-operator-pko:latest"
67+
OPERATOR_IMAGE: "quay.io/redhat-services-prod/openshift/aws-vpce-operator:latest"
68+
workflow: rosa-operator-e2e-workflow
5669
zz_generated_metadata:
5770
branch: main
5871
org: openshift

ci-operator/jobs/openshift/aws-vpce-operator/openshift-aws-vpce-operator-main-postsubmits.yaml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,74 @@
11
postsubmits:
22
openshift/aws-vpce-operator:
3+
- agent: kubernetes
4+
always_run: true
5+
branches:
6+
- ^main$
7+
cluster: build03
8+
decorate: true
9+
labels:
10+
ci-operator.openshift.io/cloud: aws
11+
ci-operator.openshift.io/cloud-cluster-profile: rosa-e2e-01
12+
ci.openshift.io/generator: prowgen
13+
max_concurrency: 1
14+
name: branch-ci-openshift-aws-vpce-operator-main-avo-e2e-stage
15+
spec:
16+
containers:
17+
- args:
18+
- --gcs-upload-secret=/secrets/gcs/service-account.json
19+
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
20+
- --lease-server-credentials-file=/etc/boskos/credentials
21+
- --report-credentials-file=/etc/report/credentials
22+
- --target=avo-e2e-stage
23+
command:
24+
- ci-operator
25+
env:
26+
- name: HTTP_SERVER_IP
27+
valueFrom:
28+
fieldRef:
29+
fieldPath: status.podIP
30+
image: quay-proxy.ci.openshift.org/openshift/ci:ci_ci-operator_latest
31+
imagePullPolicy: Always
32+
name: ""
33+
ports:
34+
- containerPort: 8080
35+
name: http
36+
resources:
37+
requests:
38+
cpu: 10m
39+
volumeMounts:
40+
- mountPath: /etc/boskos
41+
name: boskos
42+
readOnly: true
43+
- mountPath: /secrets/gcs
44+
name: gcs-credentials
45+
readOnly: true
46+
- mountPath: /secrets/manifest-tool
47+
name: manifest-tool-local-pusher
48+
readOnly: true
49+
- mountPath: /etc/pull-secret
50+
name: pull-secret
51+
readOnly: true
52+
- mountPath: /etc/report
53+
name: result-aggregator
54+
readOnly: true
55+
serviceAccountName: ci-operator
56+
volumes:
57+
- name: boskos
58+
secret:
59+
items:
60+
- key: credentials
61+
path: credentials
62+
secretName: boskos-credentials
63+
- name: manifest-tool-local-pusher
64+
secret:
65+
secretName: manifest-tool-local-pusher
66+
- name: pull-secret
67+
secret:
68+
secretName: registry-pull-credentials
69+
- name: result-aggregator
70+
secret:
71+
secretName: result-aggregator
372
- agent: kubernetes
473
always_run: true
574
branches:
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
approvers:
2+
- tiwillia
3+
- dustman9000
4+
- bmeng
5+
- ravitri
6+
reviewers:
7+
- tiwillia
8+
- dustman9000
9+
- bmeng
10+
- ravitri
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "rosa/operator/e2e-workflow/rosa-operator-e2e-workflow-workflow.yaml",
3+
"owners": {
4+
"approvers": ["tiwillia", "dustman9000", "bmeng", "ravitri"],
5+
"reviewers": ["tiwillia", "dustman9000", "bmeng", "ravitri"]
6+
}
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
workflow:
2+
as: rosa-operator-e2e-workflow
3+
steps:
4+
env:
5+
CHANNEL_GROUP: stable
6+
OPENSHIFT_VERSION: ""
7+
pre:
8+
- chain: rosa-aws-sts-provision
9+
- ref: rosa-cluster-wait-ready-nodes
10+
- ref: rosa-operator-install
11+
test:
12+
- ref: rosa-operator-e2e
13+
post:
14+
- ref: osd-gather-extra
15+
- chain: rosa-aws-sts-deprovision
16+
documentation: |-
17+
Provisions a ROSA Classic STS cluster, installs an operator via PKO,
18+
runs the operator e2e tests, then deprovisions. Designed for operator
19+
CI validation with ephemeral clusters.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
approvers:
2+
- tiwillia
3+
- dustman9000
4+
- bmeng
5+
- ravitri
6+
reviewers:
7+
- tiwillia
8+
- dustman9000
9+
- bmeng
10+
- ravitri
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
set -o nounset
4+
set -o errexit
5+
set -o pipefail
6+
7+
trap 'CHILDREN=$(jobs -p); if test -n "${CHILDREN}"; then kill ${CHILDREN} && wait; fi' TERM
8+
9+
log(){
10+
echo -e "\033[1m$(date "+%d-%m-%YT%H:%M:%S") " "${*}\033[0m" >&2
11+
}
12+
13+
if [[ -z "${OPERATOR_NAME:-}" ]]; then
14+
log "ERROR: OPERATOR_NAME is required"
15+
exit 1
16+
fi
17+
18+
# Get cluster access: prefer shared kubeconfig from provision step,
19+
# fall back to backplane for persistent clusters
20+
if [[ -f "${SHARED_DIR}/kubeconfig" ]]; then
21+
log "Using kubeconfig from provision step"
22+
export KUBECONFIG="${SHARED_DIR}/kubeconfig"
23+
elif [[ -n "${OPERATOR_E2E_CLUSTER_ID:-}" ]]; then
24+
# Log into OCM for backplane access
25+
SSO_CLIENT_ID=$(cat "${CLUSTER_PROFILE_DIR}/sso-client-id" 2>/dev/null || true)
26+
SSO_CLIENT_SECRET=$(cat "${CLUSTER_PROFILE_DIR}/sso-client-secret" 2>/dev/null || true)
27+
OCM_TOKEN=$(cat "${CLUSTER_PROFILE_DIR}/ocm-token" 2>/dev/null || true)
28+
29+
if [[ -n "${SSO_CLIENT_ID}" && -n "${SSO_CLIENT_SECRET}" ]]; then
30+
log "Logging into ${OCM_LOGIN_ENV} with SSO credentials"
31+
ocm login --url "${OCM_LOGIN_ENV}" --client-id "${SSO_CLIENT_ID}" --client-secret "${SSO_CLIENT_SECRET}"
32+
elif [[ -n "${OCM_TOKEN}" ]]; then
33+
log "Logging into ${OCM_LOGIN_ENV} with offline token"
34+
ocm login --url "${OCM_LOGIN_ENV}" --token "${OCM_TOKEN}"
35+
else
36+
log "ERROR: No OCM credentials found in cluster profile"
37+
exit 1
38+
fi
39+
40+
log "Getting kubeconfig for cluster ${OPERATOR_E2E_CLUSTER_ID} via backplane"
41+
ocm backplane login "${OPERATOR_E2E_CLUSTER_ID}"
42+
else
43+
log "ERROR: No cluster access method available (no SHARED_DIR/kubeconfig or OPERATOR_E2E_CLUSTER_ID)"
44+
exit 1
45+
fi
46+
47+
# Verify cluster access
48+
oc whoami
49+
log "Connected to cluster: $(oc whoami --show-server)"
50+
51+
# Run the operator e2e tests
52+
JUNIT_REPORT="${ARTIFACT_DIR}/junit-${OPERATOR_NAME}-e2e.xml"
53+
GINKGO_FLAGS="--ginkgo.junit-report=${JUNIT_REPORT} --ginkgo.v"
54+
55+
if [[ -n "${GINKGO_LABEL_FILTER:-}" ]]; then
56+
GINKGO_FLAGS="${GINKGO_FLAGS} --ginkgo.label-filter=${GINKGO_LABEL_FILTER}"
57+
fi
58+
59+
log "Running ${OPERATOR_NAME} e2e tests..."
60+
/usr/local/bin/e2e.test ${GINKGO_FLAGS} || {
61+
log "Tests failed. JUnit report at ${JUNIT_REPORT}"
62+
exit 1
63+
}
64+
65+
log "Tests passed. JUnit report at ${JUNIT_REPORT}"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"path": "rosa/operator/e2e/rosa-operator-e2e-ref.yaml",
3+
"owners": {
4+
"approvers": ["tiwillia", "dustman9000", "bmeng", "ravitri"],
5+
"reviewers": ["tiwillia", "dustman9000", "bmeng", "ravitri"]
6+
}
7+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
ref:
2+
as: rosa-operator-e2e
3+
from: operator-e2e
4+
grace_period: 10m
5+
commands: rosa-operator-e2e-commands.sh
6+
resources:
7+
requests:
8+
cpu: 100m
9+
memory: 300Mi
10+
timeout: 1h0m0s
11+
env:
12+
- name: OPERATOR_NAME
13+
default: ""
14+
documentation: Short name of the operator (e.g. aws-vpce-operator).
15+
- name: OPERATOR_E2E_CLUSTER_ID
16+
default: ""
17+
documentation: OCM cluster ID to test against. For MC/SC-resident operators, use the MC or SC cluster ID directly.
18+
- name: OCM_LOGIN_ENV
19+
default: "production"
20+
documentation: OCM environment where the target cluster is registered. MCs and SCs are registered in production.
21+
- name: GINKGO_LABEL_FILTER
22+
default: ""
23+
documentation: Optional Ginkgo label filter expression.
24+
documentation: |-
25+
Runs an operator e2e test binary against an existing ROSA cluster.
26+
Uses OCM credentials from the cluster profile to get cluster access
27+
via backplane. For MC/SC-resident operators (AVO, RMO, etc.), target
28+
the MC or SC directly. The e2e binary must be baked into the
29+
operator-e2e image at /usr/local/bin/e2e.test.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
approvers:
2+
- tiwillia
3+
- dustman9000
4+
- bmeng
5+
- ravitri
6+
reviewers:
7+
- tiwillia
8+
- dustman9000
9+
- bmeng
10+
- ravitri

0 commit comments

Comments
 (0)