chore: Don't degrade PDB on InsufficientPods (#20171) (#20665)

Closes #20171

There are valid use cases for InsufficientPods, e.g. running some jobs or tests that don't want to be terminated. See the discussion on the issue for more details. So don't degrade the PDB on InsufficientPods condition.

This needs to be cherry picked to 2.13, as many people may not upgrade otherwise.

Signed-off-by: Andrii Korotkov <andrii.korotkov@verkada.com>
This commit is contained in:
Andrii Korotkov
2024-11-07 09:09:52 -08:00
committed by GitHub
parent 3c366edc24
commit a7ff791ba5
3 changed files with 11 additions and 4 deletions

View File

@@ -7,12 +7,13 @@ 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
if condition.status == "False" then
-- InsufficientPods can have valid use cases
-- See a discussion in https://github.com/argoproj/argo-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
end
if condition.status == "True" then
else
hs.status = "Healthy"
hs.message = "PodDisruptionBudget has " .. condition.reason
end

View File

@@ -9,5 +9,5 @@ tests:
inputPath: testdata/progressing.yaml
- healthStatus:
status: Degraded
message: 'PodDisruptionBudget has InsufficientPods'
message: 'PodDisruptionBudget has SyncFailed'
inputPath: testdata/degraded.yaml

View File

@@ -16,6 +16,12 @@ status:
reason: InsufficientPods
status: "False"
type: DisruptionAllowed
- lastTransitionTime: "2024-09-06T18:29:06Z"
message: ""
observedGeneration: 2
reason: SyncFailed
status: "False"
type: DisruptionAllowed
currentHealthy: 2
desiredHealthy: 3
disruptionsAllowed: 0