diff --git a/charts/kafka-ui/templates/deployment.yaml b/charts/kafka-ui/templates/deployment.yaml index 08d8a53..e86329c 100644 --- a/charts/kafka-ui/templates/deployment.yaml +++ b/charts/kafka-ui/templates/deployment.yaml @@ -183,7 +183,7 @@ spec: {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} - {{- end }} + {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} @@ -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 }} \ No newline at end of file diff --git a/charts/kafka-ui/templates/pod-disruption-budget.yaml b/charts/kafka-ui/templates/pod-disruption-budget.yaml new file mode 100644 index 0000000..89323f2 --- /dev/null +++ b/charts/kafka-ui/templates/pod-disruption-budget.yaml @@ -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 -}} \ No newline at end of file diff --git a/charts/kafka-ui/values.yaml b/charts/kafka-ui/values.yaml index 47ba40a..9b0c445 100644 --- a/charts/kafka-ui/values.yaml +++ b/charts/kafka-ui/values.yaml @@ -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 @@ -218,7 +220,6 @@ ingress: ## path: "/" - ## @param ingress.pathType Ingress path type pathType: "Prefix" @@ -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