argo-cd/resource_customizations/s3.aws.crossplane.io/Bucket/health.lua
Jellyfrog 7f338e910f
feat(health): support for aws.crossplane.io resources (#19029)
* feat(health): support for iam.aws.crossplane.io resources

Signed-off-by: Jellyfrog <Jellyfrog@users.noreply.github.com>

* feat(health): support for bucket s3.aws.crossplane.io resource

Signed-off-by: Jellyfrog <Jellyfrog@users.noreply.github.com>

---------

Signed-off-by: Jellyfrog <Jellyfrog@users.noreply.github.com>
2024-07-12 10:46:06 -04:00

41 lines
1.2 KiB
Lua

local hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
local ready = false
local synced = false
local suspended = false
for i, condition in ipairs(obj.status.conditions) do
if condition.type == "Ready" then
ready = condition.status == "True"
ready_message = condition.reason
elseif condition.type == "Synced" then
synced = condition.status == "True"
if condition.reason == "ReconcileError" then
synced_message = condition.message
elseif condition.reason == "ReconcilePaused" then
suspended = true
suspended_message = condition.reason
end
end
end
if ready and synced then
hs.status = "Healthy"
hs.message = ready_message
elseif synced == false and suspended == true then
hs.status = "Suspended"
hs.message = suspended_message
elseif ready == false and synced == true and suspended == false then
hs.status = "Progressing"
hs.message = "Waiting for Bucket to be available"
else
hs.status = "Degraded"
hs.message = synced_message
end
return hs
end
end
hs.status = "Progressing"
hs.message = "Waiting for Bucket to be created"
return hs