Skip to content

Commit

Permalink
Propagate OS_IMAGES var in operator/common.sh
Browse files Browse the repository at this point in the history
When deploying the operator, OS_IMAGES env var
should propagate if already defined.
This should solve e2e failures of jobs that use
superfluous storage. I.e. download all OS images,
instead of the ones in the list filtered by test-infra.
  • Loading branch information
danielerez committed Dec 3, 2023
1 parent b3565e7 commit b72ad38
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion deploy/operator/common.sh
Expand Up @@ -48,4 +48,4 @@ fi

export ASSISTED_OPENSHIFT_VERSION="${ASSISTED_OPENSHIFT_VERSION:-openshift-v${VERSION}}"
export ASSISTED_OPENSHIFT_INSTALL_RELEASE_IMAGE="${ASSISTED_OPENSHIFT_INSTALL_RELEASE_IMAGE:-${RELEASE_IMAGE}}"
export OS_IMAGES=$(echo ${DEFAULT_OS_IMAGES} | jq -rc 'map(select((.openshift_version|split(".")|map(tonumber)) >= [4,8]))')
export OS_IMAGES="${OS_IMAGES:-$(echo ${DEFAULT_OS_IMAGES} | jq -rc 'map(select((.openshift_version|split(".")|map(tonumber)) >= [4,8]))')}"
12 changes: 5 additions & 7 deletions deploy/operator/setup_assisted_operator.sh
Expand Up @@ -207,14 +207,12 @@ spec:
$(mirror_config)
EOCR

if [ "${DISCONNECTED}" = "true" ]; then
echo "Adding osImages to AgentServiceConfig because we're in disconnected mode"
wait_for_object_amount agentserviceconfigs/agent 1 10 ${ASSISTED_NAMESPACE}
echo "Adding osImages to AgentServiceConfig (to support filterred list on assisted-image-service)"
wait_for_object_amount agentserviceconfigs/agent 1 10 ${ASSISTED_NAMESPACE}

# We need to patch agentserviceconfig to add the OS_IMAGES, but we need to rename the keys to be camelCase
OS_IMAGES_CAMELCASE=$(echo "${OS_IMAGES}" | sed 's/openshift_version/openshiftVersion/g; s/cpu_architecture/cpuArchitecture/g' | jq -c .)
oc patch -n ${ASSISTED_NAMESPACE} agentserviceconfig agent --type merge -p '{"spec":{"osImages":'"${OS_IMAGES_CAMELCASE}"'}}'
fi
# We need to patch agentserviceconfig to add the OS_IMAGES, but we need to rename the keys to be camelCase
OS_IMAGES_CAMELCASE=$(echo "${OS_IMAGES}" | sed 's/openshift_version/openshiftVersion/g; s/cpu_architecture/cpuArchitecture/g' | jq -c .)
oc patch -n ${ASSISTED_NAMESPACE} agentserviceconfig agent --type merge -p '{"spec":{"osImages":'"${OS_IMAGES_CAMELCASE}"'}}'

wait_for_operator "assisted-service-operator" "${ASSISTED_NAMESPACE}"
wait_for_condition "agentserviceconfigs/agent" "ReconcileCompleted" "5m"
Expand Down

0 comments on commit b72ad38

Please sign in to comment.