44 lines
2.2 KiB
YAML
44 lines
2.2 KiB
YAML
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ include "postgresql.primary.fullname" . }}
|
|
namespace: {{ .Release.Namespace | quote }}
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
{{- if .Values.commonLabels }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
app.kubernetes.io/component: primary
|
|
annotations:
|
|
{{- if .Values.commonAnnotations }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if .Values.primary.service.annotations }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.primary.service.annotations "context" $) | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
type: {{ .Values.primary.service.type }}
|
|
{{- if and .Values.primary.service.loadBalancerIP (eq .Values.primary.service.type "LoadBalancer") }}
|
|
loadBalancerIP: {{ .Values.primary.service.loadBalancerIP }}
|
|
externalTrafficPolicy: {{ .Values.primary.service.externalTrafficPolicy | quote }}
|
|
{{- end }}
|
|
{{- if and (eq .Values.primary.service.type "LoadBalancer") .Values.primary.service.loadBalancerSourceRanges }}
|
|
loadBalancerSourceRanges: {{- include "common.tplvalues.render" (dict "value" .Values.primary.service.loadBalancerSourceRanges "context" $) | nindent 4 }}
|
|
{{- end }}
|
|
{{- if and (eq .Values.primary.service.type "ClusterIP") .Values.primary.service.clusterIP }}
|
|
clusterIP: {{ .Values.primary.service.clusterIP }}
|
|
{{- end }}
|
|
ports:
|
|
- name: tcp-postgresql
|
|
port: {{ template "postgresql.service.port" . }}
|
|
targetPort: tcp-postgresql
|
|
{{- if and (or (eq .Values.primary.service.type "NodePort") (eq .Values.primary.service.type "LoadBalancer")) (not (empty .Values.primary.service.nodePorts.postgresql)) }}
|
|
nodePort: {{ .Values.primary.service.nodePorts.postgresql }}
|
|
{{- else if eq .Values.primary.service.type "ClusterIP" }}
|
|
nodePort: null
|
|
{{- end }}
|
|
{{- if .Values.primary.service.extraPorts }}
|
|
{{- include "common.tplvalues.render" (dict "value" .Values.primary.service.extraPorts "context" $) | nindent 4 }}
|
|
{{- end }}
|
|
selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
|
|
app.kubernetes.io/component: primary
|