docker-postfix/helm/mail/templates/service.yaml
2023-12-29 08:51:20 +01:00

51 lines
No EOL
1.6 KiB
YAML

{{- $chart := "mail" -}}
{{- $fullName := include (print $chart ".fullname") . -}}
{{- $labels := include (print $chart ".labels") . -}}
{{- $selectorLabels := include (print $chart ".selectorLabels") . -}}
apiVersion: v1
kind: Service
metadata:
name: {{ $fullName | quote }}
labels:
{{- $labels | nindent 4 }}
{{- with .Values.service.labels }}{{ toYaml . | nindent 4 }}{{ end }}
type: standard
annotations:
{{- with .Values.service.annotations }}{{ toYaml . | nindent 4 }}{{ end }}
spec:
type: {{ .Values.service.type }}
{{- with .Values.service.spec }}{{ toYaml . | nindent 2 }}{{ end }}
ports:
- port: {{ .Values.service.port }}
targetPort: smtp
protocol: TCP
name: smtp
{{ if eq .Values.service.type "NodePort" }}nodePort: {{ .Values.service.nodePort }}{{ end }}
selector:
{{- $selectorLabels | nindent 4 }}
{{- if .Values.headlessService.enabled }}
---
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#limitations
# StatefulSets now require a headless service
apiVersion: v1
kind: Service
metadata:
name: {{ print $fullName "-headless" | quote }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- $labels | nindent 4 }}
{{- with .Values.headlessService.labels }}{{ toYaml . | nindent 4 }}{{ end }}
type: headless
annotations:
{{- with .Values.headlessService.annotations }}{{ toYaml . | nindent 4 }}{{ end }}
spec:
type: ClusterIP
clusterIP: None
ports:
- port: {{ .Values.service.port }}
targetPort: smtp
protocol: TCP
name: smtp
selector:
{{- $selectorLabels | nindent 4 }}
{{- end -}}