Skip to content

Commit cc87567

Browse files
authored
Merge pull request #1001 from kubeshop/TKC-3357/add-poddisruptionbudget-to-testkube-cloud-charts
feat: add pdb
2 parents 2f23d9e + 73441ef commit cc87567

File tree

8 files changed

+174
-1
lines changed

8 files changed

+174
-1
lines changed

charts/testkube-api/templates/minio.yaml

+29-1
Original file line numberDiff line numberDiff line change
@@ -273,5 +273,33 @@ spec:
273273
{{- include "global.tplvalues.render" ( dict "value" .Values.minio.serviceMonitor.matchLabels "context" $ ) | nindent 6 }}
274274
{{- end }}
275275
{{- end }}
276-
276+
---
277+
{{- if or .Values.global.podDisruptionBudget.enabled .Values.minio.podDisruptionBudget.enabled }}
278+
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}}
279+
apiVersion: policy/v1
280+
{{- else -}}
281+
apiVersion: policy/v1beta1
282+
{{- end }}
283+
kind: PodDisruptionBudget
284+
metadata:
285+
name: testkube-minio
286+
labels:
287+
{{ include "global.labels.standard" . | nindent 4 }}
288+
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
289+
app.kubernetes.io/name: minio
290+
app.kubernetes.io/instance: {{ .Release.Name }}
291+
spec:
292+
{{- if .Values.minio.podDisruptionBudget.minAvailable }}
293+
minAvailable: {{ .Values.minio.podDisruptionBudget.minAvailable }}
294+
{{- end }}
295+
{{- if or .Values.minio.podDisruptionBudget.maxUnavailable (not .Values.minio.podDisruptionBudget.minAvailable) }}
296+
maxUnavailable: {{ .Values.minio.podDisruptionBudget.maxUnavailable | default 1 }}
297+
{{- end }}
298+
selector:
299+
matchLabels:
300+
app: testkube-minio-{{ .Release.Namespace }}
301+
{{- if .Values.minio.matchLabels }}
302+
{{- include "global.tplvalues.render" ( dict "value" .Values.minio.matchLabels "context" $ ) | nindent 6 }}
303+
{{- end }}
304+
{{- end }}
277305
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- if or .Values.global.podDisruptionBudget.enabled .Values.podDisruptionBudget.enabled }}
2+
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}}
3+
apiVersion: policy/v1
4+
{{- else -}}
5+
apiVersion: policy/v1beta1
6+
{{- end }}
7+
kind: PodDisruptionBudget
8+
metadata:
9+
name: {{ template "testkube-api.fullname" . }}
10+
labels:
11+
{{ include "testkube-api.labels" . | indent 4 }}
12+
spec:
13+
{{- if .Values.podDisruptionBudget.minAvailable }}
14+
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
15+
{{- end }}
16+
{{- if or .Values.podDisruptionBudget.maxUnavailable (not .Values.podDisruptionBudget.minAvailable) }}
17+
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable | default 1 }}
18+
{{- end }}
19+
selector:
20+
matchLabels:
21+
{{- include "testkube-api.selectorLabels" . | nindent 6 }}
22+
{{- end }}

