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
1.1 KiB
Lua
37 lines
1.1 KiB
Lua
local health_status = {}
|
|
if obj.status == nil then
|
|
health_status.status = "Progressing"
|
|
health_status.message = "Current resource status is insufficient"
|
|
return health_status
|
|
end
|
|
|
|
if obj.spec.clusters == nil or #obj.spec.clusters == 0 then
|
|
health_status.status = "Progressing"
|
|
health_status.message = "Current resource status is insufficient"
|
|
return health_status
|
|
end
|
|
|
|
if obj.status.aggregatedStatus == nil or #obj.spec.clusters ~= #obj.status.aggregatedStatus then
|
|
health_status.status = "Progressing"
|
|
health_status.message = "Current resource status is insufficient"
|
|
return health_status
|
|
end
|
|
|
|
for i, status in ipairs(obj.status.aggregatedStatus) do
|
|
if status.health == "Unhealthy" then
|
|
health_status.status = "Degraded"
|
|
health_status.message = "Current resource status is unhealthy"
|
|
return health_status
|
|
end
|
|
|
|
if status.health == "Unknown" then
|
|
if status.applied ~= true then
|
|
health_status.status = "Degraded"
|
|
health_status.message = "Current resource status is unhealthy"
|
|
return health_status
|
|
end
|
|
end
|
|
end
|
|
|
|
health_status.status = "Healthy"
|
|
return health_status
|