File tree 15 files changed +241
-108
lines changed
15 files changed +241
-108
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ The following table lists the configurable parameters of the PostHog chart and t
23
23
| posthogSecretKey.existingSecret | string | ` nil ` | Specify that the key should be pulled from an existing secret key. By default the chart will generate a secret and create a Kubernetes Secret containing it. |
24
24
| posthogSecretKey.existingSecretKey | string | ` "posthog-secret" ` | Specify the key within the secret from which SECRET_KEY should be taken. |
25
25
| env | list | ` [] ` | Environment variables to inject into every PostHog deployment. |
26
+ | nodeSelector | object | ` {} ` | Global Node labels for all deployment. |
27
+ | tolerations | list | ` [] ` | Global Toleration labels for all deployment. |
28
+ | affinity | object | ` {} ` | Global Affinity settings for all deployment. |
26
29
| migrate.enabled | bool | ` true ` | Whether to install the PostHog migrate job or not. |
27
30
| events.enabled | bool | ` true ` | Whether to install the PostHog events stack or not. |
28
31
| events.replicacount | int | ` 1 ` | Count of events pods to run. This setting is ignored if ` events.hpa.enabled ` is set to ` true ` . |
Original file line number Diff line number Diff line change 44
44
{ {- end } }
45
45
spec:
46
46
serviceAccountName: { { template " posthog.serviceAccountName" .root } }
47
-
48
- { {- if .params.affinity } }
49
- affinity:
50
- { {- toYaml .params.affinity | nindent 8 } }
51
- { {- end } }
52
-
53
- { {- if .params.nodeSelector } }
54
- nodeSelector:
55
- { {- toYaml .params.nodeSelector | nindent 8 } }
56
- { {- end } }
57
-
58
- { {- if .params.tolerations } }
59
- tolerations:
60
- { {- toYaml .params.tolerations | nindent 8 } }
61
- { {- end } }
62
-
47
+ affinity: { { toYaml (merge .params.affinity .root.Values.affinity) | nindent 8 } }
48
+ nodeSelector: { { toYaml (merge .params.nodeSelector .root.Values.nodeSelector) | nindent 8 } }
49
+ tolerations: { { toYaml (coalesce .params.tolerations .root.Values.tolerations) | nindent 8 } }
63
50
{ {- if .params.schedulerName } }
64
51
schedulerName: "{ { .params.schedulerName } }"
65
52
{ {- end } }
Original file line number Diff line number Diff line change 29
29
{{- end }}
30
30
{{- end }}
31
31
{{- end }}
32
+ affinity : {{ toYaml (merge .Values.clickhouse.affinity .Values.affinity) | nindent 12 }}
33
+ nodeSelector : {{ toYaml (merge .Values.clickhouse.nodeSelector .Values.nodeSelector) | nindent 12 }}
34
+ tolerations : {{ toYaml (coalesce .Values.clickhouse.tolerations .Values.tolerations) | nindent 12 }}
32
35
33
36
initContainers :
34
37
#
Original file line number Diff line number Diff line change 71
71
podDistribution : {{ toYaml .Values.clickhouse.podDistribution | nindent 12 }}
72
72
{{- end}}
73
73
spec :
74
- {{- if .Values.clickhouse.affinity }}
75
- affinity : {{ toYaml .Values.clickhouse.affinity | nindent 12 }}
76
- {{- end }}
77
- {{- if .Values.clickhouse.tolerations }}
78
- tolerations : {{ toYaml .Values.clickhouse.tolerations | nindent 12 }}
79
- {{- end }}
80
- {{- if .Values.clickhouse.nodeSelector }}
81
- nodeSelector : {{ toYaml .Values.clickhouse.nodeSelector | nindent 12 }}
82
- {{- end }}
83
-
74
+ affinity : {{ toYaml (merge .Values.clickhouse.affinity .Values.affinity) | nindent 12 }}
75
+ nodeSelector : {{ toYaml (merge .Values.clickhouse.nodeSelector .Values.nodeSelector) | nindent 12 }}
76
+ tolerations : {{ toYaml (coalesce .Values.clickhouse.tolerations .Values.tolerations) | nindent 12 }}
84
77
{{- if .Values.clickhouse.persistence.enabled }}
85
78
volumes :
86
79
{{- if .Values.clickhouse.persistence.existingClaim }}
Original file line number Diff line number Diff line change 25
25
metadata :
26
26
annotations :
27
27
checksum/secrets.yaml : {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }}
28
- {{- if .Values.web .podAnnotations }}
29
- {{ toYaml .Values.web .podAnnotations | indent 8 }}
28
+ {{- if .Values.events .podAnnotations }}
29
+ {{ toYaml .Values.events .podAnnotations | indent 8 }}
30
30
{{- end }}
31
31
labels :
32
32
app : {{ template "posthog.fullname" . }}
41
41
spec :
42
42
terminationGracePeriodSeconds : {{ include "snippet.web-deployments.terminationGracePeriodSeconds" . }}
43
43
serviceAccountName : {{ template "posthog.serviceAccountName" . }}
44
-
45
- {{- if .Values.web.affinity }}
46
- affinity :
47
- {{ toYaml .Values.web.affinity | indent 8 }}
48
- {{- end }}
49
-
50
- {{- if .Values.web.nodeSelector }}
51
- nodeSelector :
52
- {{ toYaml .Values.web.nodeSelector | indent 8 }}
53
- {{- end }}
54
-
55
- {{- if .Values.web.tolerations }}
56
- tolerations :
57
- {{ toYaml .Values.web.tolerations | indent 8 }}
58
- {{- end }}
59
-
44
+ affinity : {{ toYaml (merge .Values.events.affinity .Values.affinity) | nindent 8 }}
45
+ nodeSelector : {{ toYaml (merge .Values.events.nodeSelector .Values.nodeSelector) | nindent 8 }}
46
+ tolerations : {{ toYaml (coalesce .Values.events.tolerations .Values.tolerations) | nindent 8 }}
60
47
{{- if .Values.web.schedulerName }}
61
48
schedulerName : " {{ .Values.web.schedulerName }}"
62
49
{{- end }}
Original file line number Diff line number Diff line change @@ -21,28 +21,16 @@ spec:
21
21
{{ toYaml .Values.worker.podLabels | indent 8 }}
22
22
{{- end }}
23
23
spec :
24
- {{- with .Values.hooks.affinity }}
25
- affinity :
26
- {{ toYaml . | indent 8 }}
27
- {{- end }}
28
-
29
- {{- with .Values.hooks.nodeSelector }}
30
- nodeSelector :
31
- {{ toYaml . | indent 8 }}
32
- {{- end }}
33
-
34
- {{- with .Values.hooks.tolerations }}
35
- tolerations :
36
- {{ toYaml . | indent 8 }}
37
- {{- end }}
38
-
24
+ affinity : {{ toYaml (merge .Values.hooks.affinity .Values.affinity) | nindent 8 }}
25
+ nodeSelector : {{ toYaml (merge .Values.hooks.nodeSelector .Values.nodeSelector) | nindent 8 }}
26
+ tolerations : {{ toYaml (coalesce .Values.hooks.tolerations .Values.tolerations) | nindent 8 }}
39
27
restartPolicy : Never
40
28
41
29
{{- if .Values.image.imagePullSecrets }}
42
30
imagePullSecrets :
43
31
{{ toYaml .Values.image.imagePullSecrets | indent 8 }}
44
32
{{- end }}
45
-
33
+
46
34
# I do not know for sure if the old one has been used anywhere, so do both :(
47
35
{{- if .Values.image.pullSecrets }}
48
36
imagePullSecrets :
Original file line number Diff line number Diff line change @@ -40,21 +40,10 @@ spec:
40
40
# shuts down and exits before the terminationGracePeriod is done, we
41
41
# moves to the next step immediately.
42
42
terminationGracePeriodSeconds : 65
43
-
44
43
serviceAccountName : {{ template "posthog.serviceAccountName" . }}
45
-
46
- {{- if .Values.pgbouncer.affinity }}
47
- affinity : {{ toYaml .Values.pgbouncer.affinity | nindent 8 }}
48
- {{- end }}
49
-
50
- {{- if .Values.pgbouncer.nodeSelector }}
51
- nodeSelector : {{ toYaml .Values.pgbouncer.nodeSelector | nindent 8 }}
52
- {{- end }}
53
-
54
- {{- if .Values.pgbouncer.tolerations }}
55
- tolerations : {{ toYaml .Values.pgbouncer.tolerations | nindent 8 }}
56
- {{- end }}
57
-
44
+ affinity : {{ toYaml (merge .Values.pgbouncer.affinity .Values.affinity) | nindent 8 }}
45
+ nodeSelector : {{ toYaml (merge .Values.pgbouncer.nodeSelector .Values.nodeSelector) | nindent 8 }}
46
+ tolerations : {{ toYaml (coalesce .Values.pgbouncer.tolerations .Values.tolerations) | nindent 8 }}
58
47
{{- if .Values.pgbouncer.schedulerName }}
59
48
schedulerName : " {{ .Values.pgbouncer.schedulerName }}"
60
49
{{- end }}
Original file line number Diff line number Diff line change 41
41
spec :
42
42
terminationGracePeriodSeconds : {{ include "snippet.web-deployments.terminationGracePeriodSeconds" . }}
43
43
serviceAccountName : {{ template "posthog.serviceAccountName" . }}
44
-
45
- {{- if .Values.web.affinity }}
46
- affinity :
47
- {{ toYaml .Values.web.affinity | indent 8 }}
48
- {{- end }}
49
-
50
- {{- if .Values.web.nodeSelector }}
51
- nodeSelector :
52
- {{ toYaml .Values.web.nodeSelector | indent 8 }}
53
- {{- end }}
54
-
55
- {{- if .Values.web.tolerations }}
56
- tolerations :
57
- {{ toYaml .Values.web.tolerations | indent 8 }}
58
- {{- end }}
59
-
44
+ affinity : {{ toYaml (merge .Values.web.affinity .Values.affinity) | nindent 8 }}
45
+ nodeSelector : {{ toYaml (merge .Values.web.nodeSelector .Values.nodeSelector) | nindent 8 }}
46
+ tolerations : {{ toYaml (coalesce .Values.web.tolerations .Values.tolerations) | nindent 8 }}
60
47
{{- if .Values.web.schedulerName }}
61
48
schedulerName : " {{ .Values.web.schedulerName }}"
62
49
{{- end }}
Original file line number Diff line number Diff line change 40
40
{{- end }}
41
41
spec :
42
42
serviceAccountName : {{ template "posthog.serviceAccountName" . }}
43
-
44
- {{- if .Values.worker.affinity }}
45
- affinity :
46
- {{ toYaml .Values.worker.affinity | indent 8 }}
47
- {{- end }}
48
-
49
- {{- if .Values.worker.nodeSelector }}
50
- nodeSelector :
51
- {{ toYaml .Values.worker.nodeSelector | indent 8 }}
52
- {{- end }}
53
-
54
- {{- if .Values.worker.tolerations }}
55
- tolerations :
56
- {{ toYaml .Values.worker.tolerations | indent 8 }}
57
- {{- end }}
58
-
43
+ affinity : {{ toYaml (merge .Values.worker.affinity .Values.affinity) | nindent 8 }}
44
+ nodeSelector : {{ toYaml (merge .Values.worker.nodeSelector .Values.nodeSelector) | nindent 8 }}
45
+ tolerations : {{ toYaml (coalesce .Values.worker.tolerations .Values.tolerations) | nindent 8 }}
59
46
{{- if .Values.worker.schedulerName }}
60
47
schedulerName : " {{ .Values.worker.schedulerName }}"
61
48
{{- end }}
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ should match the snapshot when backup is true:
16
16
labels :
17
17
job : clickhouse - backup
18
18
spec :
19
+ affinity : {}
19
20
containers :
20
21
- command :
21
22
- / bin / sh
@@ -67,7 +68,9 @@ should match the snapshot when backup is true:
67
68
image : busybox :1.34
68
69
imagePullPolicy : IfNotPresent
69
70
name : wait - for - service - dependencies
71
+ nodeSelector : {}
70
72
restartPolicy : Never
73
+ tolerations : null
71
74
volumes :
72
75
- configMap :
73
76
defaultMode : 511
Original file line number Diff line number Diff line change @@ -70,6 +70,7 @@ the manifest should match the snapshot when using default values:
70
70
podTemplates :
71
71
- name : pod - template
72
72
spec :
73
+ affinity : {}
73
74
containers :
74
75
- command :
75
76
- / bin / bash
@@ -87,10 +88,12 @@ the manifest should match the snapshot when using default values:
87
88
volumeMounts :
88
89
- mountPath : / var /lib/clickhouse
89
90
name : data - volumeclaim - template
91
+ nodeSelector : {}
90
92
securityContext :
91
93
fsGroup : 101
92
94
runAsGroup : 101
93
95
runAsUser : 101
96
+ tolerations : null
94
97
volumes :
95
98
- name : data - volumeclaim - template
96
99
persistentVolumeClaim :
Original file line number Diff line number Diff line change 1
1
should match snapshot data :
2
2
1 : |
3
+ affinity : {}
3
4
containers :
4
5
- env :
5
6
- name : POSTGRESQL_USERNAME
@@ -54,5 +55,7 @@ should match snapshot data:
54
55
tcpSocket :
55
56
port : 6543
56
57
timeoutSeconds : 2
58
+ nodeSelector : {}
57
59
serviceAccountName : RELEASE - NAME - posthog
58
60
terminationGracePeriodSeconds : 65
61
+ tolerations : null
Original file line number Diff line number Diff line change @@ -146,11 +146,84 @@ tests:
146
146
- mountPath : /var/lib/clickhouse
147
147
name : existing-volumeclaim
148
148
149
- - it : nodeSelector override via 'clickhouse.nodeSelector ' works
149
+ - it : nodeSelector, affinity and tolerations via '.Values.<key> ' works
150
150
set :
151
+ nodeSelector :
152
+ diskType : hdd
153
+ nodeType : slow
154
+ affinity :
155
+ nodeAffinity :
156
+ requiredDuringSchedulingIgnoredDuringExecution :
157
+ nodeSelectorTerms :
158
+ - matchExpressions :
159
+ - key : node-group
160
+ operator : In
161
+ values :
162
+ - test
163
+ tolerations :
164
+ - key : dedicated
165
+ operator : Equal
166
+ value : test
167
+ effect : NoExecute
168
+ asserts :
169
+ - hasDocuments :
170
+ count : 1
171
+ - equal :
172
+ path : spec.templates.podTemplates[0].spec.nodeSelector
173
+ value :
174
+ diskType : hdd
175
+ nodeType : slow
176
+ - equal :
177
+ path : spec.templates.podTemplates[0].spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0]
178
+ value :
179
+ key : node-group
180
+ operator : In
181
+ values :
182
+ - test
183
+ - equal :
184
+ path : spec.templates.podTemplates[0].spec.tolerations[0]
185
+ value :
186
+ key : dedicated
187
+ operator : Equal
188
+ value : test
189
+ effect : NoExecute
190
+
191
+ - it : nodeSelector, affinity and tolerations override via '.Values.clickhouse.<key>' works
192
+ set :
193
+ nodeSelector :
194
+ diskType : hdd
195
+ nodeType : slow
196
+ affinity :
197
+ nodeAffinity :
198
+ requiredDuringSchedulingIgnoredDuringExecution :
199
+ nodeSelectorTerms :
200
+ - matchExpressions :
201
+ - key : node-group
202
+ operator : In
203
+ values :
204
+ - test
205
+ tolerations :
206
+ - key : dedicated
207
+ operator : Equal
208
+ value : test
209
+ effect : NoExecute
151
210
clickhouse.nodeSelector :
152
211
diskType : ssd
153
212
nodeType : fast
213
+ clickhouse.affinity :
214
+ nodeAffinity :
215
+ requiredDuringSchedulingIgnoredDuringExecution :
216
+ nodeSelectorTerms :
217
+ - matchExpressions :
218
+ - key : node-group
219
+ operator : In
220
+ values :
221
+ - test-override
222
+ clickhouse.tolerations :
223
+ - key : dedicated
224
+ operator : Equal
225
+ value : test-override
226
+ effect : NoExecute
154
227
asserts :
155
228
- hasDocuments :
156
229
count : 1
@@ -159,6 +232,20 @@ tests:
159
232
value :
160
233
diskType : ssd
161
234
nodeType : fast
235
+ - equal :
236
+ path : spec.templates.podTemplates[0].spec.affinity.nodeAffinity.requiredDuringSchedulingIgnoredDuringExecution.nodeSelectorTerms[0].matchExpressions[0]
237
+ value :
238
+ key : node-group
239
+ operator : In
240
+ values :
241
+ - test-override
242
+ - equal :
243
+ path : spec.templates.podTemplates[0].spec.tolerations[0]
244
+ value :
245
+ key : dedicated
246
+ operator : Equal
247
+ value : test-override
248
+ effect : NoExecute
162
249
163
250
- it : volumeClaimTemplates shouldn't exit if clickhouse.persistence.enabled is false
164
251
set :
You can’t perform that action at this time.
0 commit comments