fix: reduce rebuild wait bottlenecks
Deploy Cluster / Terraform (push) Successful in 33s
Deploy Cluster / Ansible (push) Failing after 47m21s

This commit is contained in:
2026-05-03 16:03:24 +00:00
parent 95e39306c5
commit ff542024d2
4 changed files with 22 additions and 7 deletions
+9 -2
View File
@@ -593,6 +593,7 @@ jobs:
- name: Wait for Rancher - name: Wait for Rancher
env: env:
KUBECONFIG: outputs/kubeconfig KUBECONFIG: outputs/kubeconfig
RANCHER_BOOTSTRAP_PASSWORD: ${{ secrets.RANCHER_BOOTSTRAP_PASSWORD }}
run: | run: |
set -euo pipefail set -euo pipefail
wait_for_resource() { wait_for_resource() {
@@ -815,6 +816,14 @@ jobs:
kubectl -n flux-system annotate externalsecret/rancher-bootstrap-password external-secrets.io/force-sync="${force_sync}" --overwrite || true kubectl -n flux-system annotate externalsecret/rancher-bootstrap-password external-secrets.io/force-sync="${force_sync}" --overwrite || true
kubectl -n cattle-system annotate externalsecret/rancher-bootstrap-password external-secrets.io/force-sync="${force_sync}" --overwrite || true kubectl -n cattle-system annotate externalsecret/rancher-bootstrap-password external-secrets.io/force-sync="${force_sync}" --overwrite || true
if [ -n "${RANCHER_BOOTSTRAP_PASSWORD}" ]; then
for namespace in flux-system cattle-system; do
kubectl -n "${namespace}" create secret generic rancher-bootstrap-password \
--from-literal=bootstrapPassword="${RANCHER_BOOTSTRAP_PASSWORD}" \
--dry-run=client -o yaml | kubectl apply -f -
done
fi
if kubectl -n flux-system get secret/rancher-bootstrap-password >/dev/null 2>&1 \ if kubectl -n flux-system get secret/rancher-bootstrap-password >/dev/null 2>&1 \
&& kubectl -n cattle-system get secret/rancher-bootstrap-password >/dev/null 2>&1; then && kubectl -n cattle-system get secret/rancher-bootstrap-password >/dev/null 2>&1; then
return 0 return 0
@@ -846,8 +855,6 @@ jobs:
wait_for_resource cattle-system deployment/cattle-system-rancher 600 wait_for_resource cattle-system deployment/cattle-system-rancher 600
kubectl -n cattle-system rollout status deployment/cattle-system-rancher --timeout=900s kubectl -n cattle-system rollout status deployment/cattle-system-rancher --timeout=900s
wait_for_resource cattle-system deployment/rancher-webhook 900 wait_for_resource cattle-system deployment/rancher-webhook 900
pull_image_on_matching_pod_nodes cattle-system app=rancher-webhook registry.rancher.com/rancher/rancher-webhook:v0.9.3 12 10
kubectl -n cattle-system rollout restart deployment/rancher-webhook
kubectl -n cattle-system rollout status deployment/rancher-webhook --timeout=900s kubectl -n cattle-system rollout status deployment/rancher-webhook --timeout=900s
wait_for_resource cattle-system issuer/cattle-system-rancher 900 wait_for_resource cattle-system issuer/cattle-system-rancher 900
wait_for_resource cattle-system certificate/tls-rancher-ingress 900 wait_for_resource cattle-system certificate/tls-rancher-ingress 900
@@ -12,3 +12,5 @@ k3s_registry_mirrors:
port: 5003 port: 5003
oci.external-secrets.io: oci.external-secrets.io:
port: 5004 port: 5004
registry.rancher.com:
port: 5005
+7 -3
View File
@@ -161,11 +161,15 @@
when: kube_vip_rollout.rc != 0 when: kube_vip_rollout.rc != 0
- name: Wait for control plane node readiness - name: Wait for control plane node readiness
command: kubectl wait --for=condition=Ready node/{{ item }} --timeout=30s shell: |
set -euo pipefail
kubectl get node/{{ item }} -o jsonpath='{.status.conditions[?(@.type=="Ready")].status}' | grep -qx True
args:
executable: /bin/bash
register: control_plane_ready register: control_plane_ready
until: control_plane_ready.rc == 0 until: control_plane_ready.rc == 0
retries: 20 retries: 90
delay: 15 delay: 10
changed_when: false changed_when: false
loop: "{{ groups['control_plane'] }}" loop: "{{ groups['control_plane'] }}"
+4 -2
View File
@@ -70,9 +70,10 @@ write_config ghcr 5001 https://ghcr.io
write_config quay 5002 https://quay.io write_config quay 5002 https://quay.io
write_config k8s 5003 https://registry.k8s.io write_config k8s 5003 https://registry.k8s.io
write_config external-secrets 5004 https://oci.external-secrets.io write_config external-secrets 5004 https://oci.external-secrets.io
write_config rancher 5005 https://registry.rancher.com
systemctl daemon-reload systemctl daemon-reload
for name in dockerhub ghcr quay k8s external-secrets; do for name in dockerhub ghcr quay k8s external-secrets rancher; do
systemctl enable --now "docker-registry-cache@${name}.service" systemctl enable --now "docker-registry-cache@${name}.service"
done done
@@ -81,4 +82,5 @@ systemctl --no-pager --full status \
docker-registry-cache@ghcr.service \ docker-registry-cache@ghcr.service \
docker-registry-cache@quay.service \ docker-registry-cache@quay.service \
docker-registry-cache@k8s.service \ docker-registry-cache@k8s.service \
docker-registry-cache@external-secrets.service docker-registry-cache@external-secrets.service \
docker-registry-cache@rancher.service