Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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-

Expand Down
22 changes: 6 additions & 16 deletions Makefile.toplevel
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion site/templates/subscriptions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
---
Expand Down