diff --git a/Makefile b/Makefile index 0e09b046..49b4b116 100644 --- a/Makefile +++ b/Makefile @@ -20,24 +20,30 @@ argosecret: # Check for Namespaces and Secrets to be ready (it takes the cluster a while to deploy them) while [ 1 ]; do if [ oc get namespace $$target_ns >/dev/null 2>/dev/null ]; then + echo "Waiting for namespace $$target_ns to be created" ns=0 else ns=1 fi - if [ oc -n openshift-gitops extract secrets/openshift-gitops-cluster --to=- 1>/dev/null 2>/dev/null ]; then - gitops=0 - else + pw=`oc -n openshift-gitops extract secrets/openshift-gitops-cluster --to=- 2>/dev/null` + if [ "$$?" == 0 ] && [ -n "$$pw" ]; then gitops=1 + else + echo "Waiting for password to be populated" + gitops=0 fi - if [ "$$gitops" == 1 -a "$$ns" == 1 ]; then + if [ "$$gitops" == 1 ] && [ "$$ns" == 1 ]; then + echo "Conditions met, managing secret in $$target_ns" break + else + sleep 2 fi done user=$$(echo admin | base64) - password=$$(oc -n openshift-gitops extract secrets/openshift-gitops-cluster --to=- 2>/dev/null | base64) + password=$$(echo $$pw | base64) echo "{ \"apiVersion\": \"v1\", \"kind\": \"Secret\", \"metadata\": { \"name\": \"argocd-env\", \"namespace\": \"$$target_ns\" }, \"data\": { \"ARGOCD_PASSWORD\": \"$$password\", \"ARGOCD_USERNAME\": \"$$user\" }, \"type\": \"Opaque\" }" | oc apply -f- diff --git a/Makefile.toplevel b/Makefile.toplevel index b82b5d77..1317d8b9 100644 --- a/Makefile.toplevel +++ b/Makefile.toplevel @@ -1,26 +1,16 @@ -# This is an example top-level makefile for a new pattern. It delegates the tasks to the common makefile. BOOTSTRAP=1 ARGO_TARGET_NAMESPACE=replaceme -show: - make -f common/Makefile show +.PHONY: default +default: show -init: - make -f common/Makefile init +%: + make -f common/Makefile $* -deploy: - make -f common/Makefile deploy +install: deploy ifeq ($(BOOTSTRAP),1) make -f common/Makefile TARGET_NAMESPACE=$(ARGO_TARGET_NAMESPACE) argosecret endif -upgrade: - make -f common/Makefile upgrade -ifeq ($(BOOTSTRAP),1) +secret: make -f common/Makefile TARGET_NAMESPACE=$(ARGO_TARGET_NAMESPACE) argosecret -endif - -uninstall: - make -f common/Makefile uninstall - -.phony: install diff --git a/site/templates/subscriptions.yaml b/site/templates/subscriptions.yaml index 65ec71f2..ffdf933b 100644 --- a/site/templates/subscriptions.yaml +++ b/site/templates/subscriptions.yaml @@ -10,7 +10,7 @@ spec: sourceNamespace: {{ default "openshift-marketplace" .sourceNamespace }} channel: {{ default "stable" .channel }} installPlanApproval: {{ coalesce .installPlanApproval $.Values.global.options.installPlanApproval }} - {{- if $.Values.global.options.useCSV }} + {{- if coalesce .useCSV .Values.site.subscriptions.useCSV .Values.global.options.useCSV }} startingCSV: {{ .csv }} {{- end }} ---