forked from temporalio/helm-charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver-deployment.yaml
More file actions
179 lines (179 loc) · 7.46 KB
/
server-deployment.yaml
File metadata and controls
179 lines (179 loc) · 7.46 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
{{- if $.Values.server.enabled }}
{{- $defaultStore := include "temporal.persistence.getStoreByType" (list $ "default") | fromYaml -}}
{{- $visibilityStore := include "temporal.persistence.getStoreByType" (list $ "visibility") | fromYaml -}}
{{- 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 }}
{{- with (default $.Values.server.deploymentStrategy $serviceValues.deploymentStrategy) }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
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/scheme: http
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" $ }}
{{- with $.Values.server.securityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if $.Values.server.additionalInitContainers }}
initContainers:
{{- toYaml $.Values.server.additionalInitContainers | nindent 8 }}
{{- 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: TEMPORAL_SERVICES
value: {{ $service }}
- name: TEMPORAL_SERVER_CONFIG_FILE_PATH
value: /etc/temporal/config/config_template.yaml
- name: TEMPORAL_DEFAULT_STORE_PASSWORD
{{- include "temporal.password-env" (list $ $defaultStore) | nindent 14 }}
- name: TEMPORAL_VISIBILITY_STORE_PASSWORD
{{- include "temporal.password-env" (list $ $visibilityStore) | nindent 14 }}
{{- 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 }}
{{- if or (eq $service "frontend") (eq $service "internal-frontend") }}
readinessProbe:
grpc:
port: {{ $serviceValues.service.port }}
service: temporal.api.workflowservice.v1.WorkflowService
{{- else }}
{{- with default $.Values.server.readinessProbe $serviceValues.readinessProbe }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
volumeMounts:
- name: config
mountPath: /etc/temporal/config/config_template.yaml
subPath: config_template.yaml
- name: dynamic-config
mountPath: /etc/temporal/dynamic_config
- name: shims
mountPath: /usr/local/bin/dockerize
subPath: dockerize
{{- 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: shims
configMap:
name: "{{ include "temporal.fullname" $ }}-shims"
defaultMode: 0555
- 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 }}
{{- with (default $.Values.server.minReadySeconds $serviceValues.minReadySeconds) }}
minReadySeconds: {{ . }}
{{- end }}
---
{{- end }}
{{- end }}
{{- end }}