wait for K3s API readiness in CI
Kube-bench CIS scan / Scan ephemeral K3s cluster (push) Successful in 2m33s
Kube-bench CIS scan / Scan ephemeral K3s cluster (push) Successful in 2m33s
This commit is contained in:
@@ -54,6 +54,7 @@ jobs:
|
|||||||
jq --version
|
jq --version
|
||||||
|
|
||||||
- name: Create ephemeral K3s cluster
|
- name: Create ephemeral K3s cluster
|
||||||
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
k3d cluster delete security-baseline-ci >/dev/null 2>&1 || true
|
k3d cluster delete security-baseline-ci >/dev/null 2>&1 || true
|
||||||
k3d cluster create --config ci/k3d-ci-cluster-config.yaml
|
k3d cluster create --config ci/k3d-ci-cluster-config.yaml
|
||||||
@@ -76,6 +77,16 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
sed -i -E "s#https://0\.0\.0\.0:#https://${api_host}:#" "$HOME/.kube/config"
|
sed -i -E "s#https://0\.0\.0\.0:#https://${api_host}:#" "$HOME/.kube/config"
|
||||||
kubectl config set-cluster k3d-security-baseline-ci --tls-server-name 0.0.0.0 >/dev/null
|
kubectl config set-cluster k3d-security-baseline-ci --tls-server-name 0.0.0.0 >/dev/null
|
||||||
|
for ((attempt = 1; attempt <= 90; attempt++)); do
|
||||||
|
if kubectl get --raw='/readyz' >/dev/null 2>&1; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [[ "$attempt" -eq 90 ]]; then
|
||||||
|
kubectl get --raw='/readyz'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
kubectl wait --for=condition=Ready nodes --all --timeout=180s
|
kubectl wait --for=condition=Ready nodes --all --timeout=180s
|
||||||
kubectl get nodes -o wide
|
kubectl get nodes -o wide
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user