dashboard/deployment/helmchart/templates/backend-service.yaml
2021-10-04 13:53:13 +02:00

42 lines
2.2 KiB
YAML

apiVersion: v1
kind: Service
metadata:
name: {{ include "adminBackend.serviceName" . }}
labels: {{- include "common.labels.standard" . | nindent 4 }}
{{- if .Values.commonLabels }}
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- end }}
{{- if or .Values.adminBackend.service.annotations .Values.commonAnnotations}}
annotations:
{{- if .Values.adminBackend.service.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.adminBackend.service.annotations "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.adminBackend.service.type }}
{{- if (or (eq .Values.adminBackend.service.type "LoadBalancer") (eq .Values.adminBackend.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.adminBackend.service.externalTrafficPolicy | quote }}
{{- end }}
{{- if (and (eq .Values.adminBackend.service.type "LoadBalancer") (not (empty .Values.adminBackend.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.adminBackend.service.loadBalancerIP }}
{{- end }}
{{- if (and (eq .Values.adminBackend.service.type "LoadBalancer") .Values.adminBackend.service.loadBalancerSourceRanges) }}
loadBalancerSourceRanges:
{{ toYaml .Values.adminBackend.service.loadBalancerSourceRanges | nindent 4 }}
{{- end }}
ports:
- name: http
port: {{ .Values.adminBackend.service.port }}
targetPort: backend-http
{{- if (and (or (eq .Values.adminBackend.service.type "NodePort") (eq .Values.adminBackend.service.type "LoadBalancer")) (not (empty .Values.adminBackend.service.nodePorts.http))) }}
nodePort: {{ .Values.adminBackend.service.nodePorts.http }}
{{- else if eq .Values.adminBackend.service.type "ClusterIP" }}
nodePort: null
{{- end }}
{{- if .Values.adminBackend.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.adminBackend.service.extraPorts "context" $) | nindent 4 }}
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}