fix: tune v03 cloud api health probe budget
This commit is contained in:
@@ -527,6 +527,27 @@ function applyEnvReuseStartupProbe(container) {
|
||||
};
|
||||
}
|
||||
|
||||
function applyServiceHealthProbe(container, healthProbe) {
|
||||
if (!healthProbe || typeof healthProbe !== "object" || Array.isArray(healthProbe)) return;
|
||||
for (const [probeName, key] of [["readinessProbe", "readiness"], ["livenessProbe", "liveness"], ["startupProbe", "startup"]]) {
|
||||
const probe = container?.[probeName];
|
||||
const timing = normalizeProbeTiming(healthProbe[key]);
|
||||
if (!probe || Object.keys(timing).length === 0) continue;
|
||||
Object.assign(probe, timing);
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeProbeTiming(value) {
|
||||
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
||||
const result = {};
|
||||
for (const field of ["initialDelaySeconds", "periodSeconds", "timeoutSeconds", "failureThreshold", "successThreshold"]) {
|
||||
const raw = value[field];
|
||||
const minimum = field === "initialDelaySeconds" ? 0 : 1;
|
||||
if (Number.isInteger(raw) && raw >= minimum) result[field] = raw;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
function useLocalHealthProbe(container, pathValue = "/health") {
|
||||
if (!container) return;
|
||||
for (const probeName of ["readinessProbe", "livenessProbe"]) {
|
||||
@@ -1129,6 +1150,9 @@ function transformWorkloads({ workloads, deploy, catalog, source, sourceBranch =
|
||||
});
|
||||
if (container.name === serviceId) annotateEnvReusePodTemplate(podTemplate.metadata, bootMetadata);
|
||||
}
|
||||
if (runtimeLane && container.name === serviceId) {
|
||||
applyServiceHealthProbe(container, deploy?.lanes?.[profile]?.serviceDeclarations?.[serviceId]?.healthProbe);
|
||||
}
|
||||
if (serviceId === "hwlab-cloud-api" || serviceId === "hwlab-edge-proxy") {
|
||||
upsertEnv(container.env, "HWLAB_PUBLIC_ENDPOINT", runtimeEndpoint);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user