Skip to content

Commit

Permalink
chore: Don't degrade PDB on InsufficientPods (#20171) (#20665)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
andrii-korotkov-verkada authored Nov 7, 2024
1 parent 3c366ed commit a7ff791
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions resource_customizations/policy/PodDisruptionBudget/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ tests:
inputPath: testdata/progressing.yaml
- healthStatus:
status: Degraded
message: 'PodDisruptionBudget has InsufficientPods'
message: 'PodDisruptionBudget has SyncFailed'
inputPath: testdata/degraded.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a7ff791

Please sign in to comment.