mirror of
https://github.com/hanzoai/cd.git
synced 2026-10-30 14:56:45 +00:00
The health and action fixtures carried sample object names from the upstream project; renamed in step with every assertion that reads them.
25 lines
815 B
Lua
25 lines
815 B
Lua
-- Reference CRD can be found here:
|
|
-- https://kubernetes.io/docs/reference/kubernetes-api/policy-resources/pod-disruption-budget-v1/
|
|
hs = {}
|
|
hs.status = "Progressing"
|
|
hs.message = "Waiting for status"
|
|
|
|
if obj.status ~= nil then
|
|
if obj.status.conditions ~= nil then
|
|
for i, condition in ipairs(obj.status.conditions) do
|
|
-- InsufficientPods can have valid use cases
|
|
-- See a discussion in https://github.com/hanzocd/cd/issues/20171 for more details
|
|
if condition.status == "False" and condition.reason ~= "InsufficientPods" then
|
|
hs.status = "Degraded"
|
|
hs.message = "PodDisruptionBudget has " .. condition.reason
|
|
return hs
|
|
else
|
|
hs.status = "Healthy"
|
|
hs.message = "PodDisruptionBudget has " .. condition.reason
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
return hs
|