Skip to content

Commit c809bcb

Browse files
committed
Add CRO-operator upgrade tests
Signed-off-by: Max Cao <[email protected]>
1 parent 7ee4782 commit c809bcb

4 files changed

+281
-0
lines changed

ci-operator/config/openshift/cluster-resource-override-admission-operator/openshift-cluster-resource-override-admission-operator-main.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ base_images:
77
name: release
88
namespace: openshift
99
tag: rhel-9-release-golang-1.23-openshift-4.19
10+
operator-sdk:
11+
name: "4.19"
12+
namespace: origin
13+
tag: operator-sdk
14+
previous-bundle:
15+
name: "4.19"
16+
namespace: ocp
17+
tag: cluster-resource-override-admission-operator-bundle
18+
previous-operator:
19+
name: "4.19"
20+
namespace: ocp
21+
tag: cluster-resource-override-admission-operator
1022
binary_build_commands: make build --warn-undefined-variables
1123
build_root:
1224
from_repository: true
@@ -117,6 +129,62 @@ tests:
117129
requests:
118130
cpu: 100m
119131
workflow: ipi-aws
132+
- as: e2e-aws-upgrade
133+
skip_if_only_changed: ^docs/|^\.github|\.md$|^(?:.*/)?(?:\.gitignore|OWNERS|OWNERS_ALIASES|PROJECT|LICENSE)$
134+
steps:
135+
cluster_profile: aws
136+
test:
137+
- as: install
138+
cli: latest
139+
commands: |
140+
export NS=clusterresourceoverride-operator
141+
oc create ns $NS
142+
143+
# Deploy the bundle which will fail to come up due to it pointing to the operator
144+
# image via a tag that is only available to the presubmit job it is created
145+
# within. This pipeline image is removed shortly after said job
146+
# completes, so the csv needs to be patched to point the equivalent image that has been
147+
# promoted.
148+
operator-sdk run bundle --timeout=10m -n $NS --security-context-config restricted "$PREVIOUS_BUNDLE" || true
149+
export OLD_CSV_NAME=$(oc get csv -n $NS -o jsonpath='{.items[0].metadata.name}')
150+
151+
oc patch csv -n $NS $OLD_CSV_NAME --type='json' -p="[{\"op\": \"replace\", \"path\": \"/spec/install/spec/deployments/0/spec/template/spec/containers/0/image\", \"value\": \"$PREVIOUS_OPERATOR\"}]"
152+
sleep 10
153+
154+
# Delete the deployment which will then be recreated by the subscription controller with the correct image.
155+
oc delete deployment -n $NS clusterresourceoverride-operator
156+
157+
oc wait --timeout=10m --for=create -n $NS deployment clusterresourceoverride-operator
158+
oc wait --timeout=10m --for condition=Available -n $NS deployment clusterresourceoverride-operator
159+
dependencies:
160+
- env: PREVIOUS_BUNDLE
161+
name: previous-bundle
162+
- env: PREVIOUS_OPERATOR
163+
name: previous-operator
164+
from: operator-sdk
165+
resources:
166+
requests:
167+
cpu: 100m
168+
- as: upgrade
169+
cli: latest
170+
commands: |
171+
export NS=clusterresourceoverride-operator
172+
operator-sdk run bundle-upgrade --timeout 10m -n $NS --security-context-config restricted "$OO_BUNDLE"
173+
dependencies:
174+
- env: OO_BUNDLE
175+
name: cluster-resource-override-admission-operator-bundle
176+
from: operator-sdk
177+
resources:
178+
requests:
179+
cpu: 100m
180+
- as: test
181+
cli: latest
182+
commands: make e2e
183+
from: src
184+
resources:
185+
requests:
186+
cpu: 100m
187+
workflow: ipi-aws
120188
- as: verify-deps
121189
steps:
122190
env:

