mirror of
https://github.com/hanzoai/deploy.git
synced 2026-10-07 08:44:50 +00:00
40 lines
1.2 KiB
Lua
40 lines
1.2 KiB
Lua
local hs = {}
|
|
local healthy = {}
|
|
|
|
if obj.status ~= nil then
|
|
if obj.status.conditions ~= nil then
|
|
for i, condition in ipairs(obj.status.conditions) do
|
|
if condition.status == "False" then
|
|
healthy.status = "False"
|
|
end
|
|
end
|
|
end
|
|
|
|
progressiveFailure = (obj.metadata.labels ~= nil and obj.metadata.labels["numaplane.numaproj.io/progressive-result-state"] == "failed")
|
|
if obj.metadata.generation == obj.status.observedGeneration then
|
|
if (healthy ~= {} and healthy.status == "False") or (obj.status.phase == "Failed") or progressiveFailure then
|
|
hs.status = "Degraded"
|
|
if obj.status.phase == "Failed" then
|
|
hs.message = obj.status.message
|
|
elseif progressiveFailure then
|
|
hs.message = "Failed progressive upgrade"
|
|
else
|
|
hs.message = "Subresources are unhealthy"
|
|
end
|
|
return hs
|
|
elseif obj.status.phase == "Paused" then
|
|
hs.status = "Healthy"
|
|
hs.message = "MonoVertex is paused"
|
|
return hs
|
|
elseif obj.status.phase == "Running" then
|
|
hs.status = "Healthy"
|
|
hs.message = "MonoVertex is healthy"
|
|
return hs
|
|
end
|
|
end
|
|
end
|
|
|
|
hs.status = "Progressing"
|
|
hs.message = "Waiting for MonoVertex status"
|
|
return hs
|