{{- $application_name := .Values.application.name }} {{- $svc_name := tpl .Values.templates.service . }} {{- $dc_name := tpl .Values.templates.deployment . }} --- apiVersion: v1 kind: Service metadata: annotations: {{- if eq .Values.kind "StatefulSet" }} description: The broker's headless, non load balanced service {{- else }} description: AMQ Broker Service {{- end }} labels: application: {{ $application_name }} app: {{ $application_name }} name: {{ $svc_name }} spec: {{- if eq .Values.kind "StatefulSet" }} clusterIP: None {{- end }} type: ClusterIP publishNotReadyAddresses: true ports: {{- range .Values.service.acceptors }} - port: {{ .port }} name: {{ .name }} protocol: {{ .protocol }} targetPort: {{ .port }} {{- end }} {{- range .Values.service.console }} - port: {{ .port }} name: {{ .name }} protocol: {{ .protocol }} targetPort: {{ .port }} {{- end }} selector: deployment: {{ $dc_name }} {{- if .Values.clustered }} --- apiVersion: v1 kind: Service metadata: annotations: description: The JGroups ping port for clustering. service.alpha.kubernetes.io/tolerate-unready-endpoints: 'true' labels: application: {{ $application_name }} name: {{ tpl .Values.ping_service.name . }} spec: clusterIP: None ports: - targetPort: {{ .Values.ping_service.port }} port: {{ .Values.ping_service.port }} selector: deployment: {{ $dc_name }} {{- end }}