-
Notifications
You must be signed in to change notification settings - Fork 569
Expand file tree
/
Copy pathservice.yaml
More file actions
114 lines (114 loc) · 3.25 KB
/
service.yaml
File metadata and controls
114 lines (114 loc) · 3.25 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
{{- if .Values.service.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ template ".servicename" . }}
labels:
app: {{ template ".Chart.Name .name" . }}
appId: {{ $.Values.app | quote }}
envId: {{ $.Values.env | quote }}
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 if $.Values.appMetrics }}
targetPort: envoy-{{ .name }}
{{- else }}
targetPort: {{ .name }}
{{- end }}
{{- if (and (eq $.Values.service.type "NodePort") .nodePort )}}
nodePort: {{ .nodePort }}
{{- end }}
protocol: {{ .protocol | default "TCP"}}
name: {{ .name }}
{{- end }}
{{- if $.Values.appMetrics }}
- port: 9901
name: envoy-admin
{{- end }}
selector:
{{- if .Values.customPodLabels }}
{{ toYaml .Values.customPodLabels | indent 4 }}
{{- else }}
app: {{ template ".Chart.Name .name" . }}
{{- end }}
{{- if .Values.service.sessionAffinity.enabled }}
sessionAffinity: ClientIP
{{- end }}
{{- if .Values.service.sessionAffinityConfig }}
sessionAffinityConfig:
{{ toYaml .Values.service.sessionAffinityConfig | indent 4 }}
{{- end }}
{{- if or (eq .Values.deploymentType "BLUE-GREEN") (eq .Values.deploymentType "CANARY") }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ template ".previewservicename" . }}
labels:
app: {{ template ".Chart.Name .name" . }}
appId: {{ $.Values.app | quote }}
envId: {{ $.Values.env | quote }}
chart: {{ template ".Chart.Name .chart" . }}
release: {{ .Release.Name }}
spec:
type: ClusterIP
ports:
{{- range .Values.ContainerPort }}
{{- if .servicePort }}
- port: {{ .servicePort }}
{{- else }}
- port: {{ .port }}
{{- end }}
{{- if .targetPort }}
targetPort: {{ .targetPort }}
{{- else if $.Values.appMetrics }}
targetPort: envoy-{{ .name }}
{{- else }}
targetPort: {{ .name }}
{{- end }}
protocol: {{ .protocol | default "TCP"}}
name: {{ .name }}
{{- end }}
{{- if $.Values.appMetrics }}
- port: 9901
name: envoy-admin
{{- end }}
selector:
{{- if .Values.customPodLabels }}
{{ toYaml .Values.customPodLabels | indent 4 }}
{{- else }}
app: {{ template ".Chart.Name .name" . }}
{{- end }}
{{- end }}
{{- end }}