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

42 lines
2.1 KiB
YAML

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