-
Notifications
You must be signed in to change notification settings - Fork 440
Expand file tree
/
Copy pathserver-deployment.yaml
More file actions
196 lines (196 loc) · 9.02 KB
/
server-deployment.yaml
File metadata and controls
196 lines (196 loc) · 9.02 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
{{- if $.Values.server.enabled }}
{{- range $rawService := (list "frontend" "internalFrontend" "history" "matching" "worker") }}
{{- $service := include "serviceName" (list $rawService) }}
{{- $serviceValues := index $.Values.server $rawService }}
{{- if or (not (hasKey $serviceValues "enabled")) $serviceValues.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "temporal.componentname" (list $ $service) }}
annotations:
{{- include "temporal.resourceAnnotations" (list $ $service "deployment") | nindent 4 }}
labels:
{{- include "temporal.resourceLabels" (list $ $service "deployment") | nindent 4 }}
spec:
replicas: {{ default $.Values.server.replicaCount $serviceValues.replicaCount }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "temporal.name" $ }}
app.kubernetes.io/instance: {{ $.Release.Name }}
app.kubernetes.io/component: {{ $service }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/server-configmap.yaml") $ | sha256sum }}
{{- if (dig "metrics" "annotations" "enabled" $.Values.server.metrics.annotations.enabled $serviceValues) }}
prometheus.io/job: {{ $.Chart.Name }}-{{ $service }}
prometheus.io/scrape: 'true'
prometheus.io/port: '9090'
{{- end }}
{{- include "temporal.resourceAnnotations" (list $ $service "pod") | nindent 8 }}
labels:
{{- include "temporal.resourceLabels" (list $ $service "pod") | nindent 8 }}
spec:
{{ include "temporal.serviceAccount" $ }}
{{- if semverCompare ">=1.13.0" $.Chart.AppVersion}}
{{- with $.Values.server.securityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- if or (or $.Values.server.additionalInitContainers $.Values.cassandra.enabled) (or $.Values.elasticsearch.enabled $.Values.elasticsearch.external)}}
initContainers:
{{- with $.Values.server.additionalInitContainers }}
{{- toYaml . | nindent 8}}
{{- end }}
{{- if $.Values.cassandra.enabled }}
- name: check-cassandra
image: "{{ $.Values.cassandra.image.repo }}:{{ $.Values.cassandra.image.tag }}"
imagePullPolicy: {{ $.Values.cassandra.image.pullPolicy }}
command: ['sh', '-c', 'until cqlsh {{ include "cassandra.host" $ }} {{ $.Values.cassandra.config.ports.cql }} -e "SHOW VERSION"; do echo waiting for cassandra to start; sleep 1; done;']
{{- with $serviceValues.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
- name: check-cassandra-temporal-schema
image: "{{ $.Values.cassandra.image.repo }}:{{ $.Values.cassandra.image.tag }}"
imagePullPolicy: {{ $.Values.cassandra.image.pullPolicy }}
command: ['sh', '-c', 'until cqlsh {{ include "cassandra.host" $ }} {{ $.Values.cassandra.config.ports.cql }} -e "SELECT keyspace_name FROM system_schema.keyspaces" | grep {{ $.Values.server.config.persistence.default.cassandra.keyspace }}$; do echo waiting for default keyspace to become ready; sleep 1; done;']
{{- with $serviceValues.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if or $.Values.elasticsearch.enabled $.Values.elasticsearch.external }}
- name: check-elasticsearch-index
image: "{{ $.Values.admintools.image.repository }}:{{ $.Values.admintools.image.tag }}"
imagePullPolicy: {{ $.Values.admintools.image.pullPolicy }}
command: ['sh', '-c', 'until curl --silent --fail --user "$ES_USER:$ES_PWD" $ES_SCHEME://$ES_HOST:$ES_PORT/$ES_VISIBILITY_INDEX 2>&1 > /dev/null; do echo waiting for elasticsearch index to become ready; sleep 1; done;']
env:
{{- include "temporal.admintools-env" (list $ "visibility") | nindent 12 }}
{{- with $serviceValues.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- end }}
containers:
- name: {{ $.Chart.Name }}-{{ $service }}
image: "{{ $.Values.server.image.repository }}:{{ $.Values.server.image.tag }}"
imagePullPolicy: {{ $.Values.server.image.pullPolicy }}
env:
- name: POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: SERVICES
value: {{ $service }}
- name: TEMPORAL_SERVER_CONFIG_FILE_PATH
value: /etc/temporal/config/config_template.yaml
{{- if ne (include "temporal.persistence.driver" (list $ "default")) "custom" }}
- name: TEMPORAL_STORE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "temporal.persistence.secretName" (list $ "default") }}
key: {{ include "temporal.persistence.secretKey" (list $ "default") }}
{{- end }}
{{- if ne (include "temporal.persistence.driver" (list $ "visibility")) "custom" }}
- name: TEMPORAL_VISIBILITY_STORE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "temporal.persistence.secretName" (list $ "visibility") }}
key: {{ include "temporal.persistence.secretKey" (list $ "visibility") }}
{{- end }}
{{- if and (hasKey $.Values.server "internalFrontend") $.Values.server.internalFrontend.enabled }}
- name: USE_INTERNAL_FRONTEND
value: "1"
{{- end }}
{{- if $.Values.server.versionCheckDisabled }}
- name: TEMPORAL_VERSION_CHECK_DISABLED
value: "1"
{{- end }}
{{- if or $.Values.server.additionalEnv $serviceValues.additionalEnv }}
{{- toYaml (default $.Values.server.additionalEnv $serviceValues.additionalEnv) | nindent 12 }}
{{- end }}
{{- if $.Values.server.additionalEnvSecretName }}
envFrom:
- secretRef:
name: {{ $.Values.server.additionalEnvSecretName }}
{{- end }}
# For Istio service mesh - make sure ports are defined here and in the headless service, see:
# https://istio.io/latest/docs/ops/configuration/traffic-management/traffic-routing/#headless-services
ports:
{{- if ne $service "worker" }}
- name: rpc
containerPort: {{ $serviceValues.service.port }}
protocol: TCP
{{- end }}
- name: membership
containerPort: {{ $serviceValues.service.membershipPort }}
protocol: TCP
{{- if or (eq $service "frontend") (eq $service "internal-frontend") }}
- name: http
containerPort: {{ $serviceValues.service.httpPort }}
protocol: TCP
{{- end }}
- name: metrics
containerPort: 9090
protocol: TCP
{{- if ne $service "worker" }}
livenessProbe:
initialDelaySeconds: 150
tcpSocket:
port: rpc
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/temporal/config/config_template.yaml
subPath: config_template.yaml
- name: dynamic-config
mountPath: /etc/temporal/dynamic_config
{{- if $.Values.server.additionalVolumeMounts }}
{{- toYaml $.Values.server.additionalVolumeMounts | nindent 12}}
{{- end }}
resources:
{{- toYaml (default $.Values.server.resources $serviceValues.resources) | nindent 12 }}
{{- with $serviceValues.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with $.Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
configMap:
name: "{{ include "temporal.fullname" $ }}-config"
- name: dynamic-config
configMap:
name: "{{ include "temporal.fullname" $ }}-dynamic-config"
items:
- key: dynamic_config.yaml
path: dynamic_config.yaml
{{- if $.Values.server.additionalVolumes }}
{{- toYaml $.Values.server.additionalVolumes | nindent 8}}
{{- end }}
{{- with (default $.Values.server.nodeSelector $serviceValues.nodeSelector) }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default $.Values.server.affinity $serviceValues.affinity) }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (default $.Values.server.tolerations $serviceValues.tolerations) }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $serviceValues.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
---
{{- end }}
{{- end }}
{{- end }}