-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Only apply Cert Manager with BA install
Signed-off-by: Denilson Nastacio <[email protected]>
- Loading branch information
Showing
6 changed files
with
85 additions
and
35 deletions.
There are no files selected for viewing
8 changes: 0 additions & 8 deletions
8
config/cloudpaks/cp-shared/operators/templates/0000-cert-manager-namespace.yaml
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
config/cloudpaks/cp-shared/operators/templates/0100-cert-manager-operator-group.yaml
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
config/cloudpaks/cp-shared/operators/templates/0100-cert-manager-subscription.yaml
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
--- | ||
metadata: | ||
argocd_namespace: openshift-gitops | ||
cert_manager_namespace: ibm-cert-manager | ||
serviceaccount: | ||
argocd_application_controller: openshift-gitops-argocd-application-controller | ||
online_catalog_source_priority: -1 |
83 changes: 83 additions & 0 deletions
83
config/cloudpaks/cp4a/operators/templates/0050-sync-cluster-scoper-operators.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: sync-cluster-scoper-operators | ||
annotations: | ||
argocd.argoproj.io/hook: Sync | ||
argocd.argoproj.io/sync-wave: "50" | ||
namespace: openshift-gitops | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: config | ||
image: quay.io/openshift/origin-cli:latest | ||
imagePullPolicy: IfNotPresent | ||
env: | ||
- name: ARGOCD_NAMESPACE | ||
value: "openshift-gitops" | ||
- name: IBM_CERT_MANAGER | ||
value: {{.Values.metadata.cert_manager_namespace}} | ||
- name: IBM_CERT_MANAGER_CHANNEL | ||
value: {{.Values.metadata.cert_manager_channel}} | ||
command: | ||
- /bin/sh | ||
- -c | ||
- | | ||
set -eo pipefail | ||
set -x | ||
result=0 | ||
ibm_cert_manager_count=$(oc get Subscription.operators.coreos.com \ | ||
-l operators.coreos.com/ibm-cert-manager-operator.ibm-cert-manager \ | ||
-A \ | ||
-o name | wc -l || result=1) | ||
if [ "${result}" == 0 ]; then | ||
if [ "${ibm_cert_manager_count}" == "0" ]; then | ||
echo "INFO: Installing IBM Cert Manager." | ||
cat << EOF | oc apply -f - | ||
--- | ||
apiVersion: operators.coreos.com/v1 | ||
kind: OperatorGroup | ||
metadata: | ||
name: ibm-cert-manager | ||
namespace: ${IBM_CERT_MANAGER:?} | ||
spec: | ||
upgradeStrategy: Default | ||
--- | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
name: ibm-cert-manager-operator | ||
namespace: ${IBM_CERT_MANAGER:?} | ||
spec: | ||
channel: ${IBM_CERT_MANAGER_CHANNEL:?} | ||
installPlanApproval: Automatic | ||
name: ibm-cert-manager-operator | ||
source: ibm-operator-catalog | ||
sourceNamespace: openshift-marketplace | ||
EOF | ||
oc wait Subscription.operators.coreos.com ibm-cert-manager-operator -n ${IBM_CERT_MANAGER:?} --for=CatalogSourcesUnhealthy=False \ | ||
&& oc wait Subscription.operators.coreos.com ibm-cert-manager-operator -n ${IBM_CERT_MANAGER:?} --for=jsonpath='state'="AtLatestKnown" \ | ||
&& echo "INFO: Successfully install IBM Cert Manager." \ | ||
|| result=1 | ||
else | ||
echo "INFO: IBM Cert Manager already installed." | ||
oc get Subscription.operators.coreos.com \ | ||
-l operators.coreos.com/ibm-cert-manager-operator.ibm-cert-manager \ | ||
-A | ||
fi | ||
else | ||
echo "ERROR: Unable to ascertain status of cert managers in the cluster." | ||
fi | ||
if [ "${result}" -eq 1 ] ; then | ||
echo "ERROR: Unable to locate a running IBM Cert Manager and to install one afterwards." | ||
fi | ||
exit "${result}" | ||
restartPolicy: Never | ||
serviceAccountName: {{.Values.serviceaccount.argocd_application_controller}} | ||
backoffLimit: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters