-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathdeployment-mdcb.yaml
242 lines (231 loc) · 10.5 KB
/
deployment-mdcb.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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
apiVersion: apps/v1
kind: Deployment
metadata:
name: mdcb-{{ include "tyk-mdcb.fullname" . }}
labels:
{{- include "tyk-mdcb.labels" . | nindent 4 }}
spec:
{{- if not .Values.mdcb.autoscaling.enabled }}
replicas: {{ .Values.mdcb.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "tyk-mdcb.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.mdcb.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "tyk-mdcb.labels" . | nindent 8 }}
{{- with .Values.mdcb.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- with .Values.mdcb.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "tyk-mdcb.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.mdcb.podSecurityContext | nindent 8 }}
containers:
- name: mdcb-{{ .Chart.Name }}
securityContext:
{{- toYaml .Values.mdcb.containerSecurityContext | nindent 12 }}
image: "{{ .Values.mdcb.image.repository }}:{{ .Values.mdcb.image.tag }}"
imagePullPolicy: {{ .Values.mdcb.image.pullPolicy }}
command: ["/opt/tyk-sink/tyk-sink", "--c=/etc/tyk-sink/tyk_mdcb.conf"]
ports:
- containerPort: {{ .Values.mdcb.listenPort }}
- containerPort: {{ .Values.mdcb.probes.healthCheckPort }}
livenessProbe:
httpGet:
path: {{ .Values.mdcb.probes.liveness.path }}
port: {{ .Values.mdcb.probes.healthCheckPort}}
scheme: "HTTP"
initialDelaySeconds: {{ .Values.mdcb.probes.liveness.initialDelaySeconds }}
periodSeconds: {{ .Values.mdcb.probes.liveness.periodSeconds }}
timeoutSeconds: {{ .Values.mdcb.probes.liveness.timeoutSeconds }}
failureThreshold: {{ .Values.mdcb.probes.liveness.failureThreshold }}
readinessProbe:
initialDelaySeconds: {{ .Values.mdcb.probes.readiness.initialDelaySeconds }}
periodSeconds: {{ .Values.mdcb.probes.readiness.periodSeconds }}
timeoutSeconds: {{ .Values.mdcb.probes.readiness.timeoutSeconds }}
failureThreshold: {{ .Values.mdcb.probes.readiness.failureThreshold }}
httpGet:
path: {{ .Values.mdcb.probes.readiness.path }}
port: {{ .Values.mdcb.probes.healthCheckPort}}
scheme: "HTTP"
resources:
{{- toYaml .Values.mdcb.resources | nindent 12 }}
volumeMounts:
{{- if .Values.mdcb.tls.useSSL }}
- name: {{ .Values.mdcb.tls.volumeName }}
mountPath: {{ .Values.mdcb.tls.certificatesMountPath }}
{{- end }}
{{- with .Values.global.redis }}
{{- if and .useSSL .volumeName .certificatesMountPath }}
- name: {{ .volumeName }}
mountPath: {{ .certificatesMountPath }}
{{- end }}
{{- end }}
- name: mdcb-conf
mountPath: /etc/tyk-sink
{{- if .Values.mdcb.extraVolumeMounts }}
{{- include "mdcb.tplvalues.render" (dict "value" .Values.mdcb.extraVolumeMounts "context" $) | nindent 10 }}
{{- end }}
env:
- name: TYK_MDCB_LISTENPORT
value: "{{ .Values.mdcb.listenPort }}"
- name: TYK_MDCB_HEALTHCHECKPORT
value: "{{ .Values.mdcb.probes.healthCheckPort }}"
- name: TYK_MDCB_STORAGE_TYPE
value: "redis"
- name: TYK_MDCB_STORAGE_ENABLECLUSTER
value: "{{ default "false" .Values.global.redis.enableCluster }}"
- name: TYK_MDCB_STORAGE_ADDRS
value: {{ include "mdcb.redis_url" . | quote }}
- name: TYK_MDCB_HASHKEYS
value: "{{ .Values.global.hashKeys }}"
# Redis TLS configurations
{{- if .Values.global.redis.useSSL }}
- name: TYK_MDCB_STORAGE_REDISSSLMAXVERSION
value: "{{ .Values.global.redis.tlsMaxVersion }}"
- name: TYK_MDCB_STORAGE_REDISSSLMINVERSION
value: "{{ .Values.global.redis.tlsMinVersion }}"
{{- end }}
{{- with .Values.global.redis }}
{{- if and .useSSL .sslCAFile }}
- name: TYK_MDCB_STORAGE_REDISSSLCAFILE
value: "{{ .sslCAFile }}"
{{- end }}
{{- end }}
{{- with .Values.global.redis }}
{{- if and .useSSL .sslCertFile .sslKeyFile }}
- name: TYK_MDCB_STORAGE_REDISSSLCERTFILE
value: "{{ .sslCertFile }}"
- name: TYK_MDCB_STORAGE_REDISSSLKEYFILE
value: "{{ .sslKeyFile }}"
{{- end }}
{{- end }}
{{- if .Values.mdcb.tls.useSSL }}
- name: TYK_MDCB_SERVEROPTIONS_USESSL
value: "{{ .Values.mdcb.tls.useSSL }}"
- name: TYK_MDCB_SERVEROPTIONS_CERTIFICATE_KEYFILE
value: "{{ .Values.mdcb.tls.certificateKeyFile }}"
- name: TYK_MDCB_SERVEROPTIONS_CERTIFICATE_CERTFILE
value: "{{ .Values.mdcb.tls.certificateCertFile }}"
{{- end }}
{ { - if .Values.mdcb.httpServerOptions.useSSL } }
- name: TYK_MDCB_HTTPSERVEROPTIONS_USESSL
value: "{{ .Values.mdcb.httpServerOptions.useSSL }}"
- name: TYK_MDCB_HTTPSERVEROPTIONS_CERTIFICATE_KEYFILE
value: "{{ .Values.mdcb.httpServerOptions.certificateKeyFile }}"
- name: TYK_MDCB_HTTPSERVEROPTIONS_CERTIFICATE_CERTFILE
value: "{{ .Values.mdcb.httpServerOptions.certificateCertFile }}"
- name: TYK_MDCB_HTTPSERVEROPTIONS_MINVERSION
value: "{{ .Values.mdcb.httpServerOptions.minVersion }}"
{ { - end } }
{{ if .Values.global.mtls.privateCertificateEncodingSecret }}
- name: TYK_MDCB_SECURITY_PRIVATECERTIFICATEENCODINGSECRET
value: {{ .Values.global.mtls.privateCertificateEncodingSecret | quote }}
{{ end }}
- name: TYK_MDCB_STORAGE_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "mdcb.redis_secret_name" . }}
key: {{ include "mdcb.redis_secret_key" . }}
- name: TYK_MDCB_STORAGE_REDISUSESSL
value: "{{ default "false" .Values.global.redis.useSSL }}"
{{- if .Values.global.redis.sslInsecureSkipVerify }}
- name: TYK_MDCB_STORAGE_REDISSSLINSECURESKIPVERIFY
value: "{{ .Values.global.redis.sslInsecureSkipVerify }}"
{{- end }}
- name: TYK_MDCB_FORWARDANALYTICSTOPUMP
value: "{{ .Values.mdcb.forwardAnalyticsToPump }}"
- name: TYK_MDCB_ENABLEMULTIPLEANALYTICSKEYS
value: "{{ .Values.mdcb.enableMultipleAnalyticsKey }}"
- name: TYK_MDCB_DONTSTORESELECTIVE
value: "{{ .Values.mdcb.dontStoreSelective }}"
- name: TYK_MDCB_DONTSTOREAGGREGATES
value: "{{ .Values.mdcb.dontStoreAggregate }}"
{{- if .Values.mdcb.ignoreTagPrefixList }}
- name: TYK_MDCB_IGNORETAGPREFIXLIST
value: |
{{- range .Values.mdcb.ignoreTagPrefixList }}
{{ . }}
{{- end }}
{{- end }}
- name: TYK_MDCB_TRACKALLPATHS
value: "{{ .Values.mdcb.trackAllPaths }}"
- name: TYK_MDCB_STOREANALYTICSPERMINUTE
value: "{{ .Values.mdcb.storeAnalyticsPerMinute }}"
- name: TYK_MDCB_LICENSE
valueFrom:
secretKeyRef:
name: {{ if .Values.mdcb.useSecretName }} {{ .Values.mdcb.useSecretName }} {{ else }} secrets-{{ include "tyk-mdcb.fullname" . }} {{ end }}
key: MDCBLicense
{{ if eq "postgres" (include "mdcb.storageType" .) }}
- name: TYK_MDCB_ANALYTICSCONFIG_TYPE
value: "postgres"
- name: TYK_MDCB_ANALYTICSCONFIG_CONNECTIONSTRING
valueFrom:
secretKeyRef:
name: {{ include "mdcb.pg_connection_string_secret_name" . }}
key: {{ include "mdcb.pg_connection_string_secret_key" . }}
{{ else if eq "mongo" (include "mdcb.storageType" .) }}
- name: TYK_MDCB_ANALYTICSCONFIG_TYPE
value: "mongo"
- name: TYK_MDCB_ANALYTICSCONFIG_MONGOURL
valueFrom:
secretKeyRef:
name: {{ include "mdcb.mongo_url_secret_name" . }}
key: {{ include "mdcb.mongo_url_secret_key" . }}
- name: TYK_MDCB_ANALYTICSCONFIG_MONGOUSESSL
value: "{{ default "false" .Values.global.mongo.useSSL }}"
{{ end }}
{{ if .Values.global.mdcbSynchronizer.enabled }}
- name: TYK_MDCB_SYNCWORKER_ENABLED
value: {{ .Values.global.mdcbSynchronizer.enabled | quote }}
- name: TYK_MDCB_SYNCWORKER_HASHKEYS
value: {{ .Values.global.hashKeys | quote }}
{{ end }}
{{- if .Values.mdcb.extraEnvs }}
{{- include "mdcb.tplvalues.render" (dict "value" .Values.mdcb.extraEnvs "context" $) | nindent 12 }}
{{- end }}
volumes:
{{- if .Values.mdcb.tls.useSSL }}
- name: {{ .Values.mdcb.tls.volumeName }}
secret:
secretName: {{ .Values.mdcb.tls.secretName }}
{{- end }}
{{- with .Values.global.redis }}
{{- if and .useSSL .secretName .volumeName }}
- name: {{ .volumeName }}
secret:
secretName: {{ .secretName }}
{{- end }}
{{- end }}
- name: mdcb-conf
configMap:
name: mdcb-conf-{{ include "tyk-mdcb.fullname" . }}
items:
- key: tyk_mdcb.conf
path: tyk_mdcb.conf
{{- if .Values.mdcb.extraVolumes }}
{{- include "mdcb.tplvalues.render" (dict "value" .Values.mdcb.extraVolumes "context" $) | nindent 8 }}
{{- end }}
{{- with .Values.mdcb.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.mdcb.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.mdcb.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}