argo-cd/resource_customizations/apps.openshift.io/DeploymentConfig/health.lua
Ishita Sequeira c0f2bf55a7
feat: health check for openshift DeploymentConfig (#7114)
* feat: health check for openshift DeploymentConfig

Signed-off-by: ishitasequeira <isequeir@redhat.com>

* Address PR comments

Signed-off-by: ishitasequeira <isequeir@redhat.com>
2021-09-03 17:26:31 +02:00

27 lines
No EOL
943 B
Lua

health_check = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
numTrue = 0
for i, condition in pairs(obj.status.conditions) do
if (condition.type == "Available" or condition.type == "Progressing") and condition.status == "True" then
numTrue = numTrue + 1
end
end
if numTrue == 2 then
health_check.status = "Healthy"
health_check.message = "replication controller successfully rolled out"
return health_check
elseif numTrue == 1 then
health_check.status = "Progressing"
health_check.message = "replication controller is waiting for pods to run"
return health_check
else
health_check.status = "Degraded"
health_check.message = "Deployment config is degraded"
return health_check
end
end
end
health_check.status = "Progressing"
health_check.message = "replication controller is waiting for pods to run"
return health_check