Skip to content

Commit 2216229

Browse files
committed
Fix annotation handling for Azure
There are scenarios where an annotation may exist and adding a new annotation will fail if we don't use overwrite. Fixes: #KATA-3117 Signed-off-by: Pradipta Banerjee <[email protected]>
1 parent f4c4eb9 commit 2216229

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

config/peerpods/podvm/azure-podvm-image-handler.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,8 @@ function add_image_id_annotation_to_peer_pods_cm() {
404404
fi
405405

406406
# Add the image id as annotation to peer-pods-cm configmap
407-
kubectl annotate configmap peer-pods-cm -n openshift-sandboxed-containers-operator \
407+
# Overwrite any existing values
408+
kubectl annotate --overwrite configmap peer-pods-cm -n openshift-sandboxed-containers-operator \
408409
"LATEST_IMAGE_ID=${IMAGE_ID}" ||
409410
error_exit "Failed to add the image id as annotation to peer-pods-cm configmap"
410411

@@ -442,7 +443,8 @@ function add_image_gallery_annotation_to_peer_pods_cm() {
442443
fi
443444

444445
# Add IMAGE_GALLERY_NAME annotation to peer-pods-cm configmap
445-
kubectl annotate configmap peer-pods-cm -n openshift-sandboxed-containers-operator \
446+
# Overwrite any existing values
447+
kubectl annotate --overwrite configmap peer-pods-cm -n openshift-sandboxed-containers-operator \
446448
"IMAGE_GALLERY_NAME=${IMAGE_GALLERY_NAME}" ||
447449
error_exit "Failed to add the IMAGE_GALLERY_NAME annotation to peer-pods-cm configmap"
448450

0 commit comments

Comments
 (0)