#!/usr/bin/env bash # Brings the whole core state up on an empty cluster: # k8s-ng/bootstrap/bootstrap.sh # Installs Argo CD (the only thing that cannot install itself) and applies the # root application; Argo CD then pulls every core application in wave order. set -euo pipefail ctx=${1:?usage: bootstrap.sh } here=$(cd "$(dirname "$0")" && pwd) k="kubectl --context $ctx" # Render in a scratch copy so kustomize does not leave downloaded charts in the repo. tmp=$(mktemp -d) trap 'rm -rf "$tmp"' EXIT cp -r "$here/../core/argocd" "$tmp/argocd" kubectl kustomize --enable-helm "$tmp/argocd" > "$tmp/argocd.yaml" $k create namespace argocd --dry-run=client -o yaml | $k apply -f - # CRDs must exist before the Argo CD objects that use them: apply twice. $k apply --server-side --force-conflicts -f "$tmp/argocd.yaml" >/dev/null 2>&1 || true sleep 8 $k apply --server-side --force-conflicts -f "$tmp/argocd.yaml" $k -n argocd rollout status deploy --timeout=300s $k -n argocd rollout status statefulset --timeout=300s $k apply --server-side --force-conflicts -f "$here/root.yaml" echo "Core state requested. Watch it with: $k -n argocd get app"