argo-cd/resource_customizations/keda.sh/ScaledObject/health.lua
Rick Brouwer d3223a8c9f
feat: add Fallback condition to KEDA ScaledObject health assessment (#22844)
Signed-off-by: Rick Brouwer <rickbrouwer@gmail.com>
2025-05-21 15:23:40 -04:00

39 lines
1.1 KiB
Lua

local hs = {}
local healthy = false
local degraded = false
local suspended = false
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
if condition.status == "False" and condition.type == "Ready" then
hs.message = condition.message
degraded = true
end
if condition.status == "True" and condition.type == "Ready" then
hs.message = condition.message
healthy = true
end
if condition.status == "True" and condition.type == "Paused" then
hs.message = condition.message
suspended = true
end
if condition.status == "True" and condition.type == "Fallback" then
hs.message = condition.message
degraded = true
end
end
end
end
if degraded == true then
hs.status = "Degraded"
return hs
elseif healthy == true and suspended == false then
hs.status = "Healthy"
return hs
elseif healthy == true and suspended == true then
hs.status = "Suspended"
return hs
end
hs.status = "Progressing"
hs.message = "Creating HorizontalPodAutoscaler Object"
return hs