apiVersion: v1 kind: Service metadata: name: {{ include "rabbitmq.fullname" . }} namespace: {{ .Release.Namespace | quote }} labels: {{- include "common.labels.standard" . | nindent 4 }} {{- if .Values.service.labels }} {{- include "common.tplvalues.render" (dict "value" .Values.service.labels "context" $) | nindent 4 }} {{- end }} {{- if or (.Values.service.annotations) (.Values.commonAnnotations) }} annotations: {{- if .Values.commonAnnotations}} {{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }} {{- end -}} {{- if .Values.service.annotations}} {{- include "common.tplvalues.render" (dict "value" .Values.service.annotations "context" $) | nindent 4 }} {{- end -}} {{- end }} spec: type: {{ .Values.service.type }} {{- if eq .Values.service.type "LoadBalancer" }} {{- if not (empty .Values.service.loadBalancerIP) }} loadBalancerIP: {{ .Values.service.loadBalancerIP }} {{- end }} {{- if .Values.service.loadBalancerSourceRanges }} loadBalancerSourceRanges: {{- toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }} {{- end }} {{- end }} {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} {{- end }} {{- if .Values.service.externalIPs }} externalIPs: {{- toYaml .Values.service.externalIPs | nindent 4 }} {{- end }} ports: {{- if or (.Values.service.portEnabled) (not .Values.auth.tls.enabled) }} - name: {{ .Values.service.portName }} port: {{ .Values.service.port }} targetPort: amqp {{- if (eq .Values.service.type "ClusterIP") }} nodePort: null {{- else if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePort)) }} nodePort: {{ .Values.service.nodePort }} {{- end }} {{- end }} {{- if .Values.auth.tls.enabled }} - name: {{ .Values.service.tlsPortName }} port: {{ .Values.service.tlsPort }} targetPort: amqp-ssl {{- if (eq .Values.service.type "ClusterIP") }} nodePort: null {{- else if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.tlsNodePort)) }} nodePort: {{ .Values.service.tlsNodePort }} {{- end }} {{- end }} - name: {{ .Values.service.epmdPortName }} port: 4369 targetPort: epmd {{- if (eq .Values.service.type "ClusterIP") }} nodePort: null {{- else if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.epmdNodePort)) }} nodePort: {{ .Values.service.epmdNodePort }} {{- end }} - name: {{ .Values.service.distPortName }} port: {{ .Values.service.distPort }} targetPort: dist {{- if eq .Values.service.type "ClusterIP" }} nodePort: null {{- else if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.distNodePort)) }} nodePort: {{ .Values.service.distNodePort }} {{- end }} {{- if .Values.service.managerPortEnabled }} - name: {{ .Values.service.managerPortName }} port: {{ .Values.service.managerPort }} targetPort: stats {{- if eq .Values.service.type "ClusterIP" }} nodePort: null {{- else if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.stompNodePort)) }} nodePort: {{ .Values.service.stompNodePort }} {{- end }} {{- end }} {{- if .Values.service.stompPortEnabled }} - name: {{ .Values.service.stompPortName }} port: {{ .Values.service.stompPort }} targetPort: stats {{- if eq .Values.service.type "ClusterIP" }} nodePort: null {{- else if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.managerNodePort)) }} nodePort: {{ .Values.service.managerNodePort }} {{- end }} {{- end }} {{- if .Values.metrics.enabled }} - name: {{ .Values.service.metricsPortName }} port: {{ .Values.service.metricsPort }} targetPort: metrics {{- if eq .Values.service.type "ClusterIP" }} nodePort: null {{- else if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.metricsNodePort)) }} nodePort: {{ .Values.service.metricsNodePort }} {{- end }} {{- end }} {{- if .Values.service.extraPorts }} {{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }} {{- end }} selector: {{ include "common.labels.matchLabels" . | nindent 4 }}