{{- if (or (and (ne (.Values.server.enabled | toString) "-") .Values.server.enabled) (and (eq (.Values.server.enabled | toString) "-") .Values.global.enabled)) }} # Headless service for Consul server DNS entries. This service should only # point to Consul servers. For access to an agent, one should assume that # the agent is installed locally on the node and the NODE_IP should be used. # If the node can't run a Consul agent, then this service can be used to # communicate directly to a server agent. apiVersion: v1 kind: Service metadata: name: {{ template "consul.fullname" . }}-server namespace: {{ .Release.Namespace }} labels: app: {{ template "consul.name" . }} chart: {{ template "consul.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} component: server annotations: {{- if .Values.server.service.annotations }} {{ tpl .Values.server.service.annotations . | nindent 4 | trim }} {{- end }} spec: clusterIP: None # We want the servers to become available even if they're not ready # since this DNS is also used for join operations. publishNotReadyAddresses: true ports: {{- if (or (not .Values.global.tls.enabled) (not .Values.global.tls.httpsOnly)) }} - name: http port: 8500 targetPort: 8500 {{- end }} {{- if .Values.global.tls.enabled }} - name: https port: 8501 targetPort: 8501 {{- end }} - name: grpc port: 8502 targetPort: 8502 - name: serflan-tcp protocol: "TCP" port: 8301 targetPort: 8301 - name: serflan-udp protocol: "UDP" port: 8301 targetPort: 8301 - name: serfwan-tcp protocol: "TCP" port: 8302 targetPort: 8302 - name: serfwan-udp protocol: "UDP" port: 8302 targetPort: 8302 - name: server port: 8300 targetPort: 8300 - name: dns-tcp protocol: "TCP" port: 8600 targetPort: dns-tcp - name: dns-udp protocol: "UDP" port: 8600 targetPort: dns-udp selector: app: {{ template "consul.name" . }} release: "{{ .Release.Name }}" component: server {{- end }}