Skip to content

Commit 2caa7ea

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

8 files changed

+569
-0
lines changed

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

Lines changed: 70 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,64 @@ 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: |
183+
export KUBECTL=$(which oc)
184+
make e2e
185+
from: src
186+
resources:
187+
requests:
188+
cpu: 100m
189+
workflow: ipi-aws
120190
- as: verify-deps
121191
steps:
122192
env:

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

Lines changed: 69 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.22-openshift-4.17
10+
operator-sdk:
11+
name: "4.19"
12+
namespace: origin
13+
tag: operator-sdk
14+
previous-bundle:
15+
name: "4.16"
16+
namespace: ocp
17+
tag: cluster-resource-override-admission-operator-bundle
18+
previous-operator:
19+
name: "4.16"
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,63 @@ 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: |
183+
export KUBECTL=$(which oc)
184+
make e2e
185+
from: src
186+
resources:
187+
requests:
188+
cpu: 100m
120189
zz_generated_metadata:
121190
branch: release-4.17
122191
org: openshift

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

Lines changed: 69 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.22-openshift-4.18
10+
operator-sdk:
11+
name: "4.19"
12+
namespace: origin
13+
tag: operator-sdk
14+
previous-bundle:
15+
name: "4.17"
16+
namespace: ocp
17+
tag: cluster-resource-override-admission-operator-bundle
18+
previous-operator:
19+
name: "4.17"
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,63 @@ 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: |
183+
export KUBECTL=$(which oc)
184+
make e2e
185+
from: src
186+
resources:
187+
requests:
188+
cpu: 100m
120189
zz_generated_metadata:
121190
branch: release-4.18
122191
org: openshift

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

Lines changed: 69 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,63 @@ 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: |
183+
export KUBECTL=$(which oc)
184+
make e2e
185+
from: src
186+
resources:
187+
requests:
188+
cpu: 100m
120189
- as: verify-deps
121190
steps:
122191
env:

0 commit comments

Comments
 (0)