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