{{/* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */}} {{- if and .Values.manifests.monitoring.prometheus.deployment .Values.monitoring.prometheus.enabled }} {{- $envAll := . }} {{- $kafkaExporterUserSecret := .Values.secrets.kafka_exporter.user }} {{- $serviceAccountName := "prometheus-kafka-exporter" }} {{ tuple $envAll "kafka_exporter" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: apps/v1 kind: Deployment metadata: name: prometheus-kafka-exporter labels: {{ tuple $envAll "kafka-exporter" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} spec: replicas: {{ .Values.pod.replicas.kafka_exporter }} selector: matchLabels: {{ tuple $envAll "kafka-exporter" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} {{ tuple $envAll | include "helm-toolkit.snippets.kubernetes_upgrades_deployment" | indent 2 }} template: metadata: labels: {{ tuple $envAll "kafka-exporter" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} spec: {{ dict "envAll" $envAll "application" "kafka_exporter" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} nodeSelector: {{ .Values.labels.kafka.node_selector_key }}: {{ .Values.labels.kafka.node_selector_value | quote }} terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.kafka_exporter.timeout | default "30" }} initContainers: {{ tuple $envAll "kafka_exporter" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} containers: - name: kafka-exporter {{ tuple $envAll "kafka_exporter" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.kafka_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ dict "envAll" $envAll "application" "kafka_exporter" "container" "kafka_exporter" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: - /tmp/kafka-exporter.sh - start lifecycle: preStop: exec: command: - /tmp/kafka-exporter.sh - stop env: - name: KAFKA_BROKERS value: {{ tuple "kafka" "internal" "broker" . | include "helm-toolkit.endpoints.host_and_port_endpoint_uri_lookup" | quote }} - name: KAFKA_EXPORTER_USERNAME valueFrom: secretKeyRef: name: {{ $kafkaExporterUserSecret }} key: KAFKA_EXPORTER_USERNAME - name: KAFKA_EXPORTER_PASSWORD valueFrom: secretKeyRef: name: {{ $kafkaExporterUserSecret }} key: KAFKA_EXPORTER_PASSWORD ports: - name: exporter containerPort: {{ tuple "kafka_exporter" "internal" "exporter" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} readinessProbe: tcpSocket: port: {{ tuple "kafka_exporter" "internal" "exporter" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} initialDelaySeconds: 20 periodSeconds: 10 volumeMounts: - name: pod-tmp mountPath: /tmp - name: kafka-exporter-bin mountPath: /tmp/kafka-exporter.sh subPath: kafka-exporter.sh readOnly: true volumes: - name: pod-tmp emptyDir: {} - name: kafka-exporter-bin configMap: name: kafka-exporter-bin defaultMode: 0555 {{- end }}