Skip to content

Commit

Permalink
fix(pdb-minavailable-check): ensure correct handling of 0 replicas wo…
Browse files Browse the repository at this point in the history
…rkloads (kyverno#800)

Signed-off-by: Erik Godding Boye <[email protected]>
  • Loading branch information
erikgb authored Nov 3, 2023
1 parent f9a92b8 commit dca9803
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion other/m-q/pdb-minavailable/artifacthub-pkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ annotations:
kyverno/category: "Other"
kyverno/kubernetesVersion: "1.24"
kyverno/subject: "PodDisruptionBudget, Deployment, StatefulSet"
digest: bcb87ac5337aad2386c47726f85247202cdbaca62e62a6e96085adaddb7159e7
digest: f6f12d2b34642666ce110807b85756d86012a840a15f236c53e2a4866347b628
3 changes: 3 additions & 0 deletions other/m-q/pdb-minavailable/pdb-minavailable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ spec:
value:
- CREATE
- UPDATE
- key: "{{ request.object.spec.replicas || `1` }}"
operator: GreaterThan
value: 0
context:
- name: minavailable
apiCall:
Expand Down
32 changes: 26 additions & 6 deletions other/m-q/pdb-minavailable/ss-good.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ metadata:
spec:
selector:
matchLabels:
app: busybox
app: bb1
replicas: 2
template:
metadata:
labels:
app: busybox
app: bb1
spec:
terminationGracePeriodSeconds: 10
containers:
Expand All @@ -25,12 +25,12 @@ metadata:
spec:
selector:
matchLabels:
app: busybox
app: bb2
replicas: 1
template:
metadata:
labels:
app: busybox
app: bb2
spec:
terminationGracePeriodSeconds: 10
containers:
Expand All @@ -45,12 +45,32 @@ metadata:
spec:
selector:
matchLabels:
app: bb
app: bb3
replicas: 1
template:
metadata:
labels:
app: bb
app: bb3
spec:
terminationGracePeriodSeconds: 10
containers:
- name: busbyox
image: busybox:1.35
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: goodss04
namespace: pdb-minavailable-ns
spec:
selector:
matchLabels:
app: bb4
replicas: 0
template:
metadata:
labels:
app: bb4
spec:
terminationGracePeriodSeconds: 10
containers:
Expand Down

0 comments on commit dca9803

Please sign in to comment.