#!/bin/bash cd "$(dirname "$0")" TARGETNS="argocd" ORIGNS="$(kubectl config view --minify -o jsonpath='{..namespace}')" ( set -e 1>&2 echo "creating namespace if it doesn't exist" jq -n --args '{"apiVersion":"v1","kind":"Namespace","metadata":{"name": $ARGS.positional[0]}}' "$TARGETNS" | kubectl apply -f - [ x"$TARGETNS" != x"$ORIGNS" ] && kubectl config set-context --current --namespace $TARGETNS bash install-crds.sh helm install -n "$TARGETNS" --dependency-update argo1 . kubectl apply -f ../secrets kubectl wait -n $TARGETNS deploy/argo1-argocd-server --for=condition=available argocd --core app sync argo1-sealed-secrets argocd --core app sync argo1-secrets argocd --core app sync argo1 ) [ x"$TARGETNS" != x"$ORIGNS" ] && kubectl config set-context --current --namespace "$ORIGNS"