123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515 |
- {{- $replicaCount := int .Values.replicaCount }}
- {{- $fullname := include "kafka.fullname" . }}
- {{- $releaseNamespace := .Release.Namespace }}
- {{- $clusterDomain := .Values.clusterDomain }}
- {{- $interBrokerPort := .Values.service.internalPort }}
- {{- $clientPort := .Values.service.port }}
- {{- $interBrokerProtocol := include "kafka.listenerType" (dict "protocol" .Values.auth.interBrokerProtocol) -}}
- {{- $clientProtocol := include "kafka.listenerType" (dict "protocol" .Values.auth.clientProtocol) -}}
- {{- $loadBalancerIPListLength := len .Values.externalAccess.service.loadBalancerIPs }}
- {{- if not (and .Values.externalAccess.enabled (not .Values.externalAccess.autoDiscovery.enabled) (not (eq $replicaCount $loadBalancerIPListLength )) (eq .Values.externalAccess.service.type "LoadBalancer")) }}
- apiVersion: {{ include "common.capabilities.statefulset.apiVersion" . }}
- kind: StatefulSet
- metadata:
- name: {{ include "kafka.fullname" . }}
- labels: {{- include "common.labels.standard" . | nindent 4 }}
- app.kubernetes.io/component: kafka
- {{- if .Values.commonLabels }}
- {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
- {{- end }}
- {{- if .Values.commonAnnotations }}
- annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
- {{- end }}
- spec:
- podManagementPolicy: {{ .Values.podManagementPolicy }}
- replicas: {{ .Values.replicaCount }}
- selector:
- matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
- app.kubernetes.io/component: kafka
- serviceName: {{ template "kafka.fullname" . }}-headless
- updateStrategy:
- type: {{ .Values.updateStrategy | quote }}
- {{- if (eq "OnDelete" .Values.updateStrategy) }}
- rollingUpdate: null
- {{- else if .Values.rollingUpdatePartition }}
- rollingUpdate:
- partition: {{ .Values.rollingUpdatePartition }}
- {{- end }}
- template:
- metadata:
- labels: {{- include "common.labels.standard" . | nindent 8 }}
- app.kubernetes.io/component: kafka
- {{- if .Values.podLabels }}
- {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }}
- {{- end }}
- {{- if or (include "kafka.createConfigmap" .) (include "kafka.createJaasSecret" .) .Values.externalAccess.enabled (include "kafka.metrics.jmx.createConfigmap" .) .Values.podAnnotations }}
- annotations:
- {{- if (include "kafka.createConfigmap" .) }}
- checksum/configuration: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
- {{- end }}
- {{- if (include "kafka.createJaasSecret" .) }}
- checksum/jaas-secret: {{ include (print $.Template.BasePath "/jaas-secret.yaml") . | sha256sum }}
- {{- end }}
- {{- if (include "kafka.createTlsSecret" .) }}
- checksum/tls-secret: {{ include (print $.Template.BasePath "/tls-secret.yaml") . | sha256sum }}
- {{- end }}
- {{- if .Values.externalAccess.enabled }}
- checksum/scripts: {{ include (print $.Template.BasePath "/scripts-configmap.yaml") . | sha256sum }}
- {{- end }}
- {{- if (include "kafka.metrics.jmx.createConfigmap" .) }}
- checksum/jmx-configuration: {{ include (print $.Template.BasePath "/jmx-configmap.yaml") . | sha256sum }}
- {{- end }}
- {{- if .Values.podAnnotations }}
- {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
- {{- end }}
- {{- end }}
- spec:
- {{- include "kafka.imagePullSecrets" . | nindent 6 }}
- {{- if .Values.hostAliases }}
- hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }}
- {{- end }}
- {{- if .Values.schedulerName }}
- schedulerName: {{ .Values.schedulerName | quote }}
- {{- end }}
- {{- if .Values.affinity }}
- affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }}
- {{- else }}
- affinity:
- podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }}
- podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }}
- nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
- {{- end }}
- {{- if .Values.nodeSelector }}
- nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
- {{- end }}
- {{- if .Values.tolerations }}
- tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }}
- {{- end }}
- {{- if .Values.terminationGracePeriodSeconds }}
- terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }}
- {{- end }}
- {{- if .Values.priorityClassName }}
- priorityClassName: {{ .Values.priorityClassName }}
- {{- end }}
- {{- if .Values.podSecurityContext.enabled }}
- securityContext: {{- omit .Values.podSecurityContext "enabled" | toYaml | nindent 8 }}
- {{- end }}
- serviceAccountName: {{ template "kafka.serviceAccountName" . }}
- {{- if or (and .Values.volumePermissions.enabled .Values.persistence.enabled) (and .Values.externalAccess.enabled .Values.externalAccess.autoDiscovery.enabled) .Values.initContainers }}
- initContainers:
- {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }}
- - name: volume-permissions
- image: {{ include "kafka.volumePermissions.image" . }}
- imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
- command:
- - /bin/bash
- args:
- - -ec
- - |
- chown -R "{{ .Values.podSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }}" "{{ .Values.persistence.mountPath }}"
- chown -R "{{ .Values.podSecurityContext.runAsUser }}:{{ .Values.podSecurityContext.fsGroup }}" "{{ .Values.logPersistence.mountPath }}"
- securityContext: {{- .Values.volumePermissions.securityContext | toYaml | nindent 12 }}
- {{- if .Values.volumePermissions.resources }}
- resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }}
- {{- end }}
- volumeMounts:
- - name: data
- mountPath: {{ .Values.persistence.mountPath }}
- - name: logs
- mountPath: {{ .Values.logPersistence.mountPath }}
- {{- end }}
- {{- if and .Values.externalAccess.enabled .Values.externalAccess.autoDiscovery.enabled }}
- - name: auto-discovery
- image: {{ include "kafka.externalAccess.autoDiscovery.image" . }}
- imagePullPolicy: {{ .Values.externalAccess.autoDiscovery.image.pullPolicy | quote }}
- command:
- - /scripts/auto-discovery.sh
- env:
- - name: MY_POD_NAME
- valueFrom:
- fieldRef:
- fieldPath: metadata.name
- - name: SHARED_FILE
- value: "/shared/info.txt"
- {{- if .Values.externalAccess.autoDiscovery.resources }}
- resources: {{- toYaml .Values.externalAccess.autoDiscovery.resources | nindent 12 }}
- {{- end }}
- volumeMounts:
- - name: shared
- mountPath: /shared
- - name: logs
- mountPath: {{ .Values.logPersistence.mountPath }}
- - name: scripts
- mountPath: /scripts/auto-discovery.sh
- subPath: auto-discovery.sh
- {{- end }}
- {{- if .Values.initContainers }}
- {{- include "common.tplvalues.render" ( dict "value" .Values.initContainers "context" $ ) | nindent 8 }}
- {{- end }}
- {{- end }}
- containers:
- - name: kafka
- image: {{ include "kafka.image" . }}
- imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
- command: {{- include "common.tplvalues.render" (dict "value" .Values.command "context" $) | nindent 12 }}
- {{- if .Values.args }}
- args: {{- include "common.tplvalues.render" (dict "value" .Values.args "context" $) | nindent 12 }}
- {{- end }}
- env:
- - name: BITNAMI_DEBUG
- value: {{ ternary "true" "false" .Values.image.debug | quote }}
- - name: MY_POD_IP
- valueFrom:
- fieldRef:
- fieldPath: status.podIP
- - name: MY_POD_NAME
- valueFrom:
- fieldRef:
- fieldPath: metadata.name
- - name: KAFKA_CFG_ZOOKEEPER_CONNECT
- {{- if .Values.zookeeper.enabled }}
- value: {{ include "kafka.zookeeper.fullname" . | quote }}
- {{- else }}
- value: {{ include "common.tplvalues.render" (dict "value" (join "," .Values.externalZookeeper.servers) "context" $) }}
- {{- end }}
- - name: KAFKA_INTER_BROKER_LISTENER_NAME
- value: {{ .Values.interBrokerListenerName | quote }}
- - name: KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP
- {{- if .Values.listenerSecurityProtocolMap }}
- value: {{ .Values.listenerSecurityProtocolMap | quote }}
- {{- else if .Values.externalAccess.enabled }}
- value: "INTERNAL:{{ $interBrokerProtocol }},CLIENT:{{ $clientProtocol }},EXTERNAL:{{ $clientProtocol }}"
- {{- else }}
- value: "INTERNAL:{{ $interBrokerProtocol }},CLIENT:{{ $clientProtocol }}"
- {{- end }}
- {{- if or ($clientProtocol | regexFind "SASL") ($interBrokerProtocol | regexFind "SASL") (coalesce .Values.auth.sasl.jaas.zookeeperUser .Values.auth.jaas.zookeeperUser) }}
- - name: KAFKA_CFG_SASL_ENABLED_MECHANISMS
- value: {{ upper (coalesce .Values.auth.sasl.mechanisms .Values.auth.saslMechanisms) | quote }}
- - name: KAFKA_CFG_SASL_MECHANISM_INTER_BROKER_PROTOCOL
- value: {{ upper (coalesce .Values.auth.sasl.interBrokerMechanism .Values.auth.saslInterBrokerMechanism) | quote }}
- {{- end }}
- - name: KAFKA_CFG_LISTENERS
- {{- if .Values.listeners }}
- value: {{ join "," .Values.listeners }}
- {{- else if .Values.externalAccess.enabled }}
- value: "INTERNAL://:{{ $interBrokerPort }},CLIENT://:9092,EXTERNAL://:9094"
- {{- else }}
- value: "INTERNAL://:{{ $interBrokerPort }},CLIENT://:9092"
- {{- end }}
- {{- if .Values.externalAccess.enabled }}
- {{- if .Values.externalAccess.autoDiscovery.enabled }}
- - name: SHARED_FILE
- value: "/shared/info.txt"
- {{- end }}
- {{- if eq .Values.externalAccess.service.type "NodePort" }}
- - name: HOST_IP
- valueFrom:
- fieldRef:
- fieldPath: status.hostIP
- {{- end }}
- {{- else }}
- - name: KAFKA_CFG_ADVERTISED_LISTENERS
- {{- if .Values.advertisedListeners }}
- value: {{ join "," .Values.advertisedListeners }}
- {{- else }}
- value: "INTERNAL://$(MY_POD_NAME).{{ $fullname }}-headless.{{ $releaseNamespace }}.svc.{{ $clusterDomain }}:{{ $interBrokerPort }},CLIENT://$(MY_POD_NAME).{{ $fullname }}-headless.{{ $releaseNamespace }}.svc.{{ $clusterDomain }}:{{ $clientPort }}"
- {{- end }}
- {{- end }}
- - name: ALLOW_PLAINTEXT_LISTENER
- value: {{ ternary "yes" "no" .Values.allowPlaintextListener | quote }}
- {{- if or (include "kafka.client.saslAuthentication" .) (include "kafka.interBroker.saslAuthentication" .) }}
- - name: KAFKA_OPTS
- value: "-Djava.security.auth.login.config=/opt/bitnami/kafka/config/kafka_jaas.conf"
- {{- if (include "kafka.client.saslAuthentication" .) }}
- - name: KAFKA_CLIENT_USERS
- value: {{ join "," (coalesce .Values.auth.sasl.jaas.clientUsers .Values.auth.jaas.clientUsers) | quote }}
- - name: KAFKA_CLIENT_PASSWORDS
- valueFrom:
- secretKeyRef:
- name: {{ include "kafka.jaasSecretName" . }}
- key: client-passwords
- {{- end }}
- {{- if (include "kafka.interBroker.saslAuthentication" .) }}
- - name: KAFKA_INTER_BROKER_USER
- value: {{ coalesce .Values.auth.sasl.jaas.interBrokerUser .Values.auth.jaas.interBrokerUser | quote }}
- - name: KAFKA_INTER_BROKER_PASSWORD
- valueFrom:
- secretKeyRef:
- name: {{ include "kafka.jaasSecretName" . }}
- key: inter-broker-password
- {{- end }}
- {{- end }}
- {{- if and .Values.zookeeper.auth.enabled (coalesce .Values.auth.sasl.jaas.zookeeperUser .Values.auth.jaas.zookeeperUser) }}
- - name: KAFKA_ZOOKEEPER_PROTOCOL
- value: "SASL"
- - name: KAFKA_ZOOKEEPER_USER
- value: {{ coalesce .Values.auth.sasl.jaas.zookeeperUser .Values.auth.jaas.zookeeperUser | quote }}
- - name: KAFKA_ZOOKEEPER_PASSWORD
- valueFrom:
- secretKeyRef:
- name: {{ include "kafka.jaasSecretName" . }}
- key: zookeeper-password
- {{- end }}
- {{- if (include "kafka.tlsEncryption" .) }}
- - name: KAFKA_CFG_TLS_TYPE
- value: {{ upper .Values.auth.tls.type | quote }}
- - name: KAFKA_CFG_SSL_ENDPOINT_IDENTIFICATION_ALGORITHM
- value: {{ default "" (coalesce .Values.auth.tls.endpointIdentificationAlgorithm .Values.auth.tlsEndpointIdentificationAlgorithm) | quote }}
- - name: KAFKA_CFG_TLS_CLIENT_AUTH
- value: {{ ternary "required" "none" (eq .Values.auth.clientProtocol "mtls") | quote }}
- {{- $tlsPassword := coalesce .Values.auth.tls.password .Values.auth.jksPassword }}
- - name: KAFKA_CERTIFICATE_PASSWORD
- value: {{ default "" $tlsPassword | quote }}
- {{- end }}
- {{- if .Values.metrics.jmx.enabled }}
- - name: JMX_PORT
- value: "5555"
- {{- end }}
- - name: KAFKA_VOLUME_DIR
- value: {{ .Values.persistence.mountPath | quote }}
- - name: KAFKA_LOG_DIR
- value: {{ .Values.logPersistence.mountPath | quote }}
- - name: KAFKA_CFG_DELETE_TOPIC_ENABLE
- value: {{ .Values.deleteTopicEnable | quote }}
- - name: KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE
- value: {{ .Values.autoCreateTopicsEnable | quote }}
- - name: KAFKA_HEAP_OPTS
- value: {{ .Values.heapOpts | quote }}
- - name: KAFKA_CFG_LOG_FLUSH_INTERVAL_MESSAGES
- value: {{ .Values.logFlushIntervalMessages | replace "_" "" | quote }}
- - name: KAFKA_CFG_LOG_FLUSH_INTERVAL_MS
- value: {{ .Values.logFlushIntervalMs | quote }}
- - name: KAFKA_CFG_LOG_RETENTION_BYTES
- value: {{ .Values.logRetentionBytes | replace "_" "" | quote }}
- - name: KAFKA_CFG_LOG_RETENTION_CHECK_INTERVALS_MS
- value: {{ .Values.logRetentionCheckIntervalMs | quote }}
- - name: KAFKA_CFG_LOG_RETENTION_HOURS
- value: {{ .Values.logRetentionHours | quote }}
- - name: KAFKA_CFG_MESSAGE_MAX_BYTES
- value: {{ .Values.maxMessageBytes | replace "_" "" | quote }}
- - name: KAFKA_CFG_LOG_SEGMENT_BYTES
- value: {{ .Values.logSegmentBytes | replace "_" "" | quote }}
- - name: KAFKA_CFG_LOG_DIRS
- value: {{ .Values.logsDirs | quote }}
- - name: KAFKA_CFG_DEFAULT_REPLICATION_FACTOR
- value: {{ .Values.defaultReplicationFactor | quote }}
- - name: KAFKA_CFG_OFFSETS_TOPIC_REPLICATION_FACTOR
- value: {{ .Values.offsetsTopicReplicationFactor | quote }}
- - name: KAFKA_CFG_TRANSACTION_STATE_LOG_REPLICATION_FACTOR
- value: {{ .Values.transactionStateLogReplicationFactor | quote }}
- - name: KAFKA_CFG_TRANSACTION_STATE_LOG_MIN_ISR
- value: {{ .Values.transactionStateLogMinIsr | quote }}
- - name: KAFKA_CFG_NUM_IO_THREADS
- value: {{ .Values.numIoThreads | quote }}
- - name: KAFKA_CFG_NUM_NETWORK_THREADS
- value: {{ .Values.numNetworkThreads | quote }}
- - name: KAFKA_CFG_NUM_PARTITIONS
- value: {{ .Values.numPartitions | quote }}
- - name: KAFKA_CFG_NUM_RECOVERY_THREADS_PER_DATA_DIR
- value: {{ .Values.numRecoveryThreadsPerDataDir | quote }}
- - name: KAFKA_CFG_SOCKET_RECEIVE_BUFFER_BYTES
- value: {{ .Values.socketReceiveBufferBytes | quote }}
- - name: KAFKA_CFG_SOCKET_REQUEST_MAX_BYTES
- value: {{ .Values.socketRequestMaxBytes | replace "_" "" | quote }}
- - name: KAFKA_CFG_SOCKET_SEND_BUFFER_BYTES
- value: {{ .Values.socketSendBufferBytes | quote }}
- - name: KAFKA_CFG_ZOOKEEPER_CONNECTION_TIMEOUT_MS
- value: {{ .Values.zookeeperConnectionTimeoutMs | quote }}
- {{- if .Values.extraEnvVars }}
- {{ include "common.tplvalues.render" ( dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
- {{- end }}
- ports:
- - name: kafka-client
- containerPort: 9092
- - name: kafka-internal
- containerPort: {{ $interBrokerPort }}
- {{- if .Values.externalAccess.enabled }}
- - name: kafka-external
- containerPort: 9094
- {{- end }}
- {{- if .Values.livenessProbe.enabled }}
- livenessProbe:
- tcpSocket:
- port: kafka-client
- initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
- timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
- failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
- periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
- successThreshold: {{ .Values.livenessProbe.successThreshold }}
- {{- else if .Values.customLivenessProbe }}
- livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }}
- {{- end }}
- {{- if .Values.readinessProbe.enabled }}
- readinessProbe:
- tcpSocket:
- port: kafka-client
- initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
- timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
- failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
- periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
- successThreshold: {{ .Values.readinessProbe.successThreshold }}
- {{- else if .Values.customReadinessProbe }}
- readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }}
- {{- end }}
- {{- if .Values.resources }}
- resources: {{- toYaml .Values.resources | nindent 12 }}
- {{- end }}
- volumeMounts:
- - name: data
- mountPath: {{ .Values.persistence.mountPath }}
- - name: logs
- mountPath: {{ .Values.logPersistence.mountPath }}
- {{- if or .Values.config .Values.existingConfigmap }}
- - name: kafka-config
- mountPath: {{ .Values.persistence.mountPath }}/config/server.properties
- subPath: server.properties
- {{- end }}
- {{- if or .Values.log4j .Values.existingLog4jConfigMap }}
- - name: log4j-config
- mountPath: {{ .Values.persistence.mountPath }}/config/log4j.properties
- subPath: log4j.properties
- {{- end }}
- - name: scripts
- mountPath: /scripts/setup.sh
- subPath: setup.sh
- {{- if and .Values.externalAccess.enabled .Values.externalAccess.autoDiscovery.enabled }}
- - name: shared
- mountPath: /shared
- {{- end }}
- {{- if (include "kafka.tlsEncryption" .) }}
- - name: kafka-certificates
- mountPath: /certs
- readOnly: true
- {{- if (coalesce .Values.auth.tls.jksTruststoreSecret .Values.auth.jksTruststoreSecret) }}
- - name: kafka-truststore
- mountPath: /truststore
- readOnly: true
- {{- end }}
- {{- end }}
- {{- if .Values.extraVolumeMounts }}
- {{- toYaml .Values.extraVolumeMounts | nindent 12 }}
- {{- end }}
- {{- if .Values.metrics.jmx.enabled }}
- - name: jmx-exporter
- image: {{ template "kafka.metrics.jmx.image" . }}
- imagePullPolicy: {{ .Values.metrics.jmx.image.pullPolicy | quote }}
- command:
- - java
- - -XX:+UnlockExperimentalVMOptions
- - -XX:+UseCGroupMemoryLimitForHeap
- - -XX:MaxRAMFraction=1
- - -XshowSettings:vm
- - -jar
- - jmx_prometheus_httpserver.jar
- - "5556"
- - /etc/jmx-kafka/jmx-kafka-prometheus.yml
- ports:
- - name: metrics
- containerPort: 5556
- {{- if .Values.metrics.jmx.resources }}
- resources: {{- toYaml .Values.metrics.jmx.resources | nindent 12 }}
- {{- end }}
- volumeMounts:
- - name: jmx-config
- mountPath: /etc/jmx-kafka
- {{- end }}
- {{- if .Values.sidecars }}
- {{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 8 }}
- {{- end }}
- volumes:
- {{- if or .Values.config .Values.existingConfigmap }}
- - name: kafka-config
- configMap:
- name: {{ include "kafka.configmapName" . }}
- {{- end }}
- {{- if or .Values.log4j .Values.existingLog4jConfigMap }}
- - name: log4j-config
- configMap:
- name: {{ include "kafka.log4j.configMapName" . }}
- {{ end }}
- - name: scripts
- configMap:
- name: {{ include "kafka.fullname" . }}-scripts
- defaultMode: 0755
- {{- if and .Values.externalAccess.enabled .Values.externalAccess.autoDiscovery.enabled }}
- - name: shared
- emptyDir: {}
- {{- end }}
- {{- if .Values.metrics.jmx.enabled }}
- - name: jmx-config
- configMap:
- name: {{ include "kafka.metrics.jmx.configmapName" . }}
- {{- end }}
- {{- if (include "kafka.tlsEncryption" .) }}
- - name: kafka-certificates
- secret:
- secretName: {{ include "kafka.tlsSecretName" . }}
- defaultMode: 256
- {{- if (coalesce .Values.auth.tls.jksTruststoreSecret .Values.auth.jksTruststoreSecret) }}
- - name: kafka-truststore
- secret:
- secretName: {{ coalesce .Values.auth.tls.jksTruststoreSecret .Values.auth.jksTruststoreSecret }}
- defaultMode: 256
- {{- end }}
- {{- end }}
- {{- if .Values.extraVolumes }}
- {{- toYaml .Values.extraVolumes | nindent 8 }}
- {{- end }}
- {{- if not .Values.persistence.enabled }}
- - name: data
- emptyDir: {}
- {{- else if .Values.persistence.existingClaim }}
- - name: data
- persistentVolumeClaim:
- claimName: {{ printf "%s" (tpl .Values.persistence.existingClaim .) }}
- {{- end }}
- {{- if not .Values.logPersistence.enabled }}
- - name: logs
- emptyDir: {}
- {{- else if .Values.logPersistence.existingClaim }}
- - name: logs
- persistentVolumeClaim:
- claimName: {{ printf "%s" (tpl .Values.logPersistence.existingClaim .) }}
- {{- end }}
- {{- if or (and .Values.persistence.enabled (not .Values.persistence.existingClaim)) (and .Values.logPersistence.enabled (not .Values.logPersistence.existingClaim)) }}
- volumeClaimTemplates:
- {{- end }}
- {{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }}
- - metadata:
- name: data
- {{- if .Values.persistence.annotations }}
- annotations: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.annotations "context" $) | nindent 10 }}
- {{- end }}
- spec:
- accessModes:
- {{- range .Values.persistence.accessModes }}
- - {{ . | quote }}
- {{- end }}
- resources:
- requests:
- storage: {{ .Values.persistence.size | quote }}
- {{ include "kafka.storageClass" . | nindent 8 }}
- {{- if .Values.persistence.selector }}
- selector: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.selector "context" $) | nindent 10 }}
- {{- end -}}
- {{- end }}
- {{- if and .Values.logPersistence.enabled (not .Values.logPersistence.existingClaim) }}
- - metadata:
- name: logs
- {{- if .Values.logPersistence.annotations }}
- annotations: {{- include "common.tplvalues.render" (dict "value" .Values.logPersistence.annotations "context" $) | nindent 10 }}
- {{- end }}
- spec:
- accessModes:
- {{- range .Values.logPersistence.accessModes }}
- - {{ . | quote }}
- {{- end }}
- resources:
- requests:
- storage: {{ .Values.logPersistence.size | quote }}
- {{ include "kafka.storageClass" . | nindent 8 }}
- {{- if .Values.logPersistence.selector }}
- selector: {{- include "common.tplvalues.render" (dict "value" .Values.logPersistence.selector "context" $) | nindent 10 }}
- {{- end -}}
- {{- end }}
- {{- end }}
|