Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for PDB and TopologySpreadConstraints #9

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion charts/kafka-ui/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ apiVersion: v2
name: kafka-ui
description: A Helm chart for kafka-UI
type: application
version: 0.7.4
version: 0.7.5
appVersion: v0.7.1
icon: https://github.com/provectus/kafka-ui/raw/master/documentation/images/kafka-ui-logo.png
8 changes: 8 additions & 0 deletions charts/kafka-ui/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ spec:
serviceAccountName: {{ include "kafka-ui.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- with .Values.priorityClassName }}
priorityClassName:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand Down Expand Up @@ -148,3 +152,7 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
24 changes: 24 additions & 0 deletions charts/kafka-ui/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{- if .Values.podDisruptionBudget.enabled -}}
{{- $kubeCapabilityVersion := semver .Capabilities.KubeVersion.Version -}}
{{- $isHigher1p21 := ge (semver "1.21" | $kubeCapabilityVersion.Compare) 0 -}}
{{- if $isHigher1p21 -}}
apiVersion: policy/v1
{{- else }}
apiVersion: policy/v1beta1
{{- end }}
kind: PodDisruptionBudget
metadata:
name: {{ include "kafka-ui.fullname" . }}
labels:
{{- include "kafka-ui.labels" . | nindent 4 }}
spec:
{{- if .Values.podDisruptionBudget.minAvailable }}
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
{{- end }}
{{- if .Values.podDisruptionBudget.maxUnavailable }}
maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }}
{{- end }}
selector:
matchLabels:
{{- include "kafka-ui.selectorLabels" . | nindent 6 }}
{{- end -}}
18 changes: 18 additions & 0 deletions charts/kafka-ui/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,17 @@ securityContext:
# runAsNonRoot: true
# runAsUser: 1000

## Set Pod Priority Class - importance of Pod relatives to other pods
##
priorityClassName: default

## Set Pod Disruption Budget to limit the number of concurrent disruptions
## Ref: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
podDisruptionBudget:
enabled: false
minAvailable: ""
maxUnavailable: ""

service:
type: ClusterIP
port: 80
Expand Down Expand Up @@ -161,3 +172,10 @@ initContainers: {}
volumeMounts: {}

volumes: {}

## Set custom TopologySpreadConstraints to manage the distribution of Pods across cluster’s failure-domains
## Ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
topologySpreadConstraints: []
# - maxSkew: 1
# topologyKey: kubernetes.io/hostname
# whenUnsatisfiable: DoNotSchedule
Loading