25 lines
1019 B
YAML
25 lines
1019 B
YAML
|
apiVersion: v1
|
||
|
kind: Service
|
||
|
metadata:
|
||
|
{{- include "nats.metadataNamespace" $ | nindent 2 }}
|
||
|
name: {{ .Values.headlessService.name }}
|
||
|
labels:
|
||
|
{{- include "nats.labels" $ | nindent 4 }}
|
||
|
spec:
|
||
|
selector:
|
||
|
{{- include "nats.selectorLabels" $ | nindent 4 }}
|
||
|
clusterIP: None
|
||
|
publishNotReadyAddresses: true
|
||
|
ports:
|
||
|
{{- range $protocol := list "nats" "leafnodes" "websocket" "mqtt" "cluster" "gateway" "monitor" "profiling" }}
|
||
|
{{- $configProtocol := get $.Values.config $protocol }}
|
||
|
{{- if or (eq $protocol "nats") $configProtocol.enabled }}
|
||
|
{{- $tlsEnabled := false }}
|
||
|
{{- if hasKey $configProtocol "tls" }}
|
||
|
{{- $tlsEnabled = $configProtocol.tls.enabled }}
|
||
|
{{- end }}
|
||
|
{{- $appProtocol := or (eq $protocol "websocket") (eq $protocol "monitor") | ternary ($tlsEnabled | ternary "https" "http") ($tlsEnabled | ternary "tls" "tcp") }}
|
||
|
- {{ dict "name" $protocol "port" $configProtocol.port "targetPort" $protocol "appProtocol" $appProtocol | toYaml | nindent 4 }}
|
||
|
{{- end }}
|
||
|
{{- end }}
|