charts/testkube-api/values.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ global:
1313
nodeSelector: {}
1414
affinity: {}
1515
tolerations: []
16+
podDisruptionBudget:
17+
enabled: false
1618
## Global TLS settings
1719
tls:
1820
## Toggle whether to globally skip certificate verification
@@ -620,6 +622,13 @@ minio:
620622
## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
621623
## Note: podAffinityPreset, podAntiAffinityPreset, and nodeAffinityPreset will be ignored when it's set
622624
affinity: {}
625+
podDisruptionBudget:
626+
# -- Enable a [pod distruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) to help dealing with [disruptions](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/).
627+
enabled: false
628+
# -- (int/percentage) Number or percentage of pods that must remain available.
629+
minAvailable: ""
630+
# -- (int/percentage) Number or percentage of pods that can be unavailable.
631+
maxUnavailable: ""
623632
## Minio image from DockerHub
624633
image:
625634
registry: docker.io
@@ -748,3 +757,11 @@ livenessProbe:
748757
## Might need further increase if observing "431 Request Header Fields Too Large from api server"
749758
## See https://github.com/kubeshop/testkube/pull/2871#issuecomment-1341116696
750759
httpReadBufferSize: 8192
760+
761+
## Enable a [pod distruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) to help dealing with [disruptions](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/).
762+
podDisruptionBudget:
763+
enabled: false
764+
# -- (int/percentage) Number or percentage of pods that must remain available.
765+
minAvailable: ""
766+
# -- (int/percentage) Number or percentage of pods that can be unavailable.
767+
maxUnavailable: ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- if or .Values.global.podDisruptionBudget.enabled .Values.podDisruptionBudget.enabled }}
2+
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}}
3+
apiVersion: policy/v1
4+
{{- else -}}
5+
apiVersion: policy/v1beta1
6+
{{- end }}
7+
kind: PodDisruptionBudget
8+
metadata:
9+
name: {{ template "testkube-logs.fullname" . }}
10+
labels:
11+
{{ include "testkube-logs.labels" . | indent 4 }}
12+
spec:
13+
{{- if .Values.podDisruptionBudget.minAvailable }}
14+
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
15+
{{- end }}
16+
{{- if or .Values.podDisruptionBudget.maxUnavailable (not .Values.podDisruptionBudget.minAvailable) }}
17+
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable | default 1 }}
18+
{{- end }}
19+
selector:
20+
matchLabels:
21+
{{- include "testkube-logs.selectorLabels" . | nindent 6 }}
22+
{{- end }}

charts/testkube-logs/values.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ global:
2525
containerSecurityContext: {}
2626
# -- Global security Context for all pods
2727
podSecurityContext: {}
28+
# -- Global pdb
29+
podDisruptionBudget:
30+
enabled: false
2831

2932
debug: true
3033

@@ -265,3 +268,11 @@ storage:
265268
scrapperEnabled: true
266269
# -- Toggle whether to compress artifacts in Testkube API
267270
compressArtifacts: true
271+
272+
## Enable a [pod distruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) to help dealing with [disruptions](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/).
273+
podDisruptionBudget:
274+
enabled: true
275+
# -- (int/percentage) Number or percentage of pods that must remain available.
276+
minAvailable: ""
277+
# -- (int/percentage) Number or percentage of pods that can be unavailable.
278+
maxUnavailable: ""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{{- if or .Values.global.podDisruptionBudget.enabled .Values.podDisruptionBudget.enabled }}
2+
{{- if semverCompare ">=1.21-0" .Capabilities.KubeVersion.GitVersion -}}
3+
apiVersion: policy/v1
4+
{{- else -}}
5+
apiVersion: policy/v1beta1
6+
{{- end }}
7+
kind: PodDisruptionBudget
8+
metadata:
9+
name: {{ template "testkube-operator.fullname" . }}
10+
labels:
11+
{{ include "testkube-operator.labels" . | indent 4 }}
12+
spec:
13+
{{- if .Values.podDisruptionBudget.minAvailable }}
14+
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
15+
{{- end }}
16+
{{- if or .Values.podDisruptionBudget.maxUnavailable (not .Values.podDisruptionBudget.minAvailable) }}
17+
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable | default 1 }}
18+
{{- end }}
19+
selector:
20+
matchLabels:
21+
{{- include "testkube-operator.selectorLabels" . | nindent 6 }}
22+
{{- end }}

charts/testkube-operator/values.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ global:
2020
containerSecurityContext: {}
2121
# -- Global security Context for all pods
2222
podSecurityContext: {}
23+
# -- Global pdb
24+
podDisruptionBudget:
25+
enabled: false
2326

2427
### @section Common parameters
2528
## Kubernetes version (using Helm capabilities if not set)
@@ -327,3 +330,11 @@ testConnection:
327330

