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 PDB and topologySpreadConstraints for multi replica deployments #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion charts/kafka-ui/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ spec:
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
Expand All @@ -192,3 +192,15 @@ spec:
hostAliases:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.topologySpreadConstraints.enabled }}
topologySpreadConstraints:
- maxSkew: {{ .Values.topologySpreadConstraints.maxSkew }}
minDomains: {{ .Values.topologySpreadConstraints.minDomains }}
topologyKey: {{ .Values.topologySpreadConstraints.topologyKey }}
whenUnsatisfiable: {{ .Values.topologySpreadConstraints.whenUnsatisfiable }}
labelSelector:
matchLabels:
{{- include "kafka-ui.selectorLabels" . | nindent 14 }}
matchLabelKeys:
- pod-template-hash
{{- end }}
11 changes: 11 additions & 0 deletions charts/kafka-ui/templates/pod-disruption-budget.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{- if .Values.podDisruptionBudget.enabled -}}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ include "kafka-ui.fullname" . }}
spec:
{{- toYaml .Values.podDisruptionBudget.spec | nindent 2 }}
selector:
matchLabels:
{{- include "kafka-ui.selectorLabels" . | nindent 6 }}
{{- end -}}
21 changes: 18 additions & 3 deletions charts/kafka-ui/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ envs:
## @param envs.config Set of the environment variables to pass to Kafbat-UI
config: {}
## @param envs.secretMappings The mapping of existing secret to env variable.
secretMappings: {}
secretMappings:
{}
#ENV_NAME:
# name: kubernetes-secret-name
# keyName: kubernetes-secret-key
## @param envs.configMappings The mapping of configmap and keyName to get env variable.
configMappings: {}
configMappings:
{}
#ENV_NAME:
# name: kubernetes-configmap-name
# keyName: kubernetes-configmap-key
Expand Down Expand Up @@ -218,7 +220,6 @@ ingress:
##
path: "/"


## @param ingress.pathType Ingress path type
pathType: "Prefix"

Expand Down Expand Up @@ -269,3 +270,17 @@ affinity: {}

## @param revisionHistoryLimit [nullable] Specify how many old ReplicaSets for this Deployment you want to retain
revisionHistoryLimit: null

# Pod Disruption Budget: https://kubernetes.io/docs/tasks/run-application/configure-pdb/
podDisruptionBudget:
enabled: false
spec:
minAvailable: "50%"

# Topology Spread Constraints: https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/
topologySpreadConstraints:
enabled: false
maxSkew: 1
topologyKey: topology.kubernetes.io/zone
minDomains: 2
whenUnsatisfiable: DoNotSchedule # Must be DoNotSchedule if minDomains > 1