Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions scripts/openstack-update-services.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,26 @@ oc wait $OPENSTACK_VERSION_CR --for=jsonpath='{.status.availableVersion}'=$OPENS

OPENSTACK_DEPLOYED_VERSION=$(oc get $OPENSTACK_VERSION_CR --template={{.status.deployedVersion}})

cat <<EOF >openstackversionpatch.yaml
"spec": {
"targetVersion": "$OPENSTACK_VERSION"
}
EOF

update_event Patching the Openstack Version

oc patch $OPENSTACK_VERSION_CR --type=merge --patch-file openstackversionpatch.yaml
# The admission webhook (FR4+) rejects targetVersion changes when
# customContainerImages are identical to the tracked images for the
# previous version. In CI the same images are used for both phases.
#
# Work around: save the custom images, null them in the same patch
# that sets targetVersion (so hasAnyCustomImage=false and the webhook
# skips validation), then immediately restore them so the operator
# keeps using the internal-mirror images instead of falling back to
# the CSV defaults (which may point to an inaccessible registry).
CUSTOM_IMAGES=$(oc get $OPENSTACK_VERSION_CR -o jsonpath='{.spec.customContainerImages}')

oc patch $OPENSTACK_VERSION_CR --type=merge \
-p '{"spec":{"targetVersion":"'"$OPENSTACK_VERSION"'","customContainerImages":null}}'

if [ -n "$CUSTOM_IMAGES" ] && [ "$CUSTOM_IMAGES" != "{}" ] && [ "$CUSTOM_IMAGES" != "null" ]; then
oc patch $OPENSTACK_VERSION_CR --type=merge \
-p "{\"spec\":{\"customContainerImages\":$CUSTOM_IMAGES}}"
fi

# wait for ovn update on control plane
oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateOVNControlplane --timeout=$TIMEOUT
Expand Down
25 changes: 18 additions & 7 deletions scripts/openstack-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,26 @@ oc wait $OPENSTACK_VERSION_CR --for=jsonpath='{.status.availableVersion}'=$OPENS

OPENSTACK_DEPLOYED_VERSION=$(oc get $OPENSTACK_VERSION_CR --template={{.spec.targetVersion}})

cat <<EOF >openstackversionpatch.yaml
"spec": {
"targetVersion": "$OPENSTACK_VERSION"
}
EOF

update_event Patching the Openstack Version

oc patch $OPENSTACK_VERSION_CR --type=merge --patch-file openstackversionpatch.yaml
# The admission webhook (FR4+) rejects targetVersion changes when
# customContainerImages are identical to the tracked images for the
# previous version. In CI the same images are used for both phases.
#
# Work around: save the custom images, null them in the same patch
# that sets targetVersion (so hasAnyCustomImage=false and the webhook
# skips validation), then immediately restore them so the operator
# keeps using the internal-mirror images instead of falling back to
# the CSV defaults (which may point to an inaccessible registry).
CUSTOM_IMAGES=$(oc get $OPENSTACK_VERSION_CR -o jsonpath='{.spec.customContainerImages}')

oc patch $OPENSTACK_VERSION_CR --type=merge \
-p '{"spec":{"targetVersion":"'"$OPENSTACK_VERSION"'","customContainerImages":null}}'

if [ -n "$CUSTOM_IMAGES" ] && [ "$CUSTOM_IMAGES" != "{}" ] && [ "$CUSTOM_IMAGES" != "null" ]; then
oc patch $OPENSTACK_VERSION_CR --type=merge \
-p "{\"spec\":{\"customContainerImages\":$CUSTOM_IMAGES}}"
fi

# wait for ovn update on control plane
oc wait $OPENSTACK_VERSION_CR --for=condition=MinorUpdateOVNControlplane --timeout=$TIMEOUT
Expand Down