mirror of
https://github.com/hanzoai/deploy.git
synced 2026-10-07 08:44:50 +00:00
Signed-off-by: Rick Brouwer <[email protected]> Co-authored-by: Dan Garfield <[email protected]>
40 lines
1.1 KiB
Lua
40 lines
1.1 KiB
Lua
local hs = {}
|
|
local healthy = false
|
|
local degraded = false
|
|
local suspended = false
|
|
if obj.status ~= nil then
|
|
if obj.status.conditions ~= nil then
|
|
for i, condition in ipairs(obj.status.conditions) do
|
|
if condition.status == "False" and condition.type == "Ready" then
|
|
hs.message = condition.message
|
|
degraded = true
|
|
end
|
|
if condition.status == "True" and condition.type == "Ready" then
|
|
hs.message = condition.message
|
|
healthy = true
|
|
end
|
|
if condition.status == "True" and condition.type == "Paused" then
|
|
hs.message = condition.message
|
|
suspended = true
|
|
end
|
|
if condition.status == "Unknown" and condition.type == "Ready" then
|
|
hs.message = condition.message
|
|
degraded = true
|
|
end
|
|
end
|
|
end
|
|
end
|
|
if degraded == true then
|
|
hs.status = "Degraded"
|
|
return hs
|
|
elseif healthy == true and suspended == false then
|
|
hs.status = "Healthy"
|
|
return hs
|
|
elseif healthy == true and suspended == true then
|
|
hs.status = "Suspended"
|
|
return hs
|
|
end
|
|
hs.status = "Progressing"
|
|
hs.message = "Waiting for ScaledJob"
|
|
return hs
|