Skip to content

Commit 0cfd0f4

Browse files
committed
Find image from bindata csvs based on container name instead of order
Using the order in the list of containers is fragile as it can change based on implementation details as kustomization syntax of the service operators. This patch is moving to use the container name of the operator manager which should be consistent and deterministic. Signed-off-by: Alfredo Moralejo <[email protected]>
1 parent b24083b commit 0cfd0f4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

hack/sync-bindata.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,10 +286,12 @@ EOF_CAT
286286
for X in $(ls manifests/*clusterserviceversion.yaml); do
287287
OPERATOR_NAME=$(echo $X | sed -e "s|manifests\/\([^\.]*\)\..*|\1|" | sed -e "s|-|_|g" | tr '[:lower:]' '[:upper:]' )
288288
echo $OPERATOR_NAME
289-
if [[ $OPERATOR_NAME == "RABBITMQ_CLUSTER_OPERATOR" ]] || [[ $OPERATOR_NAME == "WATCHER_OPERATOR" ]]; then
290-
IMAGE=$(cat $X | $LOCAL_BINARIES/yq -r .spec.install.spec.deployments[0].spec.template.spec.containers[0].image)
289+
if [[ $OPERATOR_NAME == "RABBITMQ_CLUSTER_OPERATOR" ]]; then
290+
# Rabbitmq cluster operator has just a container in the deployment and name is operator, different that openstack ones
291+
IMAGE=$(cat $X | $LOCAL_BINARIES/yq -r '.spec.install.spec.deployments[0].spec.template.spec.containers.[] | select(.name == "operator") | .image')
291292
else
292-
IMAGE=$(cat $X | $LOCAL_BINARIES/yq -r .spec.install.spec.deployments[0].spec.template.spec.containers[1].image)
293+
# The name of the actual operator container in the openstack operators is manager
294+
IMAGE=$(cat $X | $LOCAL_BINARIES/yq -r '.spec.install.spec.deployments[0].spec.template.spec.containers.[] | select(.name == "manager") | .image')
293295
fi
294296
echo $IMAGE
295297

0 commit comments

Comments
 (0)