dashboard/deployment/helmchart/templates/backend-service.yaml

43 lines
2.1 KiB
YAML
Raw Permalink Normal View History

2021-10-04 13:53:13 +02:00
apiVersion: v1
kind: Service
metadata:
name: {{ include "backend.serviceName" . }}
2021-10-04 13:53:13 +02:00
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.backend.service.annotations .Values.commonAnnotations}}
2021-10-04 13:53:13 +02:00
annotations:
{{- if .Values.backend.service.annotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.backend.service.annotations "context" $) | nindent 4 }}
2021-10-04 13:53:13 +02:00
{{- end }}
{{- if .Values.commonAnnotations }}
{{- include "common.tplvalues.render" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }}
{{- end }}
{{- end }}
spec:
type: {{ .Values.backend.service.type }}
{{- if (or (eq .Values.backend.service.type "LoadBalancer") (eq .Values.backend.service.type "NodePort")) }}
externalTrafficPolicy: {{ .Values.backend.service.externalTrafficPolicy | quote }}
2021-10-04 13:53:13 +02:00
{{- end }}
{{- if (and (eq .Values.backend.service.type "LoadBalancer") (not (empty .Values.backend.service.loadBalancerIP))) }}
loadBalancerIP: {{ .Values.backend.service.loadBalancerIP }}
2021-10-04 13:53:13 +02:00
{{- end }}
{{- if (and (eq .Values.backend.service.type "LoadBalancer") .Values.backend.service.loadBalancerSourceRanges) }}
2021-10-04 13:53:13 +02:00
loadBalancerSourceRanges:
{{ toYaml .Values.backend.service.loadBalancerSourceRanges | nindent 4 }}
2021-10-04 13:53:13 +02:00
{{- end }}
ports:
- name: http
port: {{ .Values.backend.service.port }}
2021-10-04 13:53:13 +02:00
targetPort: backend-http
{{- if (and (or (eq .Values.backend.service.type "NodePort") (eq .Values.backend.service.type "LoadBalancer")) (not (empty .Values.backend.service.nodePorts.http))) }}
nodePort: {{ .Values.backend.service.nodePorts.http }}
{{- else if eq .Values.backend.service.type "ClusterIP" }}
2021-10-04 13:53:13 +02:00
nodePort: null
{{- end }}
{{- if .Values.backend.service.extraPorts }}
{{- include "common.tplvalues.render" (dict "value" .Values.backend.service.extraPorts "context" $) | nindent 4 }}
2021-10-04 13:53:13 +02:00
{{- end }}
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}