mirror of
https://github.com/argoproj/argo-cd
synced 2026-04-21 17:07:16 +00:00
* 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>
37 lines
No EOL
1.3 KiB
Lua
37 lines
No EOL
1.3 KiB
Lua
local health_status = {}
|
|
if obj.status ~= nil then
|
|
if obj.status.ingress ~= nil then
|
|
local numIngressRules = 0
|
|
local numTrue = 0
|
|
local numFalse = 0
|
|
for _, ingressRules in pairs(obj.status.ingress) do
|
|
numIngressRules = numIngressRules + 1
|
|
if obj.status.ingress ~= nil then
|
|
for _, condition in pairs(ingressRules.conditions) do
|
|
if condition.type == "Admitted" and condition.status == "True" then
|
|
numTrue = numTrue + 1
|
|
elseif condition.type == "Admitted" and condition.status == "False" then
|
|
numFalse = numFalse + 1
|
|
end
|
|
end
|
|
end
|
|
health_status.status = 'Test'
|
|
end
|
|
if numTrue == numIngressRules then
|
|
health_status.status = "Healthy"
|
|
health_status.message = "Route is healthy"
|
|
return health_status
|
|
elseif numFalse > 0 then
|
|
health_status.status = "Degraded"
|
|
health_status.message = "Route is degraded"
|
|
return health_status
|
|
else
|
|
health_status.status = "Progressing"
|
|
health_status.message = "Route is still getting admitted"
|
|
return health_status
|
|
end
|
|
end
|
|
end
|
|
health_status.status = "Progressing"
|
|
health_status.message = "Route is still getting admitted"
|
|
return health_status |