mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-22 01:17:16 +00:00
Healthchecks for several Policy types. Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
33 lines
976 B
Lua
33 lines
976 B
Lua
hs = {}
|
|
if obj.status == nil or obj.status.compliant == nil then
|
|
hs.status = "Progressing"
|
|
hs.message = "Waiting for the status to be reported"
|
|
return hs
|
|
end
|
|
if obj.status.lastEvaluatedGeneration ~= obj.metadata.generation then
|
|
hs.status = "Progressing"
|
|
hs.message = "Waiting for the status to be updated"
|
|
return hs
|
|
end
|
|
if obj.status.compliant == "Compliant" then
|
|
hs.status = "Healthy"
|
|
else
|
|
hs.status = "Degraded"
|
|
end
|
|
if obj.status.compliancyDetails ~= nil then
|
|
messages = {}
|
|
for i, compliancy in ipairs(obj.status.compliancyDetails) do
|
|
if compliancy.conditions ~= nil then
|
|
for i, condition in ipairs(compliancy.conditions) do
|
|
if condition.message ~= nil and condition.type ~= nil then
|
|
table.insert(messages, condition.type .. " - " .. condition.message)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
hs.message = table.concat(messages, "; ")
|
|
return hs
|
|
end
|
|
hs.status = "Progressing"
|
|
hs.message = "Waiting for compliance"
|
|
return hs
|