{{- if and .Values.exporter.enabled .Values.exporter.service }} {{- $svcValues := .Values.exporter.service }} {{- $componet := "kafka-exporter" }} apiVersion: v1 kind: Service metadata: name: {{ include "kafka.exporter.fullname" . }} labels: {{- include "kafka.labels" . | nindent 4 }} {{- with $svcValues.labels }} {{- toYaml . | nindent 4 }} {{- end }} {{- with $svcValues.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: ports: - name: {{ $svcValues.portName | default "http-metrics" }} port: {{ $svcValues.port | default 9308 }} targetPort: {{ .Values.exporter.containerPortName | default "http-metrics" }} protocol: TCP selector: {{- include "kafka.selectorLabels" . | nindent 4 }} component: {{ $componet | quote }} {{- end }}