Skip to content

Commit 316ad89

Browse files
authored
scaffold: make pdb configurable (#363)
* scaffold: make pdb configurable * scaffold: fix typo
1 parent 2c48ff6 commit 316ad89

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
{{- $operator := (splitList "." .operatorName | first) -}}
2+
{{`{{`}}- if .Values.pdb.enabled {{`}}`}}
23
{{`{{`}}- if ge (int .Values.replicaCount) 2 {{`}}`}}
34
apiVersion: policy/v1
45
kind: PodDisruptionBudget
56
metadata:
67
name: {{`{{`}} include "{{ $operator }}.fullname" . {{`}}`}}
8+
{{`{{`}}- with .Values.pdb.annotations {{`}}`}}
9+
annotations:
10+
{{`{{`}}- toYaml . | nindent 4 {{`}}`}}
11+
{{`{{`}}- end {{`}}`}}
712
labels:
813
{{`{{`}}- include "{{ $operator }}.labels" . | nindent 4 {{`}}`}}
14+
{{`{{`}}- with .Values.pdb.labels {{`}}`}}
15+
{{`{{`}}- toYaml . | nindent 4 {{`}}`}}
16+
{{`{{`}}- end {{`}}`}}
917
spec:
10-
minAvailable: 1
18+
{{`{{`}}- if .Values.pdb.maxUnavailable {{`}}`}}
19+
maxUnavailable: {{`{{`}} .Values.pdb.maxUnavailable {{`}}`}}
20+
{{`{{`}}- else }}
21+
minAvailable: {{`{{`}} .Values.pdb.minAvailable {{`}}`}}
22+
{{`{{`}}- end {{`}}`}}
1123
selector:
1224
matchLabels:
1325
{{`{{`}}- include "{{ $operator }}.selectorLabels" . | nindent 6 {{`}}`}}
1426
{{`{{`}}- end {{`}}`}}
27+
{{`{{`}}- end {{`}}`}}

scaffold/templates/chart/values.yaml.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,18 @@ resources:
6262
# -- Memory request
6363
memory: 128Mi
6464

65+
pdb:
66+
# -- Whether to create a PodDisruptionBudget for the webhook
67+
enabled: true
68+
# -- Labels to set on the PodDisruptionBudget
69+
labels: {}
70+
# -- Annotations to set on the PodDisruptionBudget
71+
annotations: {}
72+
# -- Number of pods that are available after eviction as number or percentage (e.g. 50%)
73+
minAvailable: "1"
74+
# -- Number of pods that are unavailable after eviction as number or percentage (e.g: 50%); has higher precedence over `pdb.minAvailable`
75+
maxUnavailable: ""
76+
6577
{{- if or .validatingWebhookEnabled .mutatingWebhookEnabled }}
6678

6779
service:

0 commit comments

Comments
 (0)