-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbindplane.yaml
475 lines (475 loc) · 20.3 KB
/
bindplane.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
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
apiVersion: apps/v1
kind: {{ include "bindplane.deployment_type" . }}
metadata:
name: {{ include "bindplane.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
app.kubernetes.io/name: {{ include "bindplane.name" . }}
app.kubernetes.io/stack: bindplane
app.kubernetes.io/component: server
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
{{- if eq (include "bindplane.deployment_type" .) "StatefulSet" }}
replicas: 1
serviceName: {{ include "bindplane.fullname" . }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "bindplane.name" . }}
app.kubernetes.io/stack: bindplane
app.kubernetes.io/component: server
app.kubernetes.io/instance: {{ .Release.Name }}
template:
metadata:
labels:
app.kubernetes.io/name: {{ include "bindplane.name" . }}
app.kubernetes.io/stack: bindplane
app.kubernetes.io/component: server
app.kubernetes.io/instance: {{ .Release.Name }}
spec:
serviceAccountName: {{ include "bindplane.fullname" . }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: server
image: {{ include "bindplane.image" . }}:{{ include "bindplane.tag" . }}
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3001
name: http
env:
- name: BINDPLANE_TRANSFORM_AGENT_ENABLE_REMOTE
value: "true"
- name: BINDPLANE_TRANSFORM_AGENT_REMOTE_AGENTS
value: "{{ include "bindplane.fullname" . }}-transform-agent:4568"
{{- if .Values.config.license }}
- name: BINDPLANE_LICENSE
value: {{ .Values.config.license }}
{{- end}}
- name: BINDPLANE_ACCEPT_EULA
value: "{{ .Values.config.accept_eula }}"
- name: BINDPLANE_REMOTE_URL
{{- if .Values.config.server_url }}
value: {{ .Values.config.server_url }}
{{- else }}
value: http://{{ include "bindplane.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local:3001
{{- end }}
- name: BINDPLANE_USERNAME
{{- if .Values.config.username }}
value: {{ .Values.config.username }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.config.secret }}
key: username
optional: false
{{- end}}
- name: BINDPLANE_PASSWORD
{{- if .Values.config.password }}
value: {{ .Values.config.password }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.config.secret }}
key: password
optional: false
{{- end}}
- name: BINDPLANE_SECRET_KEY
{{- if .Values.config.secret_key }}
value: {{ .Values.config.secret_key }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.config.secret }}
key: secret_key
optional: false
{{- end }}
- name: BINDPLANE_SESSION_SECRET
{{- if .Values.config.sessions_secret }}
value: {{ .Values.config.sessions_secret }}
{{- else }}
valueFrom:
secretKeyRef:
name: {{ .Values.config.secret }}
key: sessions_secret
optional: true
{{- end }}
{{- if .Values.trace.type }}
- name: BINDPLANE_TRACING_TYPE
value: {{ .Values.trace.type }}
- name: BINDPLANE_TRACING_OTLP_ENDPOINT
value: {{ .Values.trace.otlp.endpoint }}
- name: BINDPLANE_TRACING_OTLP_INSECURE
value: "{{ .Values.trace.otlp.insecure }}"
{{- end }}
- name: BINDPLANE_LOGGING_OUTPUT
value: stdout
- name: BINDPLANE_CONFIG_HOME
value: /data
{{- if eq .Values.backend.type "postgres" }}
- name: BINDPLANE_STORE_TYPE
value: postgres
- name: BINDPLANE_POSTGRES_HOST
value: {{ .Values.backend.postgres.host }}
- name: BINDPLANE_POSTGRES_PORT
value: "{{ .Values.backend.postgres.port }}"
- name: BINDPLANE_POSTGRES_USERNAME
value: {{ .Values.backend.postgres.username }}
- name: BINDPLANE_POSTGRES_PASSWORD
value: {{ .Values.backend.postgres.password }}
- name: BINDPLANE_POSTGRES_DATABASE
value: {{ .Values.backend.postgres.database }}
- name: BINDPLANE_POSTGRES_SSL_MODE
value: {{ .Values.backend.postgres.sslmode }}
- name: BINDPLANE_POSTGRES_MAX_CONNECTIONS
value: "{{ .Values.backend.postgres.maxConnections }}"
{{- else }}
- name: BINDPLANE_STORE_TYPE
value: bbolt
- name: BINDPLANE_STORE_BBOLT_PATH
value: /data/storage
{{- end }}
{{- if eq .Values.eventbus.type "pubsub" }}
- name: BINDPLANE_EVENT_BUS_TYPE
value: googlePubSub
- name: BINDPLANE_GOOGLE_PUB_SUB_PROJECT_ID
value: {{ .Values.eventbus.pubsub.projectid }}
- name: BINDPLANE_GOOGLE_PUB_SUB_TOPIC
value: {{ .Values.eventbus.pubsub.topic }}
{{- if .Values.eventbus.pubsub.credentials.secret }}
- name: BINDPLANE_GOOGLE_PUB_SUB_CREDENTIALS_FILE
value: /credentials.json
{{- end }}
{{- end }}
{{- if eq .Values.eventbus.type "kafka" }}
- name: BINDPLANE_EVENT_BUS_TYPE
value: kafka
- name: BINDPLANE_KAFKA_BROKERS
value: {{ .Values.eventbus.kafka.brokers }}
- name: BINDPLANE_KAFKA_PROTOCOL_VERSION
value: "{{ .Values.eventbus.kafka.protocolVersion }}"
- name: BINDPLANE_KAFKA_TOPIC
value: {{ .Values.eventbus.kafka.topic }}
- name: BINDPLANE_KAFKA_AUTH_TYPE
value: {{ .Values.eventbus.kafka.auth.type }}
{{- if eq .Values.eventbus.kafka.auth.type "plainText" }}
- name: BINDPLANE_KAFKA_PLAIN_TEXT_USERNAME
value: {{ .Values.eventbus.kafka.auth.plain.username }}
- name: BINDPLANE_KAFKA_PLAIN_TEXT_PASSWORD
value: {{ .Values.eventbus.kafka.auth.plain.password }}
{{- end }}
{{- if eq .Values.eventbus.kafka.auth.type "sasl" }}
- name: BINDPLANE_KAFKA_SASL_USERNAME
value: {{ .Values.eventbus.kafka.auth.sasl.username }}
- name: BINDPLANE_KAFKA_SASL_PASSWORD
value: {{ .Values.eventbus.kafka.auth.sasl.password }}
- name: BINDPLANE_KAFKA_SASL_MECHANISM
value: {{ .Values.eventbus.kafka.auth.sasl.mechanism }}
- name: BINDPLANE_KAFKA_SASL_VERSION
value: "{{ .Values.eventbus.kafka.auth.sasl.version }}"
{{- end }}
{{- if eq .Values.eventbus.kafka.tls.enable true }}
- name: BINDPLANE_KAFKA_ENABLE_TLS
value: "true"
{{- if .Values.eventbus.kafka.tls.secret.name }}
- name: BINDPLANE_KAFKA_TLS_CERT
value: /kafka.crt
- name: BINDPLANE_KAFKA_TLS_KEY
value: /kafka.key
- name: BINDPLANE_KAFKA_TLS_CA
value: /kafka-ca.crt
{{- end }}
{{- if eq .Values.eventbus.kafka.tls.insecure true}}
- name: BINDPLANE_KAFKA_TLS_SKIP_VERIFY
value: "true"
{{- end }}
{{- end }}
{{- end }}
{{- if eq (include "bindplane.auth.type" .) "ldap" }}
- name: BINDPLANE_AUTH_TYPE
value: {{ .Values.auth.type }}
- name: BINDPLANE_LDAP_PROTOCOL
value: {{ .Values.auth.ldap.protocol }}
- name: BINDPLANE_LDAP_SERVER
value: {{ .Values.auth.ldap.server }}
- name: BINDPLANE_LDAP_PORT
{{- if eq .Values.auth.ldap.protocol "ldaps"}}
value: "{{ .Values.auth.ldap.port | default (printf "%s" "1636" ) }}"
{{- else }}
value: "{{ .Values.auth.ldap.port | default (printf "%s" "1389" ) }}"
{{- end }}
- name: BINDPLANE_LDAP_BASE_DN
value: {{ .Values.auth.ldap.baseDN }}
- name: BINDPLANE_LDAP_BIND_USER
value: {{ .Values.auth.ldap.bindUser }}
- name: BINDPLANE_LDAP_BIND_PASSWORD
value: {{ .Values.auth.ldap.bindPassword }}
- name: BINDPLANE_LDAP_SEARCH_FILTER
{{- if eq .Values.auth.type "active-directory"}}
value: {{ .Values.auth.ldap.searchFilter | default (printf "%s" "(|(sAMAccountName=%[1]v)(userPrincipalName=%[1]v))" ) }}
{{- else}}
value: {{ .Values.auth.ldap.searchFilter | default (printf "%s" "(uid=%s)" ) }}
{{- end }}
{{- if .Values.auth.ldap.tls.ca.secret }}
- name: BINDPLANE_LDAP_TLS_CA
value: /ldap-ca.crt
{{- end }}
{{- if .Values.auth.ldap.tls.insecure }}
- name: BINDPLANE_LDAP_TLS_SKIP_VERIFY
value: "true"
{{- end }}
{{- end }}
{{- if eq .Values.auth.type "google" }}
- name: BINDPLANE_AUTH_TYPE
value: google
- name: BINDPLANE_GOOGLE_AUTH_CLIENT_ID
value: {{ .Values.auth.google.clientid }}
{{- end }}
{{- if eq .Values.multiAccount true }}
- name: BINDPLANE_ACCOUNTS_ENABLE
value: "true"
{{- end }}
{{- if and (eq .Values.email.type "sendgrid") (eq .Values.multiAccount true) (ne .Values.auth.type "system") }}
- name: BINDPLANE_EMAIL_TYPE
value: sendgrid
- name: BINDPLANE_SEND_GRID_API_TOKEN
value: {{ .Values.email.sendgrid.token }}
{{- end }}
- name: BINDPLANE_PORT
value: "3001"
{{- if .Values.prometheus.enable }}
- name: BINDPLANE_PROMETHEUS_ENABLE
value: "true"
- name: BINDPLANE_PROMETHEUS_ENABLE_REMOTE
value: "true"
- name: BINDPLANE_PROMETHEUS_HOST
value: {{ .Values.prometheus.host }}
- name: BINDPLANE_PROMETHEUS_PORT
value: "{{ .Values.prometheus.port }}"
{{- if .Values.prometheus.queryPathPrefix }}
- name: BINDPLANE_PROMETHEUS_QUERY_PATH_PREFIX
value: {{ .Values.prometheus.queryPathPrefix }}
{{- end }}
{{- if and (.Values.prometheus.remoteWrite.host) (.Values.prometheus.remoteWrite.port) }}
- name: BINDPLANE_PROMETHEUS_REMOTE_WRITE_HOST
value: {{ .Values.prometheus.remoteWrite.host }}
- name: BINDPLANE_PROMETHEUS_REMOTE_WRITE_PORT
value: "{{ .Values.prometheus.remoteWrite.port }}"
{{- end }}
- name: BINDPLANE_PROMETHEUS_REMOTE_WRITE_ENDPOINT
value: {{ .Values.prometheus.remoteWrite.path }}
- name: BINDPLANE_PROMETHEUS_AUTH_TYPE
value: {{ .Values.prometheus.auth.type }}
{{- if eq .Values.prometheus.auth.type "basic" }}
- name: BINDPLANE_PROMETHEUS_AUTH_USERNAME
value: {{ .Values.prometheus.auth.username }}
- name: BINDPLANE_PROMETHEUS_AUTH_PASSWORD
value: {{ .Values.prometheus.auth.password }}
{{- end }}
{{- if .Values.prometheus.tls.enable }}
- name: BINDPLANE_PROMETHEUS_ENABLE_TLS
value: "true"
- name: BINDPLANE_PROMETHEUS_TLS_SKIP_VERIFY
value: "{{ .Values.prometheus.tls.insecure }}"
{{- if .Values.prometheus.tls.secret.caSubPath }}
- name: BINDPLANE_PROMETHEUS_TLS_CA
value: /prometheus-ca.crt
{{- end }}
{{- if .Values.prometheus.tls.secret.crtSubPath }}
- name: BINDPLANE_PROMETHEUS_TLS_CERT
value: /prometheus-client.crt
{{- end }}
{{- if .Values.prometheus.tls.secret.keySubPath }}
- name: BINDPLANE_PROMETHEUS_TLS_KEY
value: /prometheus-client.key
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.health.startupProbe }}
startupProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.health.readinessProbe }}
readinessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.health.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
volumeMounts:
{{- if eq .Values.backend.type "bbolt" }}
- mountPath: /data
name: {{ include "bindplane.fullname" . }}-data
{{- end }}
{{- if eq .Values.eventbus.type "pubsub" }}
{{- if .Values.eventbus.pubsub.credentials.secret }}
- mountPath: /credentials.json
name: {{ .Values.eventbus.pubsub.credentials.secret }}
subPath: {{ .Values.eventbus.pubsub.credentials.subPath }}
{{- end }}
{{- end }}
{{- if eq (include "bindplane.auth.type" .) "ldap" }}
{{- if .Values.auth.ldap.tls.ca.secret }}
- mountPath: /ldap-ca.crt
name: {{ .Values.auth.ldap.tls.ca.secret }}
subPath: {{ .Values.auth.ldap.tls.ca.subPath }}
{{- end }}
{{- end }}
{{- if eq .Values.eventbus.type "kafka" }}
{{- if .Values.eventbus.kafka.tls.secret.caSubPath }}
- mountPath: /kafka-ca.crt
name: {{ .Values.eventbus.kafka.tls.secret.name }}
subPath: {{ .Values.eventbus.kafka.tls.secret.caSubPath }}
{{- end }}
{{- if .Values.eventbus.kafka.tls.secret.certSubPath }}
- mountPath: /kafka.crt
name: {{ .Values.eventbus.kafka.tls.secret.name }}
subPath: {{ .Values.eventbus.kafka.tls.secret.certSubPath }}
{{- end }}
{{- if .Values.eventbus.kafka.tls.secret.keySubPath }}
- mountPath: /kafka.key
name: {{ .Values.eventbus.kafka.tls.secret.name }}
subPath: {{ .Values.eventbus.kafka.tls.secret.keySubPath }}
{{- end }}
{{- end }}
{{- if and (.Values.prometheus.enable) (.Values.prometheus.tls.enable) }}
{{- if .Values.prometheus.tls.secret.caSubPath }}
- mountPath: /prometheus-ca.crt
name: {{ .Values.prometheus.tls.secret.name }}
subPath: {{ .Values.prometheus.tls.secret.caSubPath }}
{{- end }}
{{- if .Values.prometheus.tls.secret.crtSubPath }}
- mountPath: /prometheus-client.crt
name: {{ .Values.prometheus.tls.secret.name }}
subPath: {{ .Values.prometheus.tls.secret.crtSubPath }}
{{- end }}
{{- if .Values.prometheus.tls.secret.keySubPath }}
- mountPath: /prometheus-client.key
name: {{ .Values.prometheus.tls.secret.name }}
subPath: {{ .Values.prometheus.tls.secret.keySubPath }}
{{- end }}
{{- end }}
lifecycle:
preStop:
exec:
command: ["sh", "-c", "sleep 5",]
{{- if eq (include "bindplane.deployment_type" .) "StatefulSet" }}
{{- if and (.Values.prometheus.enable) (.Values.prometheus.enableSideCar) }}
- name: prometheus
image: ghcr.io/observiq/bindplane-prometheus:{{ include "bindplane.tag" . }}
ports:
- containerPort: 9090
name: http
args:
- --config.file=/etc/prometheus/prometheus.yml
- --web.config.file=/etc/prometheus/web.yml
- --storage.tsdb.retention.time=2d
- --web.enable-remote-write-receiver
- --web.listen-address={{ .Values.prometheus.host }}:{{ .Values.prometheus.port }}
- --storage.tsdb.path=/var/lib/prometheus/tsdb
- --web.console.templates=/etc/prometheus/consoles
- --web.console.libraries=/etc/prometheus/console_libraries
{{- with .Values.prometheus.sidecar.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
securityContext:
runAsNonRoot: true
readOnlyRootFilesystem: true
runAsUser: 65534
capabilities:
drop: ["ALL"]
volumeMounts:
- name: {{ include "bindplane.fullname" . }}-prometheus-data
mountPath: /var/lib/prometheus/tsdb
{{- end }}
{{- end }}
terminationGracePeriodSeconds: 60
volumes:
{{- if eq .Values.eventbus.type "pubsub" }}
{{- if .Values.eventbus.pubsub.credentials.secret }}
- name: {{ .Values.eventbus.pubsub.credentials.secret }}
secret:
defaultMode: 0400
secretName: {{ .Values.eventbus.pubsub.credentials.secret }}
{{- end }}
{{- end }}
{{- if eq (include "bindplane.auth.type" .) "ldap" }}
{{- if .Values.auth.ldap.tls.ca.secret }}
- name: {{ .Values.auth.ldap.tls.ca.secret }}
secret:
defaultMode: 0400
secretName: {{ .Values.auth.ldap.tls.ca.secret }}
{{- end }}
{{- end }}
{{- if eq .Values.eventbus.type "kafka" }}
{{- if .Values.eventbus.kafka.tls.secret.name }}
- name: {{ .Values.eventbus.kafka.tls.secret.name }}
secret:
defaultMode: 0400
secretName: {{ .Values.eventbus.kafka.tls.secret.name }}
{{- end }}
{{- end }}
{{- if and (.Values.prometheus.enable) (.Values.prometheus.tls.enable) }}
{{- if .Values.prometheus.tls.secret.name }}
- name: {{ .Values.prometheus.tls.secret.name }}
secret:
defaultMode: 0400
secretName: {{ .Values.prometheus.tls.secret.name }}
{{- end }}
{{- end }}
{{- if eq (include "bindplane.deployment_type" .) "StatefulSet" }}
volumeClaimTemplates:
{{- if eq .Values.backend.type "bbolt" }}
- metadata:
name: {{ include "bindplane.fullname" . }}-data
labels:
app.kubernetes.io/name: {{ include "bindplane.name" . }}
app.kubernetes.io/stack: bindplane
app.kubernetes.io/component: server
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.backend.bbolt.volumeSize }}
{{- if .Values.backend.bbolt.storageClass }}
storageClassName: {{ .Values.backend.bbolt.storageClass }}
{{- end }}
{{- end }}
{{- if eq (include "bindplane.deployment_type" .) "StatefulSet" }}
{{- if and (.Values.prometheus.enable) (.Values.prometheus.enableSideCar) }}
- metadata:
name: {{ include "bindplane.fullname" . }}-prometheus-data
labels:
app.kubernetes.io/name: {{ include "bindplane.name" . }}
app.kubernetes.io/stack: bindplane
app.kubernetes.io/component: server
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.prometheus.sidecar.volumeSize }}
{{- if .Values.prometheus.sidecar.storageClass }}
storageClassName: {{ .Values.prometheus.sidecar.storageClass }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}