feat(cli): 헬스체크 경로 동기화(경로+/healthz) — 콘솔 정합 · v0.31.0
deploy.py: health 미지정 시 healthPath=경로+/healthz 기본(명시=커스텀) ctl.py: set --path 시 커스텀 아니면 healthPath 동반 갱신 dev.py: 로컬 kind도 동일(readiness+liveness, 백엔드 정합) bin/yakcloud: VERSION 0.30.0 → 0.31.0
This commit is contained in:
@ -67,6 +67,12 @@ SUPPORTED = set(_SVC_PORT)
|
||||
MANAGED = "app.kubernetes.io/managed-by=yakcloud-dev"
|
||||
|
||||
|
||||
def synced_health_path(path: str) -> str:
|
||||
"""경로 동기화 기본: healthPath = 경로 + '/healthz' (콘솔 '경로 동기화'·백엔드와 정합). '/' 더블슬래시 방지."""
|
||||
base = (path or "/").strip().rstrip("/")
|
||||
return base + "/healthz"
|
||||
|
||||
|
||||
def log(m: str) -> None:
|
||||
print("\033[36m▸\033[0m " + m, flush=True)
|
||||
|
||||
@ -463,9 +469,15 @@ def deploy_workload(project: str, ns: str, w: dict, src_conns: dict) -> tuple[st
|
||||
container = {"name": name, "image": image, "imagePullPolicy": "IfNotPresent",
|
||||
"ports": [{"containerPort": port}], "env": env,
|
||||
"resources": {"requests": {"cpu": res.get("cpu", "25m"), "memory": res.get("mem", "96Mi")}}}
|
||||
if w.get("health"):
|
||||
container["readinessProbe"] = {"httpGet": {"path": w["health"], "port": port},
|
||||
"initialDelaySeconds": 3, "periodSeconds": 5, "failureThreshold": 30}
|
||||
# health 미지정 시 경로와 동기화(경로+/healthz) — 콘솔 '경로 동기화' 기본·백엔드와 정합.
|
||||
# 백엔드처럼 readiness + liveness 둘 다(로컬에서 prod 동일 동작을 조기 검증).
|
||||
_ex = w.get("expose", {}) or {}
|
||||
_health = w.get("health") or synced_health_path(_ex.get("path", "/"))
|
||||
if _health and port:
|
||||
_probe = {"httpGet": {"path": _health, "port": port},
|
||||
"initialDelaySeconds": 10, "periodSeconds": 10}
|
||||
container["readinessProbe"] = _probe
|
||||
container["livenessProbe"] = {**_probe, "initialDelaySeconds": 20}
|
||||
dep = {"apiVersion": "apps/v1", "kind": "Deployment",
|
||||
"metadata": {"name": name, "namespace": ns, "labels": labels},
|
||||
"spec": {"replicas": int(w.get("replicas", 1)),
|
||||
|
||||
Reference in New Issue
Block a user