argo-cd/resource_customizations/operator.openshift.io/IngressController/health.lua
Josh Soref 491b3898ac
chore(action): minor lua changes (#15580)
* chore(action): add newlines at eof

Signed-off-by: Josh Soref <jsoref@gmail.com>

* chore(action): fix whitespace indentation

Signed-off-by: Josh Soref <jsoref@gmail.com>

* chore(action): use local annotations

Signed-off-by: Josh Soref <jsoref@gmail.com>

---------

Signed-off-by: Josh Soref <jsoref@gmail.com>
2023-09-21 09:20:42 -04:00

31 lines
1.1 KiB
Lua

-- healthcheck for IngressController resources
local hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
-- if the status conditions are present, iterate over them and check their status
for _, condition in pairs(obj.status.conditions) do
if condition.type == "Degraded" and condition.status == "True" then
hs.status = "Degraded"
hs.message = condition.message
return hs
elseif condition.type == "DeploymentReplicasAllAvailable" and condition.status == "False" then
hs.status = "Progressing"
hs.message = condition.message
return hs
elseif condition.type == "Progressing" and condition.status == "True" then
hs.status = "Progressing"
hs.message = condition.reason
return hs
elseif condition.type == "Available" and condition.status == "True" then
hs.status = "Healthy"
hs.message = "IngressController is available"
return hs
end
end
end
end
-- default status when none of the previous condition matches
hs.status = "Progressing"
hs.message = "Status of IngressController is not known yet"
return hs