{{- if (and (or (and (ne (.Values.server.enabled | toString) "-") .Values.server.enabled) (and (eq (.Values.server.enabled | toString) "-") .Values.global.enabled)) (or (and (ne (.Values.ui.enabled | toString) "-") .Values.ui.enabled) (and (eq (.Values.ui.enabled | toString) "-") .Values.global.enabled)) (or (and (ne (.Values.ui.service.enabled | toString) "-") .Values.ui.service.enabled) (and (eq (.Values.ui.service.enabled | toString) "-") .Values.global.enabled))) }} # UI Service for Consul Server apiVersion: v1 kind: Service metadata: name: {{ template "consul.fullname" . }}-ui namespace: {{ .Release.Namespace }} labels: app: {{ template "consul.name" . }} chart: {{ template "consul.chart" . }} heritage: {{ .Release.Service }} release: {{ .Release.Name }} component: ui {{- if .Values.ui.service.annotations }} annotations: {{ tpl .Values.ui.service.annotations . | nindent 4 | trim }} {{- end }} spec: selector: app: {{ template "consul.name" . }} release: "{{ .Release.Name }}" component: server ports: {{- if (or (not .Values.global.tls.enabled) (not .Values.global.tls.httpsOnly)) }} - name: http port: {{ .Values.ui.service.port.http }} targetPort: 8500 {{- if .Values.ui.service.type }}{{ if (and (eq .Values.ui.service.type "NodePort") .Values.ui.service.nodePort.http) }} nodePort: {{ .Values.ui.service.nodePort.http }} {{- end }}{{ end }} {{- end }} {{- if .Values.global.tls.enabled }} - name: https port: {{ .Values.ui.service.port.https }} targetPort: 8501 {{- if .Values.ui.service.type }}{{ if (and (eq .Values.ui.service.type "NodePort") .Values.ui.service.nodePort.https) }} nodePort: {{ .Values.ui.service.nodePort.https }} {{- end }}{{ end }} {{- end }} {{- if .Values.ui.service.type }} type: {{ .Values.ui.service.type }} {{- end }} {{- if .Values.ui.service.additionalSpec }} {{ tpl .Values.ui.service.additionalSpec . | nindent 2 | trim }} {{- end }} {{- end }}