328331
## Pass a custom cronJobTemplate to the Testkube Operator Deployment
329332
cronJobTemplate: ""
333+
334+
## Enable a [pod distruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) to help dealing with [disruptions](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/).
335+
podDisruptionBudget:
336+
enabled: false
337+
# -- (int/percentage) Number or percentage of pods that must remain available.
338+
minAvailable: ""
339+
# -- (int/percentage) Number or percentage of pods that can be unavailable.
340+
maxUnavailable: ""

charts/testkube/values.yaml

+40
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ global:
2323
operator: Equal
2424
value: arm64
2525
effect: NoSchedule
26+
# -- PodDisruptionBudget for all Testkube services, except for MongoDB, where it must be enabled specifically.
27+
podDisruptionBudget:
28+
enabled: false
2629
## Features map for the whole chart
2730
features:
2831
# -- Toggle whether to enable V2 log support
@@ -94,6 +97,13 @@ mongodb:
9497
requests:
9598
cpu: 150m
9699
memory: 100Mi
100+
# -- Enable a [pod distruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) to help dealing with [disruptions](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/).
101+
pdb:
102+
create: true
103+
# -- Minimum number/percentage of pods that must still be available after the eviction
104+
minAvailable: ""
105+
# -- Maximum number/percentage of pods that may be made unavailable after the eviction
106+
maxUnavailable: ""
97107
# Image built with ZCube tool so that it can be run on ARM nodes: https://github.com/ZCube/bitnami-compat/tree/main/patches
98108
# Currently Bitnami doesn't support ARM: https://github.com/bitnami/charts/issues/7305
99109
image:
@@ -275,6 +285,13 @@ testkube-logs:
275285
# -- Test Connection pod
276286
testConnection:
277287
enabled: false
288+
# -- Enable a [pod distruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) to help dealing with [disruptions](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/).
289+
podDisruptionBudget:
290+
enabled: false
291+
# -- (int/percentage) Number or percentage of pods that must remain available.
292+
minAvailable: ""
293+
# -- (int/percentage) Number or percentage of pods that can be unavailable.
294+
maxUnavailable: ""
278295

279296
# Testkube API parameters
280297
testkube-api:
@@ -432,6 +449,14 @@ testkube-api:
432449
# -- Annotations to add to the service account
433450
annotations: {}
434451

452+
# -- Enable a [pod distruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) to help dealing with [disruptions](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/).
453+
podDisruptionBudget:
454+
enabled: false
455+
# -- (int/percentage) Number or percentage of pods that must remain available.
456+
minAvailable: ""
457+
# -- (int/percentage) Number or percentage of pods that can be unavailable.
458+
maxUnavailable: ""
459+
435460
# Testkube Agent settings
436461
cloud:
437462
# -- Testkube Cloud API URL
@@ -601,6 +626,13 @@ testkube-api:
601626
# Note: podAffinityPreset, podAntiAffinityPreset, and nodeAffinityPreset will be ignored when it's set
602627
# -- Affinity for pod assignment.
603628
affinity: {}
629+
podDisruptionBudget:
630+
# -- Enable a [pod distruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) to help dealing with [disruptions](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/).
631+
enabled: false
632+
# -- (int/percentage) Number or percentage of pods that must remain available.
633+
minAvailable: ""
634+
# -- (int/percentage) Number or percentage of pods that can be unavailable.
635+
maxUnavailable: ""
604636
# -- Minio image from DockerHub
605637
image:
606638
registry: docker.io
@@ -961,6 +993,14 @@ testkube-operator:
961993
# -- Operator k8s secret for private registries
962994
pullSecrets: []
963995

996+
# -- Enable a [pod distruption budget](https://kubernetes.io/docs/tasks/run-application/configure-pdb/) to help dealing with [disruptions](https://kubernetes.io/docs/concepts/workloads/pods/disruptions/).
997+
podDisruptionBudget:
998+
enabled: false
999+
# -- (int/percentage) Number or percentage of pods that must remain available.
1000+
minAvailable: ""
1001+
# -- (int/percentage) Number or percentage of pods that can be unavailable.
1002+
maxUnavailable: ""
1003+
9641004
# Testkube Operator rbac-proxy settings
9651005
proxy:
9661006
# Proxy Image parameters

0 commit comments

Comments
 (0)