fix: keep v02 edge proxy probe local

This commit is contained in:
Codex Agent
2026-06-07 21:58:46 +08:00
parent 18bdaf313f
commit a592bd9ad0
3 changed files with 18 additions and 0 deletions
@@ -6,6 +6,7 @@
- 接收 FRP 转入的 API/health 请求,并代理到 `hwlab-cloud-api:6667`
- `/health/live` 必须透传 cloud-api live health,因此公网 API readiness 以 cloud-api 为准。
- Pod readiness/liveness 必须使用 edge 自身 `/health`,不能使用会依赖 upstream 的 `/health/live`,避免 cloud-api 短暂不可用时把 edge-proxy 自身杀成 CrashLoop。
- `/v1/internal/*` 是集群内部服务路由,必须在 public edge 上 fail-closed,不透传到 cloud-api。
- 不实现业务 API,不读取 Secret,不替代 cloud-api 权限和 runtime readiness。
+12
View File
@@ -502,6 +502,15 @@ function applyEnvReuseBootEnv(container, bootMetadata, { sourceBranch, bootSh =
upsertEnv(container.env, "HWLAB_IMAGE_DIGEST", bootMetadata.environmentDigest ?? "unknown");
}
function useLocalHealthProbe(container, pathValue = "/health") {
if (!container) return;
for (const probeName of ["readinessProbe", "livenessProbe"]) {
const probe = container[probeName];
if (!probe?.httpGet) continue;
probe.httpGet.path = pathValue;
}
}
function annotateEnvReusePodTemplate(podMetadata, bootMetadata) {
if (!podMetadata || !bootMetadata) return;
annotate(podMetadata, {
@@ -994,6 +1003,9 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
if (serviceId === "hwlab-cloud-api" || serviceId === "hwlab-edge-proxy") {
upsertEnv(container.env, "HWLAB_PUBLIC_ENDPOINT", runtimeEndpoint);
}
if (profile === "v02" && serviceId === "hwlab-edge-proxy") {
useLocalHealthProbe(container, "/health");
}
if (serviceId === "hwlab-cloud-api") {
if (profile === "v02") {
removeV02RepoOwnedCodeAgentPodConfig(podTemplate.spec);
+5
View File
@@ -316,6 +316,11 @@ test("v02 render follows TypeScript runtime checks and does not self-patch boots
} else {
assert.equal(sidecar.env.some((entry) => entry.name === "HWLAB_METRICS_EXTRA_URL"), false, `unexpected extra metrics target for ${serviceId}`);
}
if (serviceId === "hwlab-edge-proxy") {
const container = workload.spec.template.spec.containers.find((entry) => entry.name === "hwlab-edge-proxy");
assert.equal(container.readinessProbe.httpGet.path, "/health");
assert.equal(container.livenessProbe.httpGet.path, "/health");
}
}
const deepseekService = deepseekProxy.items.find((item) => item.kind === "Service" && item.metadata?.name === "hwlab-deepseek-proxy");
assert.equal(deepseekService.metadata.labels["hwlab.pikastech.local/monitoring"], "enabled");