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
{{- if or .Values.bootstrap.auth.secretName (or .Values.bootstrap.ddldml.raw .Values.bootstrap.ddldml.configMap) -}}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "influxdb-enterprise.fullname" . }}-bootstrap
labels:
{{- include "influxdb-enterprise.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": post-install
"helm.sh/hook-delete-policy": hook-succeeded
spec:
activeDeadlineSeconds: 300
backoffLimit: 10
template:
metadata:
labels:
{{- include "influxdb-enterprise.selectorLabels" . | nindent 8 }}
spec:
{{- if .Values.bootstrap.ddldml.configMap }}
volumes:
- name: ddldml
configMap:
name: {{ .Values.bootstrap.ddldml.configMap }}
{{ end }}
restartPolicy: OnFailure
# Consider this a middleware of setup components.
# Each is executed in-order until all of theme complete successfully.
# This means that each command must be idempotent.
initContainers:
{{- if .Values.bootstrap.auth.secretName }}
- name: auth
image: "{{ .Values.data.image.repository | default "influxdb" }}:{{ .Values.data.image.tag | default (printf "%s-%s" .Chart.AppVersion "data") }}"
imagePullPolicy: {{ .Values.data.image.pullPolicy }}
# Exposing these environment variables makes this command idempotent
# as even if the authentication has been setup, we can still execute the command
# and it won't error as nothing has changed
env:
- name: INFLUX_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.bootstrap.auth.secretName }}
key: "username"
- name: INFLUX_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.bootstrap.auth.secretName }}
key: "password"
command:
- influx
args:
{{- if .Values.data.https.enabled }}
- -ssl
{{- if .Values.data.https.insecure }}
- -unsafeSsl
{{ end }}
{{ end }}
- -host
- {{ include "influxdb-enterprise.fullname" . }}-data
- -execute
- CREATE USER $(INFLUX_USERNAME) WITH PASSWORD '$(INFLUX_PASSWORD)' WITH ALL PRIVILEGES
resources:
requests:
cpu: 100m
memory: 20Mi
limits:
cpu: 100m
memory: 20Mi
{{ end }}
{{- if .Values.bootstrap.ddldml.configMap }}
- name: ddl
image: "{{ .Values.data.image.repository | default "influxdb" }}:{{ .Values.data.image.tag | default (printf "%s-%s" .Chart.AppVersion "data") }}"
imagePullPolicy: {{ .Values.data.image.pullPolicy }}
{{- if .Values.bootstrap.auth.secretName }}
env:
- name: INFLUX_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.bootstrap.auth.secretName }}
key: "username"
- name: INFLUX_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.bootstrap.auth.secretName }}
key: "password"
{{ end }}
volumeMounts:
- name: ddldml
mountPath: /ddldml
command:
- influx
args:
{{- if .Values.data.https.enabled }}
- -ssl
{{- if .Values.data.https.insecure }}
- -unsafeSsl
{{ end }}
{{ end }}
- -host
- {{ include "influxdb-enterprise.fullname" . }}-data
- -import
- -path
- /ddldml/ddl
resources:
{{ toYaml .Values.bootstrap.ddldml.resources | indent 10 }}
{{ end }}
{{- if .Values.bootstrap.ddldml.configMap }}
- name: dml
image: "{{ .Values.data.image.repository | default "influxdb" }}:{{ .Values.data.image.tag | default (printf "%s-%s" .Chart.AppVersion "data") }}"
imagePullPolicy: {{ .Values.data.image.pullPolicy }}
{{- if .Values.bootstrap.auth.secretName }}
env:
- name: INFLUX_USERNAME
valueFrom:
secretKeyRef:
name: {{ .Values.bootstrap.auth.secretName }}
key: "username"
- name: INFLUX_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.bootstrap.auth.secretName }}
key: "password"
{{ end }}
volumeMounts:
- name: ddldml
mountPath: /ddldml
command:
- influx
args:
{{- if .Values.data.https.enabled }}
- -ssl
{{- if .Values.data.https.insecure }}
- -unsafeSsl
{{ end }}
{{ end }}
- -host
- {{ include "influxdb-enterprise.fullname" . }}-data
- -import
- -path
- /ddldml/dml
resources:
{{ toYaml .Values.bootstrap.ddldml.resources | indent 10 }}
{{ end }}
containers:
- name: success
image: "{{ .Values.data.image.repository | default "influxdb" }}:{{ .Values.data.image.tag | default (printf "%s-%s" .Chart.AppVersion "data") }}"
imagePullPolicy: {{ .Values.data.image.pullPolicy }}
command:
- echo
args:
- "Bootstrap Success"
resources:
requests:
cpu: 100m
memory: 20Mi
limits:
cpu: 100m
memory: 20Mi
{{ end }}