# helm_charts_service-brokers.yaml
apiVersion: v1
kind: Service
metadata:
  name: {{ include "kafka.fullname" . }}
  labels:
  {{- include "kafka.broker.labels" . | nindent 4 }}
spec:
  ports:
  - name: broker
    port: 9092
    targetPort: kafka
{{- if and .Values.prometheus.jmx.enabled .Values.prometheus.operator.enabled }}
  - name: jmx-exporter
    protocol: TCP
    port: {{ .Values.jmx.port }}
    targetPort: prometheus
{{- end }}
  selector:
  {{- include "kafka.broker.matchLabels" . | nindent 4 }}
---
{{- if and .Values.prometheus.kafka.enabled .Values.prometheus.operator.enabled }}
apiVersion: v1
kind: Service
metadata:
  name: {{ include "kafka.fullname" . }}-exporter
  labels:
  {{- include "kafka.monitor.labels" . | nindent 4 }}
spec:
  ports:
  - name: kafka-exporter
    protocol: TCP
    port: {{ .Values.prometheus.kafka.port }}
    targetPort: {{ .Values.prometheus.kafka.port }}
  selector:
  {{- include "kafka.monitor.matchLabels" . | nindent 4 }}
{{- end }}