argo-cd/resource_customizations/install.istio.io/IstioOperator/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

33 lines
No EOL
1.3 KiB
Lua

local health_status = {}
if obj.status ~= nil then
if obj.status.status ~= nil then
if obj.status.status == 0 or obj.status.status == "NONE" then
health_status.status = "Unknown"
health_status.message = "Component is not present."
return health_status
end
if obj.status.status == 1 or obj.status.status == "UPDATING" then
health_status.status = "Progressing"
health_status.message = "Component is being updated to a different version."
return health_status
end
if obj.status.status == 2 or obj.status.status == "RECONCILING" then
health_status.status = "Progressing"
health_status.message = "Controller has started but not yet completed reconciliation loop for the component."
return health_status
end
if obj.status.status == 3 or obj.status.status == "HEALTHY" then
health_status.status = "Healthy"
health_status.message = "Component is healthy."
return health_status
end
if obj.status.status == 4 or obj.status.status == "ERROR" then
health_status.status = "Degraded"
health_status.message = "Component is in an error state."
return health_status
end
end
end
health_status.status = "Progressing"
health_status.message = "Waiting for Istio Control Plane"
return health_status