resource.customizations.useOpenLibs.autoscaling_HorizontalPodAutoscaler: "true"
resource.customizations.health.autoscaling_HorizontalPodAutoscaler: |
hs = {}
if obj.status ~= nil then
if obj.status.conditions ~= nil then
for i, condition in ipairs(obj.status.conditions) do
-- Mark Degraded only for certain conditions
if condition.type == "Ready" and condition.status == "False" then
hs.status = "Degraded"
hs.message = condition.message
return hs
end
-- Ignore AbleToScale=False with FailedUpdateScale reason caused by Thoras
if condition.type == "AbleToScale" and condition.status == "False" and condition.reason == "FailedUpdateScale" and string.find(condition.message or "", "target is already at Thoras desired replicas") ~= nil then
hs.status = "Healthy"
hs.message = "Target is at Thoras desired replicas"
return hs
end
-- Mark Healthy for Ready=True or ScalingActive=True
if (condition.type == "Ready" or condition.type == "ScalingActive") and condition.status == "True" then
hs.status = "Healthy"
hs.message = condition.message
return hs
end
end
end
end
hs.status = "Progressing"
hs.message = "Waiting for HPA to become healthy"
return hs