From 66e86e55ea9d5f4c5252e204395d588eb19ca1b6 Mon Sep 17 00:00:00 2001 From: MichaelFisher1997 Date: Sat, 25 Apr 2026 19:02:32 +0000 Subject: [PATCH] fix: require Flux image warmup before bootstrap --- .gitea/workflows/deploy.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 3275955..35901cd 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -410,6 +410,27 @@ jobs: --from-file=identity="$HOME/.ssh/id_ed25519" \ --from-file=known_hosts=/tmp/flux_known_hosts \ --dry-run=client -o yaml | kubectl apply -f - + PRIMARY_CP_IP=$(python3 -c 'import json; print(json.load(open("outputs/terraform_outputs.json"))["primary_control_plane_ip"]["value"])') + for image in \ + ghcr.io/fluxcd/source-controller:v1.8.0 \ + ghcr.io/fluxcd/kustomize-controller:v1.8.1 \ + ghcr.io/fluxcd/helm-controller:v1.5.1 \ + ghcr.io/fluxcd/notification-controller:v1.8.1; do + pulled=false + for attempt in $(seq 1 12); do + echo "Pre-pulling ${image} on ${PRIMARY_CP_IP} (${attempt}/12)" + if ssh -i "$HOME/.ssh/id_ed25519" -o StrictHostKeyChecking=no -o ConnectTimeout=10 "ubuntu@${PRIMARY_CP_IP}" \ + "sudo k3s ctr images pull '${image}'"; then + pulled=true + break + fi + sleep 20 + done + if [ "${pulled}" != "true" ]; then + echo "Failed to pre-pull required Flux image ${image} on ${PRIMARY_CP_IP}" >&2 + exit 1 + fi + done # Apply CRDs and controllers first kubectl apply -f clusters/prod/flux-system/gotk-components.yaml # Wait for CRDs to be established @@ -424,6 +445,7 @@ jobs: kubectl -n flux-system patch deployment kustomize-controller --type='merge' -p="$PATCH" kubectl -n flux-system patch deployment helm-controller --type='merge' -p="$PATCH" kubectl -n flux-system patch deployment notification-controller --type='merge' -p="$PATCH" + kubectl -n flux-system delete pod --field-selector=status.phase!=Running || true flux_rollout_status source-controller flux_rollout_status kustomize-controller flux_rollout_status helm-controller