fix: require Flux image warmup before bootstrap
Deploy Cluster / Terraform (push) Successful in 31s
Deploy Cluster / Ansible (push) Failing after 23m13s

This commit is contained in:
2026-04-25 19:02:32 +00:00
parent 43df412243
commit 66e86e55ea
+22
View File
@@ -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