-
Notifications
You must be signed in to change notification settings - Fork 569
Expand file tree
/
Copy pathservice.yaml
More file actions
124 lines (124 loc) · 3.38 KB
/
service.yaml
File metadata and controls
124 lines (124 loc) · 3.38 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{{- if .Values.service.enabled }}
apiVersion: v1
kind: Service
metadata:
{{- if .Values.service.name }}
name: {{ .Values.service.name}}
{{- else }}
name: {{ template ".servicename" . }}
{{- end }}
labels:
appId: {{ $.Values.app | quote }}
envId: {{ $.Values.env | quote }}
app: {{ template ".Chart.Name .name" $ }}
chart: {{ template ".Chart.Name .chart" $ }}
release: {{ $.Release.Name }}
{{- if .Values.appLabels }}
{{ toYaml .Values.appLabels | indent 4 }}
{{- end }}
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
spec:
type: {{ .Values.service.type | default "ClusterIP" }}
{{- with .Values.service.extraSpec }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- if (eq .Values.service.type "LoadBalancer") }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }}
{{- if .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges:
{{- range .Values.service.loadBalancerSourceRanges }}
- {{ . }}
{{- end }}
{{- end }}
{{- end }}
ports:
{{- range .Values.ContainerPort }}
{{- if .servicePort }}
- port: {{ .servicePort }}
{{- else }}
- port: {{ .port }}
{{- end }}
{{- if .targetPort }}
targetPort: {{ .targetPort }}
{{- else }}
targetPort: {{ .name }}
{{- end }}
{{- if (and (eq $.Values.service.type "NodePort") .nodePort )}}
nodePort: {{ .nodePort }}
{{- end }}
protocol: TCP
name: {{ .name }}
{{- end }}
{{- if $.Values.appMetrics }}
- port: 9901
name: envoy-admin
{{- end }}
selector:
app: {{ template ".Chart.Name .name" . }}
{{- end }}
---
{{- if or .Values.service.enabled .Values.serviceheadless.enabled }}
apiVersion: v1
kind: Service
metadata:
{{- if .Values.serviceheadless.enabled }}
{{- if .Values.serviceheadless.name }}
name: {{ .Values.serviceheadless.name }}
{{- else }}
name: {{ template ".servicename" . }}-headless
{{- end }}
{{- else }}
name: {{ template ".servicename" . }}-headless
{{- end }}
labels:
appId: {{ $.Values.app | quote }}
envId: {{ $.Values.env | quote }}
app: {{ template ".Chart.Name .name" $ }}
chart: {{ template ".Chart.Name .chart" $ }}
release: {{ $.Release.Name }}
{{- if .Values.appLabels }}
{{ toYaml .Values.appLabels | indent 4 }}
{{- end }}
{{- if .Values.service.annotations }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- end }}
spec:
clusterIP: None
ports:
{{- range .Values.ContainerPort }}
{{- if .servicePort }}
- port: {{ .servicePort }}
{{- else }}
- port: {{ .port }}
{{- end }}
{{- if .targetPort }}
targetPort: {{ .targetPort }}
{{- else }}
targetPort: {{ .name }}
{{- end }}
{{- if (and (eq $.Values.service.type "NodePort") .nodePort )}}
nodePort: {{ .nodePort }}
{{- end }}
protocol: TCP
name: {{ .name }}
{{- end }}
{{- if $.Values.appMetrics }}
- port: 9901
name: envoy-admin
{{- end }}
selector:
app: {{ template ".Chart.Name .name" . }}
type: ClusterIP
{{- if (and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerSourceRanges )}}
loadBalancerSourceRanges:
{{- range .Values.service.loadBalancerSourceRanges }}
- {{ . }}
{{- end }}
{{- end }}
{{- end }}