From f0b7fd7b8ba71f8ee734ebf7d18da55b23023b4b Mon Sep 17 00:00:00 2001 From: lorenz <stu203404@mail.uni-kiel.de> Date: Fri, 2 Sep 2022 18:06:47 +0200 Subject: [PATCH] Add topologySpreadConstraints to helm strimzi template to kafka and zookeeper --- helm/templates/kafka/kafka-cluster.yaml | 28 +++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/helm/templates/kafka/kafka-cluster.yaml b/helm/templates/kafka/kafka-cluster.yaml index ee2bd0f1c..874826458 100644 --- a/helm/templates/kafka/kafka-cluster.yaml +++ b/helm/templates/kafka/kafka-cluster.yaml @@ -5,6 +5,9 @@ metadata: name: {{ template "theodolite.fullname" . }}-kafka spec: kafka: + resources: + requests: + cpu: "2000m" jmxOptions: {} {{- with .Values.strimzi.kafka.listeners }} listeners: @@ -30,9 +33,21 @@ spec: configMapKeyRef: name: {{ template "theodolite.fullname" . }}-kafka-metrics key: kafka-metrics-config.yml - {{- with .Values.strimzi.kafka.template}} template: - {{- toYaml . | nindent 6 }} + pod: + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: kubernetes.io/hostname + whenUnsatisfiable: ScheduleAnyway + labelSelector: + matchLabels: + strimzi.io/name: theodolite-kafka-kafka + {{- with .Values.strimzi.kafka.nodeSelectorTerms}} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + {{- toYaml . | nindent 16 }} {{- end}} {{- with .Values.strimzi.kafka.resources}} resources: @@ -47,9 +62,14 @@ spec: {{- end }} storage: type: ephemeral - {{- with .Values.strimzi.kafka.template}} + {{- with .Values.strimzi.zookeeper.nodeSelectorTerms}} template: - {{- toYaml . | nindent 6 }} + pod: + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + {{- toYaml . | nindent 16 }} {{- end}} kafkaExporter: {} -- GitLab