Files
Josh SorefandGitHub 6d4327e486 chore(action): minor lua changes (#15580)
* chore(action): add newlines at eof

Signed-off-by: Josh Soref <[email protected]>

* chore(action): fix whitespace indentation

Signed-off-by: Josh Soref <[email protected]>

* chore(action): use local annotations

Signed-off-by: Josh Soref <[email protected]>

---------

Signed-off-by: Josh Soref <[email protected]>
2023-09-21 09:20:42 -04:00

37 lines
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