-
Notifications
You must be signed in to change notification settings - Fork 155
/
Copy pathservice.yaml
53 lines (53 loc) · 1.93 KB
/
service.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
{{- $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 }}
{{ if and (semverCompare ">=1.20-0" .Capabilities.KubeVersion.GitVersion) .Values.service.appprotocol }}appProtocol: {{ .Values.service.appprotocol }}{{ 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
{{ if and (semverCompare ">=1.20-0" .Capabilities.KubeVersion.GitVersion) .Values.service.appprotocol }}appProtocol: {{ .Values.service.appprotocol }}{{ end }}
selector:
{{- $selectorLabels | nindent 4 }}
{{- end -}}