Skip to content

Commit

Permalink
fix: Fix sync condition to cleanup IBM Cert Mgr
Browse files Browse the repository at this point in the history
Signed-off-by: Denilson Nastacio <[email protected]>
  • Loading branch information
nastacio committed Dec 8, 2023
1 parent cfa0c21 commit 3e3baa2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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 \
Expand Down Expand Up @@ -88,4 +97,3 @@ spec:
restartPolicy: Never
serviceAccountName: {{.Values.serviceaccount.argocd_application_controller}}
backoffLimit: 2
{{- end}}
Original file line number Diff line number Diff line change
@@ -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}}"
1 change: 1 addition & 0 deletions config/cloudpaks/cp4a/operators/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 0 additions & 1 deletion tests/prebuild/yamllint-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ ignore: |
config/cloudpaks/cp-shared/operators/templates/0100-rh-cert-manager-operator-group.yaml
config/cloudpaks/cp-shared/operators/templates/0110-rh-cert-manager-subscription.yaml
config/cloudpaks/cp4a/operators/templates/0000-cp4ba-namespace.yaml
config/cloudpaks/cp4a/operators/templates/0050-sync-cluster-scoped-operators.yaml
config/cloudpaks/cp4a/operators/templates/0100-operator-group.yaml
config/cloudpaks/cp4i/install-prereqs/templates/0000-namespace.yaml
config/cloudpaks/cp4i/install-prereqs/templates/0100-operator-group.yaml
Expand Down

0 comments on commit 3e3baa2

Please sign in to comment.