64 lines
2.7 KiB
YAML
64 lines
2.7 KiB
YAML
{{- $serverEnabled := (or (and (ne (.Values.server.enabled | toString) "-") .Values.server.enabled) (and (eq (.Values.server.enabled | toString) "-") .Values.global.enabled)) -}}
|
|
{{- $serverExposeServiceEnabled := (or (and (ne (.Values.server.exposeService.enabled | toString) "-") .Values.server.exposeService.enabled) (and (eq (.Values.server.exposeService.enabled | toString) "-") .Values.global.adminPartitions.enabled)) -}}
|
|
{{- if (and $serverEnabled $serverExposeServiceEnabled) }}
|
|
|
|
# Service with an external IP to reach Consul servers.
|
|
# Used for exposing gRPC port for peering and ports for client partitions to discover servers.
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ template "consul.fullname" . }}-expose-servers
|
|
namespace: {{ .Release.Namespace }}
|
|
labels:
|
|
app: {{ template "consul.name" . }}
|
|
chart: {{ template "consul.chart" . }}
|
|
heritage: {{ .Release.Service }}
|
|
release: {{ .Release.Name }}
|
|
component: server
|
|
annotations:
|
|
{{- if .Values.server.exposeService.annotations }}
|
|
{{ tpl .Values.server.exposeService.annotations . | nindent 4 | trim }}
|
|
{{- end }}
|
|
spec:
|
|
type: "{{ .Values.server.exposeService.type }}"
|
|
ports:
|
|
{{- if (or (not .Values.global.tls.enabled) (not .Values.global.tls.httpsOnly)) }}
|
|
- name: http
|
|
port: 8500
|
|
targetPort: 8500
|
|
{{ if (and (eq .Values.server.exposeService.type "NodePort") .Values.server.exposeService.nodePort.http) }}
|
|
nodePort: {{ .Values.server.exposeService.nodePort.http }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.global.tls.enabled }}
|
|
- name: https
|
|
port: 8501
|
|
targetPort: 8501
|
|
{{ if (and (eq .Values.server.exposeService.type "NodePort") .Values.server.exposeService.nodePort.https) }}
|
|
nodePort: {{ .Values.server.exposeService.nodePort.https }}
|
|
{{- end }}
|
|
{{- end }}
|
|
- name: serflan
|
|
port: 8301
|
|
targetPort: 8301
|
|
{{ if (and (eq .Values.server.exposeService.type "NodePort") .Values.server.exposeService.nodePort.serf) }}
|
|
nodePort: {{ .Values.server.exposeService.nodePort.serf }}
|
|
{{- end }}
|
|
- name: rpc
|
|
port: 8300
|
|
targetPort: 8300
|
|
{{ if (and (eq .Values.server.exposeService.type "NodePort") .Values.server.exposeService.nodePort.rpc) }}
|
|
nodePort: {{ .Values.server.exposeService.nodePort.rpc }}
|
|
{{- end }}
|
|
- name: grpc
|
|
port: 8502
|
|
targetPort: 8502
|
|
{{ if (and (eq .Values.server.exposeService.type "NodePort") .Values.server.exposeService.nodePort.grpc) }}
|
|
nodePort: {{ .Values.server.exposeService.nodePort.grpc }}
|
|
{{- end }}
|
|
selector:
|
|
app: {{ template "consul.name" . }}
|
|
release: "{{ .Release.Name }}"
|
|
component: server
|
|
{{- end }}
|