argo-cd/resource_customizations/addons.cluster.x-k8s.io/ClusterResourceSet/health.lua
1102 fdf539dc6a
feat: add health check for ClusterResourceSet (#20746)
Signed-off-by: nueavv <nuguni@kakao.com>
2024-12-15 15:56:34 -05:00

31 lines
No EOL
770 B
Lua

function getStatus(obj)
local hs = {}
hs.status = "Progressing"
hs.message = "Initializing cluster resource set"
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
-- Ready
if condition.type == "ResourcesApplied" and condition.status == "True" then
hs.status = "Healthy"
hs.message = "cluster resource set is applied"
return hs
end
-- Resources Applied
if condition.type == "ResourcesApplied" and condition.status == "False" then
hs.status = "Degraded"
hs.message = condition.message
return hs
end
end
end
end
return hs
end
local hs = getStatus(obj)
return hs