diff --git a/config/cloudpaks/cp4a/operators/templates/0050-sync-cluster-scoped-operators.yaml b/config/cloudpaks/cp4a/operators/templates/0050-sync-cluster-scoped-operators.yaml index 8773ea0b..3db27dd1 100644 --- a/config/cloudpaks/cp4a/operators/templates/0050-sync-cluster-scoped-operators.yaml +++ b/config/cloudpaks/cp4a/operators/templates/0050-sync-cluster-scoped-operators.yaml @@ -1,5 +1,3 @@ -{{- $red_hat_cert_manager := .Values.red_hat_cert_manager | toString }} -{{- if eq ( default "false" $red_hat_cert_manager ) "false" }} --- apiVersion: batch/v1 kind: Job @@ -19,6 +17,8 @@ spec: env: - name: ARGOCD_NAMESPACE value: "openshift-gitops" + - name: RED_HAT_CERT_MANAGER_ENABLED + value: "{{.Values.red_hat_cert_manager}}" - name: IBM_CERT_MANAGER_NAMESPACE value: {{.Values.metadata.cert_manager_namespace}} - name: IBM_CERT_MANAGER_CHANNEL @@ -31,6 +31,15 @@ spec: set -x result=0 + if [ "${RED_HAT_CERT_MANAGER_ENABLED}" == "true" ]; then + oc delete Subscription.operators.coreos.com ibm-cert-manager-operator \ + -n "${IBM_CERT_MANAGER_NAMESPACE:?}" \ + --ignore-not-found=true + oc delete Namespace "${IBM_CERT_MANAGER_NAMESPACE:?}" \ + --ignore-not-found=true + exit "${result}" + fi + ibm_cert_manager_count=$(oc get Subscription.operators.coreos.com \ -l operators.coreos.com/ibm-cert-manager-operator.ibm-cert-manager \ -A \ @@ -88,4 +97,3 @@ spec: restartPolicy: Never serviceAccountName: {{.Values.serviceaccount.argocd_application_controller}} backoffLimit: 2 -{{- end}} diff --git a/config/cloudpaks/cp4a/operators/templates/0100-config-placeholder.yaml b/config/cloudpaks/cp4a/operators/templates/0100-config-placeholder.yaml new file mode 100644 index 00000000..cc8a7b53 --- /dev/null +++ b/config/cloudpaks/cp4a/operators/templates/0100-config-placeholder.yaml @@ -0,0 +1,15 @@ +# This is not actually used by CP4BA. +# +# ArgoCD cannot recognize changes to the content +# of sync hooks (such as an env variable for a container) +# so this config map contains the env variables +# referenced in sync hooks to ensure ArgoCD realizes +# a relevant config value has changed. +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: gitops-cp4a-dummy + namespace: {{.Values.metadata.argocd_app_namespace}} +data: + red_hat_cert_manager: "{{.Values.red_hat_cert_manager}}" diff --git a/config/cloudpaks/cp4a/operators/values.yaml b/config/cloudpaks/cp4a/operators/values.yaml index 8ed83299..c01fb674 100644 --- a/config/cloudpaks/cp4a/operators/values.yaml +++ b/config/cloudpaks/cp4a/operators/values.yaml @@ -3,6 +3,7 @@ metadata: argocd_app_namespace: ibm-cloudpaks cert_manager_namespace: ibm-cert-manager cert_manager_channel: v4.2 +red_hat_cert_manager: false serviceaccount: argocd_application_controller: openshift-gitops-argocd-application-controller storageclass: diff --git a/tests/postbuild/gitops.sh b/tests/postbuild/gitops.sh index 433e60ae..94484843 100755 --- a/tests/postbuild/gitops.sh +++ b/tests/postbuild/gitops.sh @@ -93,6 +93,7 @@ source "${scriptdir}/common.sh" # # Clean up at end of task # +# shellcheck disable=SC2317 cleanRun() { cd "${original_dir}" if [ -n "${WORKDIR}" ]; then @@ -139,7 +140,9 @@ function create_secrets() { --docker-username="${CP_ICR_IO_USERID}" \ --docker-password="${CP_ICR_IO_PASSWORD}" \ --docker-email="${registry_email}" \ - --namespace="${GITOPS_NAMESPACE}" + --namespace="${GITOPS_NAMESPACE}" \ + --dry-run='client' \ + -o yaml | oc apply -f - cat <