fix: 用 alpine/k8s 替换无 shell 的 kubectl 镜像;冒烟测试改用 service DNS

This commit is contained in:
2026-10-23 10:44:24 +08:00
parent 033af156ad
commit 8e25fd474b
Vendored
+4 -6
View File
@@ -15,7 +15,7 @@ spec:
- name: docker-config
mountPath: /kaniko/.docker
- name: kubectl
image: rancher/kubectl:v1.34.9
image: alpine/k8s:1.34.12
command: ["sleep"]
args: ["999999"]
volumes:
@@ -92,11 +92,9 @@ spec:
sh '''
set -e
for i in $(seq 1 20); do
CODE=$(kubectl -n apps run smoke-$$ --rm -i --restart=Never \
--image=curlimages/curl:8.10.1 --quiet -- \
-s -o /dev/null -w "%{http_code}" http://blog/healthz 2>/dev/null || echo 000)
if [ "$CODE" = "200" ]; then echo "健康检查通过"; exit 0; fi
echo "第 $i 次: $CODE, 等待中..."; sleep 3
CODE=$(curl -s -o /dev/null -w "%{http_code}" http://blog.apps.svc.cluster.local/healthz || true)
if [ "$CODE" = "200" ]; then echo "健康检查通过 (第 $i 次)"; exit 0; fi
echo "第 $i 次: $CODE"; sleep 3
done
echo "健康检查失败"; exit 1
'''