ci-operator/config/openshift/cluster-resource-override-admission-operator/openshift-cluster-resource-override-admission-operator-release-4.19.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ base_images:
77
name: release
88
namespace: openshift
99
tag: rhel-9-release-golang-1.23-openshift-4.19
10+
operator-sdk:
11+
name: "4.19"
12+
namespace: origin
13+
tag: operator-sdk
14+
previous-bundle:
15+
name: "4.18"
16+
namespace: ocp
17+
tag: cluster-resource-override-admission-operator-bundle
18+
previous-operator:
19+
name: "4.18"
20+
namespace: ocp
21+
tag: cluster-resource-override-admission-operator
1022
binary_build_commands: make build --warn-undefined-variables
1123
build_root:
1224
from_repository: true
@@ -117,6 +129,61 @@ tests:
117129
requests:
118130
cpu: 100m
119131
workflow: ipi-aws
132+
- as: e2e-aws-upgrade
133+
skip_if_only_changed: ^docs/|^\.github|\.md$|^(?:.*/)?(?:\.gitignore|OWNERS|OWNERS_ALIASES|PROJECT|LICENSE)$
134+
steps:
135+
cluster_profile: aws
136+
test:
137+
- as: install
138+
cli: latest
139+
commands: |
140+
export NS=clusterresourceoverride-operator
141+
oc create ns $NS
142+
143+
# Deploy the bundle which will fail to come up due to it pointing to the operator
144+
# image via a tag that is only available to the presubmit job it is created
145+
# within. This pipeline image is removed shortly after said job
146+
# completes, so the csv needs to be patched to point the equivalent image that has been
147+
# promoted.
148+
operator-sdk run bundle --timeout=10m -n $NS --security-context-config restricted "$PREVIOUS_BUNDLE" || true
149+
export OLD_CSV_NAME=$(oc get csv -n $NS -o jsonpath='{.items[0].metadata.name}')
150+
151+
oc patch csv -n $NS $OLD_CSV_NAME --type='json' -p="[{\"op\": \"replace\", \"path\": \"/spec/install/spec/deployments/0/spec/template/spec/containers/0/image\", \"value\": \"$PREVIOUS_OPERATOR\"}]"
152+
sleep 10
153+
154+
# Delete the deployment which will then be recreated by the subscription controller with the correct image.
155+
oc delete deployment -n $NS clusterresourceoverride-operator
156+
157+
oc wait --timeout=10m --for=create -n $NS deployment clusterresourceoverride-operator
158+
oc wait --timeout=10m --for condition=Available -n $NS deployment clusterresourceoverride-operator
159+
dependencies:
160+
- env: PREVIOUS_BUNDLE
161+
name: previous-bundle
162+
- env: PREVIOUS_OPERATOR
163+
name: previous-operator
164+
from: operator-sdk
165+
resources:
166+
requests:
167+
cpu: 100m
168+
- as: upgrade
169+
cli: latest
170+
commands: |
171+
export NS=clusterresourceoverride-operator
172+
operator-sdk run bundle-upgrade --timeout 10m -n $NS --security-context-config restricted "$OO_BUNDLE"
173+
dependencies:
174+
- env: OO_BUNDLE
175+
name: cluster-resource-override-admission-operator-bundle
176+
from: operator-sdk
177+
resources:
178+
requests:
179+
cpu: 100m
180+
- as: test
181+
cli: latest
182+
commands: make e2e
183+
from: src
184+
resources:
185+
requests:
186+
cpu: 100m
120187
- as: verify-deps
121188
steps:
122189
env:

ci-operator/jobs/openshift/cluster-resource-override-admission-operator/openshift-cluster-resource-override-admission-operator-main-presubmits.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,79 @@ presubmits:
199199
secret:
200200
secretName: result-aggregator
201201
trigger: (?m)^/test( | .* )e2e-aws-operator,?($|\s.*)
202+
- agent: kubernetes
203+
always_run: false
204+
branches:
205+
- ^main$
206+
- ^main-
207+
cluster: build10
208+
context: ci/prow/e2e-aws-upgrade
209+
decorate: true
210+
labels:
211+
ci-operator.openshift.io/cloud: aws
212+
ci-operator.openshift.io/cloud-cluster-profile: aws
213+
ci.openshift.io/generator: prowgen
214+
pj-rehearse.openshift.io/can-be-rehearsed: "true"
215+
name: pull-ci-openshift-cluster-resource-override-admission-operator-main-e2e-aws-upgrade
216+
rerun_command: /test e2e-aws-upgrade
217+
skip_if_only_changed: ^docs/|^\.github|\.md$|^(?:.*/)?(?:\.gitignore|OWNERS|OWNERS_ALIASES|PROJECT|LICENSE)$
218+
spec:
219+
containers:
220+
- args:
221+
- --gcs-upload-secret=/secrets/gcs/service-account.json
222+
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
223+
- --lease-server-credentials-file=/etc/boskos/credentials
224+
- --report-credentials-file=/etc/report/credentials
225+
- --secret-dir=/secrets/ci-pull-credentials
226+
- --target=e2e-aws-upgrade
227+
command:
228+
- ci-operator
229+
image: ci-operator:latest
230+
imagePullPolicy: Always
231+
name: ""
232+
resources:
233+
requests:
234+
cpu: 10m
235+
volumeMounts:
236+
- mountPath: /etc/boskos
237+
name: boskos
238+
readOnly: true
239+
- mountPath: /secrets/ci-pull-credentials
240+
name: ci-pull-credentials
241+
readOnly: true
242+
- mountPath: /secrets/gcs
243+
name: gcs-credentials
244+
readOnly: true
245+
- mountPath: /secrets/manifest-tool
246+
name: manifest-tool-local-pusher
247+
readOnly: true
248+
- mountPath: /etc/pull-secret
249+
name: pull-secret
250+
readOnly: true
251+
- mountPath: /etc/report
252+
name: result-aggregator
253+
readOnly: true
254+
serviceAccountName: ci-operator
255+
volumes:
256+
- name: boskos
257+
secret:
258+
items:
259+
- key: credentials
260+
path: credentials
261+
secretName: boskos-credentials
262+
- name: ci-pull-credentials
263+
secret:
264+
secretName: ci-pull-credentials
265+
- name: manifest-tool-local-pusher
266+
secret:
267+
secretName: manifest-tool-local-pusher
268+
- name: pull-secret
269+
secret:
270+
secretName: registry-pull-credentials
271+
- name: result-aggregator
272+
secret:
273+
secretName: result-aggregator
274+
trigger: (?m)^/test( | .* )e2e-aws-upgrade,?($|\s.*)
202275
- agent: kubernetes
203276
always_run: true
204277
branches:

