From a930b570aa50f4c3ac8f4cac34cad5b30fdea73f Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Wed, 31 May 2023 11:29:01 -0600 Subject: [PATCH 1/2] UPSTREAM: : Revert "Generate/check CMA CSV files (part 2)" This reverts commit f859c8399c1943fbd810d41b29eca36e07cc327f. It also adds a comment about why the hack is necessary --- hack/cma-generate-csv.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hack/cma-generate-csv.sh b/hack/cma-generate-csv.sh index c7ac7d877..e24f0ba62 100755 --- a/hack/cma-generate-csv.sh +++ b/hack/cma-generate-csv.sh @@ -61,8 +61,12 @@ jq_filter="$jq_filter"'walk(if type == "string" and . == "keda-olm-operator" the jq_filter="$jq_filter"'del(.spec.replaces) | ' # update the json example CR so that it shows you how to install to "openshift-keda" namespace instead of "keda" namespace jq_filter="$jq_filter"'.metadata.annotations."alm-examples" |= sub("\"namespace\": \"keda\""; "\"namespace\": \"openshift-keda\"") | ' -# create a spot to pass in the operand image specs as env vars -jq_filter="$jq_filter"'.spec.install.spec.deployments[0].spec.template.spec.containers[0].env += [{"name":"KEDA_OPERATOR_IMAGE","value":"CMA_OPERAND_PLACEHOLDER_1"},{"name":"KEDA_METRICS_SERVER_IMAGE","value":"CMA_OPERAND_PLACEHOLDER_2"},{"name":"KEDA_ADMISSION_WEBHOOKS_IMAGE","value":"CMA_OPERAND_PLACEHOLDER_3"}]' +# set the command to bash instead of /manager +jq_filter="$jq_filter"'.spec.install.spec.deployments[0].spec.template.spec.containers[0].command |= [ "/usr/bin/bash" ] |' +# export the env vars and then exec /manager. This hack is needed due to OSBS requiring that env vars have the prefix RELATED_IMAGE_, so bash translates from OSBS-style env vars to operator env vars. See https://osbs.readthedocs.io/en/latest/users.html?highlight=operator#pullspec-locations +jq_filter="$jq_filter"'.spec.install.spec.deployments[0].spec.template.spec.containers[0].args |= ["-c", "export KEDA_OPERATOR_IMAGE=$RELATED_IMAGE_1; export KEDA_METRICS_SERVER_IMAGE=$RELATED_IMAGE_2; export KEDA_ADMISSION_WEBHOOKS_IMAGE=$RELATED_IMAGE_3; exec /manager \"$0\" \"$@\"" ] + . |' +# create a spot to pass in the operand image specs as env vars using OSBS-style RELATED_IMAGE_ names +jq_filter="$jq_filter"'.spec.install.spec.deployments[0].spec.template.spec.containers[0].env += [{"name":"RELATED_IMAGE_1","value":"CMA_OPERAND_PLACEHOLDER_1"},{"name":"RELATED_IMAGE_2","value":"CMA_OPERAND_PLACEHOLDER_2"},{"name":"RELATED_IMAGE_3","value":"CMA_OPERAND_PLACEHOLDER_3"}]' # pipe the filtered upstream CSV and the patch together to jq to combine them { bin/yaml2json keda/${ver}/manifests/keda.v${ver}.clusterserviceversion.yaml | jq "$jq_filter"; From e608501d2e6fc093e4bf593deb4a4c7833b98f62 Mon Sep 17 00:00:00 2001 From: Joel Smith Date: Wed, 31 May 2023 11:31:25 -0600 Subject: [PATCH 2/2] UPSTREAM: : Revert most of "Fixes for CMA 2.10.1" This reverts most of commit a12d839f3f9b80c617258c2c4384dcbd29ac1ef0 --- .../manifests/cma.v2.10.1.clusterserviceversion.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/keda/2.10.1/manifests/cma.v2.10.1.clusterserviceversion.yaml b/keda/2.10.1/manifests/cma.v2.10.1.clusterserviceversion.yaml index aaf6b66d5..33d9dc33c 100644 --- a/keda/2.10.1/manifests/cma.v2.10.1.clusterserviceversion.yaml +++ b/keda/2.10.1/manifests/cma.v2.10.1.clusterserviceversion.yaml @@ -561,22 +561,24 @@ spec: spec: containers: - args: + - -c + - export KEDA_OPERATOR_IMAGE=$RELATED_IMAGE_1; export KEDA_METRICS_SERVER_IMAGE=$RELATED_IMAGE_2; export KEDA_ADMISSION_WEBHOOKS_IMAGE=$RELATED_IMAGE_3; exec /manager "$0" "$@" - --leader-elect - --zap-log-level=info - --zap-encoder=console - --zap-time-encoding=rfc3339 command: - - /manager + - /usr/bin/bash env: - name: WATCH_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.annotations['olm.targetNamespaces'] - - name: KEDA_OPERATOR_IMAGE + - name: RELATED_IMAGE_1 value: CMA_OPERAND_PLACEHOLDER_1 - - name: KEDA_METRICS_SERVER_IMAGE + - name: RELATED_IMAGE_2 value: CMA_OPERAND_PLACEHOLDER_2 - - name: KEDA_ADMISSION_WEBHOOKS_IMAGE + - name: RELATED_IMAGE_3 value: CMA_OPERAND_PLACEHOLDER_3 image: ghcr.io/kedacore/keda-olm-operator:2.10.1 imagePullPolicy: Always