File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -971,10 +971,35 @@ jobs:
971971
972972 - name : Configure Virtualization
973973 run : |
974+ kubectl_apply_with_retry() {
975+ local count=6
976+ local delay=10
977+ local manifest
978+ manifest="$(mktemp)"
979+ cat > "$manifest"
980+
981+ for i in $(seq 1 "$count"); do
982+ echo "[INFO] kubectl apply attempt ${i}/${count}"
983+ if kubectl apply -f "$manifest"; then
984+ rm -f "$manifest"
985+ return 0
986+ fi
987+
988+ if [ "$i" -lt "$count" ]; then
989+ echo "[WARN] kubectl apply failed, retrying in ${delay}s"
990+ sleep "$delay"
991+ fi
992+ done
993+
994+ echo "[ERROR] kubectl apply failed after ${count} attempts"
995+ rm -f "$manifest"
996+ return 1
997+ }
998+
974999 REGISTRY=$(base64 -d <<< "${{secrets.DEV_REGISTRY_DOCKER_CFG}}" | jq '.auths | to_entries | .[] | .key' -r)
9751000
9761001 echo "[INFO] Apply ModuleSource dev config"
977- kubectl apply -f - <<EOF
1002+ kubectl_apply_with_retry <<EOF
9781003 apiVersion: deckhouse.io/v1alpha1
9791004 kind: ModuleSource
9801005 metadata:
@@ -990,7 +1015,7 @@ jobs:
9901015 kubectl wait --for=jsonpath='{.status.phase}'=Active ms deckhouse-dev --timeout=300s
9911016
9921017 echo "[INFO] Apply Virtualization module config"
993- kubectl apply -f - <<EOF
1018+ kubectl_apply_with_retry <<EOF
9941019 apiVersion: deckhouse.io/v1alpha1
9951020 kind: ModuleConfig
9961021 metadata:
You can’t perform that action at this time.
0 commit comments