26 lines
922 B
Bash
26 lines
922 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
cd "$(dirname "$0")/argo1"
|
||
|
|
||
|
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
|
||
|
helm dependency build
|
||
|
bash install-crds.sh
|
||
|
helm install -n "$TARGETNS" argo1 .
|
||
|
kubectl apply -f ../secrets
|
||
|
kubectl wait -n $TARGETNS deploy/argo1-argocd-server --for=condition=available
|
||
|
until argocd --core app sync argo1-sealed-secrets;do sleep 1;done
|
||
|
until argocd --core app sync argo1-secrets;do sleep 1;done
|
||
|
until argocd --core app sync argo1;do sleep 1;done
|
||
|
)
|
||
|
|
||
|
[ x"$TARGETNS" != x"$ORIGNS" ] && kubectl config set-context --current --namespace "$ORIGNS"
|