mirror of
https://gitlab.kube.huskypup.net/Scooby/Homelabv4.git
synced 2026-08-21 11:36:50 +00:00
bitnami/kubectl has removed all version tags from Docker Hub, leaving only :latest which is blocked by Kyverno disallow-latest-tag policy. Switch to alpine/k8s:1.32.13 which has kubectl, bash, jq, and uses proper version tags. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
52 lines
1.8 KiB
YAML
52 lines
1.8 KiB
YAML
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: netbird-presync
|
|
namespace: netbird
|
|
annotations:
|
|
argocd.argoproj.io/hook: PreSync
|
|
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
|
|
spec:
|
|
backoffLimit: 3
|
|
template:
|
|
spec:
|
|
serviceAccountName: argocd-hook-sa
|
|
containers:
|
|
- name: presync
|
|
image: alpine/k8s:1.32.13
|
|
command:
|
|
- /bin/bash
|
|
- -c
|
|
- |
|
|
set -euo pipefail
|
|
echo "=== Netbird PreSync ==="
|
|
|
|
# Set PodSecurity to privileged (cluster routers need NET_ADMIN)
|
|
kubectl label namespace netbird pod-security.kubernetes.io/enforce=privileged --overwrite 2>/dev/null || true
|
|
|
|
# Wait for CNPG cluster
|
|
echo "Waiting for Netbird PostgreSQL cluster..."
|
|
for i in $(seq 1 60); do
|
|
PHASE=$(kubectl -n netbird get cluster pg-netbird -o jsonpath='{.status.phase}' 2>/dev/null || echo "")
|
|
if [ "$PHASE" = "Cluster in healthy state" ] || [ "$PHASE" = "Healthy" ]; then
|
|
echo " Netbird PostgreSQL cluster ready"
|
|
break
|
|
fi
|
|
echo " waiting for pg-netbird... (attempt $i/60, phase=$PHASE)"
|
|
sleep 5
|
|
done
|
|
|
|
# Wait for OAuth secret
|
|
echo "Waiting for netbird-oauth-secret..."
|
|
for i in $(seq 1 30); do
|
|
if kubectl -n netbird get secret netbird-oauth-secret >/dev/null 2>&1; then
|
|
echo " Netbird OAuth secret synced"
|
|
break
|
|
fi
|
|
echo " waiting for ExternalSecret sync... (attempt $i/30)"
|
|
sleep 2
|
|
done
|
|
|
|
echo "=== Netbird PreSync Complete ==="
|
|
restartPolicy: Never
|