argocd/argo1/deploy.sh

25 lines
844 B
Bash
Raw Permalink Normal View History

2023-04-23 16:19:35 +00:00
#!/bin/bash
cd "$(dirname "$0")"
TARGETNS="argocd"
ORIGNS="$(kubectl config view --minify -o jsonpath='{..namespace}')"
(
set -e
2023-04-24 01:34:24 +00:00
1>&2 echo "creating namespace if it doesn't exist"
2023-04-23 16:19:35 +00:00
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
2023-04-24 01:34:24 +00:00
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
2023-04-23 16:19:35 +00:00
)
[ x"$TARGETNS" != x"$ORIGNS" ] && kubectl config set-context --current --namespace "$ORIGNS"