ci-operator/jobs/openshift/cluster-resource-override-admission-operator/openshift-cluster-resource-override-admission-operator-release-4.19-presubmits.yaml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,79 @@ presubmits:
199199
secret:
200200
secretName: result-aggregator
201201
trigger: (?m)^/test( | .* )e2e-aws-operator,?($|\s.*)
202+
- agent: kubernetes
203+
always_run: false
204+
branches:
205+
- ^release-4\.19$
206+
- ^release-4\.19-
207+
cluster: build11
208+
context: ci/prow/e2e-aws-upgrade
209+
decorate: true
210+
labels:
211+
ci-operator.openshift.io/cloud: aws
212+
ci-operator.openshift.io/cloud-cluster-profile: aws
213+
ci.openshift.io/generator: prowgen
214+
pj-rehearse.openshift.io/can-be-rehearsed: "true"
215+
name: pull-ci-openshift-cluster-resource-override-admission-operator-release-4.19-e2e-aws-upgrade
216+
rerun_command: /test e2e-aws-upgrade
217+
skip_if_only_changed: ^docs/|^\.github|\.md$|^(?:.*/)?(?:\.gitignore|OWNERS|OWNERS_ALIASES|PROJECT|LICENSE)$
218+
spec:
219+
containers:
220+
- args:
221+
- --gcs-upload-secret=/secrets/gcs/service-account.json
222+
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
223+
- --lease-server-credentials-file=/etc/boskos/credentials
224+
- --report-credentials-file=/etc/report/credentials
225+
- --secret-dir=/secrets/ci-pull-credentials
226+
- --target=e2e-aws-upgrade
227+
command:
228+
- ci-operator
229+
image: ci-operator:latest
230+
imagePullPolicy: Always
231+
name: ""
232+
resources:
233+
requests:
234+
cpu: 10m
235+
volumeMounts:
236+
- mountPath: /etc/boskos
237+
name: boskos
238+
readOnly: true
239+
- mountPath: /secrets/ci-pull-credentials
240+
name: ci-pull-credentials
241+
readOnly: true
242+
- mountPath: /secrets/gcs
243+
name: gcs-credentials
244+
readOnly: true
245+
- mountPath: /secrets/manifest-tool
246+
name: manifest-tool-local-pusher
247+
readOnly: true
248+
- mountPath: /etc/pull-secret
249+
name: pull-secret
250+
readOnly: true
251+
- mountPath: /etc/report
252+
name: result-aggregator
253+
readOnly: true
254+
serviceAccountName: ci-operator
255+
volumes:
256+
- name: boskos
257+
secret:
258+
items:
259+
- key: credentials
260+
path: credentials
261+
secretName: boskos-credentials
262+
- name: ci-pull-credentials
263+
secret:
264+
secretName: ci-pull-credentials
265+
- name: manifest-tool-local-pusher
266+
secret:
267+
secretName: manifest-tool-local-pusher
268+
- name: pull-secret
269+
secret:
270+
secretName: registry-pull-credentials
271+
- name: result-aggregator
272+
secret:
273+
secretName: result-aggregator
274+
trigger: (?m)^/test( | .* )e2e-aws-upgrade,?($|\s.*)
202275
- agent: kubernetes
203276
always_run: true
204277
branches:

0 commit comments

Comments
 (0)