46 lines
2.1 KiB
YAML
46 lines
2.1 KiB
YAML
{{- $serviceAnnotations := coalesce .Values.primary.service.annotations .Values.service.annotations -}}
|
|
{{- $serviceType := coalesce .Values.primary.service.type .Values.service.type -}}
|
|
{{- $serviceLoadBalancerIP := coalesce .Values.primary.service.loadBalancerIP .Values.service.loadBalancerIP -}}
|
|
{{- $serviceLoadBalancerSourceRanges := coalesce .Values.primary.service.loadBalancerSourceRanges .Values.service.loadBalancerSourceRanges -}}
|
|
{{- $serviceClusterIP := coalesce .Values.primary.service.clusterIP .Values.service.clusterIP -}}
|
|
{{- $serviceNodePort := coalesce .Values.primary.service.nodePort .Values.service.nodePort -}}
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ template "common.names.fullname" . }}
|
|
labels:
|
|
{{- include "common.labels.standard" . | nindent 4 }}
|
|
{{- if .Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
annotations:
|
|
{{- if .Values.commonAnnotations }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if $serviceAnnotations }}
|
|
{{- include "common.tplvalues.render" (dict "value" $serviceAnnotations "context" $) | nindent 4 }}
|
|
{{- end }}
|
|
namespace: {{ .Release.Namespace }}
|
|
spec:
|
|
type: {{ $serviceType }}
|
|
{{- if and $serviceLoadBalancerIP (eq $serviceType "LoadBalancer") }}
|
|
loadBalancerIP: {{ $serviceLoadBalancerIP }}
|
|
externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }}
|
|
{{- end }}
|
|
{{- if and (eq $serviceType "LoadBalancer") $serviceLoadBalancerSourceRanges }}
|
|
loadBalancerSourceRanges: {{- include "common.tplvalues.render" (dict "value" $serviceLoadBalancerSourceRanges "context" $) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if and (eq $serviceType "ClusterIP") $serviceClusterIP }}
|
|
clusterIP: {{ $serviceClusterIP }}
|
|
{{- end }}
|
|
ports:
|
|
- name: tcp-postgresql
|
|
port: {{ template "postgresql.servicePort" . }}
|
|
targetPort: tcp-postgresql
|
|
{{- if $serviceNodePort }}
|
|
nodePort: {{ $serviceNodePort }}
|
|
{{- end }}
|
|
selector:
|
|
{{- include "common.labels.matchLabels" . | nindent 4 }}
|
|
role: primary
|