Files
zeekay 7bb1484ce7 Name the sample objects in resource fixtures for this product
The health and action fixtures carried sample object names from the upstream
project; renamed in step with every assertion that reads them.
2026-09-05 01:16:49 -07:00

39 lines
1.0 KiB
Lua

local hs = {}
if obj.status ~= nil then
if obj.status.state == "initializing" then
hs.status = "Progressing"
hs.message = obj.status.ready .. "/" .. obj.status.size .. " node(s) are ready"
return hs
end
if obj.status.state == "ready" then
hs.status = "Healthy"
hs.message = obj.status.ready .. "/" .. obj.status.size .. " node(s) are ready"
return hs
end
if obj.status.state == "paused" then
hs.status = "Unknown"
hs.message = "Cluster is paused"
return hs
end
if obj.status.state == "stopping" then
hs.status = "Degraded"
hs.message = "Cluster is stopping (" .. obj.status.ready .. "/" .. obj.status.size .. " node(s) are ready)"
return hs
end
if obj.status.state == "error" then
hs.status = "Degraded"
hs.message = "Cluster is on error: " .. table.concat(obj.status.message, ", ")
return hs
end
end
hs.status = "Unknown"
hs.message = "Cluster status is unknown. Ensure your Hanzo CD is current and then check for/file a bug report: https://github.com/hanzocd/cd/issues"
return hs