website
website copied to clipboard
fix: invert deny condition logic in pdb policy
Related issue #1662
Proposed Changes
This PR fixes a bug in the deployment-replicas-higher-than-pdb policy where the deny condition logic was inverted, causing it to work opposite of its intended purpose.
- The policy's goal is to ensure a Deployment's
replicasare greater than a PDB'sminAvailable. However, the original rule was set to deny ifminAvailable >= replicas. This is the inverse of the desired logic and resulted in: - Allowing bad configurations (e.g.,
replicas: 3,minAvailable: 3) - potentially blocking good configurations.
This PR corrects the logic by:
-
Flipping the JMESPath expressions in the deny condition:
-
key:is now{{ element.spec.replicas }}(Deployment replica count) -
value:is now{{ request.object.spec.minAvailable }}(PDB minAvailable)
-
-
Changing the operator from
GreaterThanOrEqualstoLessThanOrEquals
Checklist
- [x] I have read the contributing guidelines.
- [x] I have inspected the website preview for accuracy.
- [x] I have signed off my issue.