Skip to content

Commit 862b81f

Browse files
authored
feat: Add support for image pull secrets in deployments (#99)
Fixes: HDX-2198
1 parent a06f212 commit 862b81f

12 files changed

+173
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"helm-charts": patch
3+
---
4+
5+
feat: Add support for image pull secrets in deployments

charts/hdx-oss-v2/templates/clickhouse-deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ spec:
2626
tolerations:
2727
{{- toYaml .Values.clickhouse.tolerations | nindent 8 }}
2828
{{- end }}
29+
{{- if .Values.global.imagePullSecrets }}
30+
imagePullSecrets:
31+
{{- toYaml .Values.global.imagePullSecrets | nindent 8 }}
32+
{{- end }}
2933
containers:
3034
- name: clickhouse
3135
image: "{{ .Values.clickhouse.image }}"

charts/hdx-oss-v2/templates/cronjobs/task-checkAlerts.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ spec:
1717
{{- include "hdx-oss.selectorLabels" . | nindent 12 }}
1818
app.kubernetes.io/component: task
1919
spec:
20+
{{- if .Values.global.imagePullSecrets }}
21+
imagePullSecrets:
22+
{{- toYaml .Values.global.imagePullSecrets | nindent 12 }}
23+
{{- end }}
2024
restartPolicy: OnFailure
2125
containers:
2226
- name: task

charts/hdx-oss-v2/templates/hyperdx-deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ spec:
4343
{{- if .Values.hyperdx.priorityClassName }}
4444
priorityClassName: {{ .Values.hyperdx.priorityClassName | quote }}
4545
{{- end }}
46+
{{- if .Values.global.imagePullSecrets }}
47+
imagePullSecrets:
48+
{{- toYaml .Values.global.imagePullSecrets | nindent 8 }}
49+
{{- end }}
4650
{{- if .Values.mongodb.enabled }}
4751
initContainers:
4852
- name: wait-for-mongodb

charts/hdx-oss-v2/templates/mongodb-deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ spec:
4848
tolerations:
4949
{{- toYaml .Values.mongodb.tolerations | nindent 8 }}
5050
{{- end }}
51+
{{- if .Values.global.imagePullSecrets }}
52+
imagePullSecrets:
53+
{{- toYaml .Values.global.imagePullSecrets | nindent 8 }}
54+
{{- end }}
5155
containers:
5256
- name: mongodb
5357
image: "{{ .Values.mongodb.image }}"

charts/hdx-oss-v2/templates/otel-collector-deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ spec:
3232
tolerations:
3333
{{- toYaml .Values.otel.tolerations | nindent 8 }}
3434
{{- end }}
35+
{{- if .Values.global.imagePullSecrets }}
36+
imagePullSecrets:
37+
{{- toYaml .Values.global.imagePullSecrets | nindent 8 }}
38+
{{- end }}
3539
containers:
3640
- name: otel-collector
3741
image: "{{ .Values.otel.image.repository }}:{{ .Values.otel.image.tag | default .Chart.AppVersion }}"

charts/hdx-oss-v2/tests/clickhouse-deployment_test.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,4 +338,29 @@ tests:
338338
of: PersistentVolumeClaim
339339
- documentIndex: 5
340340
isNull:
341-
path: metadata.annotations
341+
path: metadata.annotations
342+
343+
- it: should not include imagePullSecrets when not configured
344+
set:
345+
clickhouse:
346+
enabled: true
347+
asserts:
348+
- documentIndex: 0
349+
isNull:
350+
path: spec.template.spec.imagePullSecrets
351+
352+
- it: should include imagePullSecrets when configured
353+
set:
354+
clickhouse:
355+
enabled: true
356+
global:
357+
imagePullSecrets:
358+
- name: regcred
359+
asserts:
360+
- documentIndex: 0
361+
isNotNull:
362+
path: spec.template.spec.imagePullSecrets
363+
- documentIndex: 0
364+
equal:
365+
path: spec.template.spec.imagePullSecrets[0].name
366+
value: regcred

charts/hdx-oss-v2/tests/hyperdx-deployment_test.yaml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,4 +226,47 @@ tests:
226226
value: 9000
227227
- equal:
228228
path: spec.template.spec.containers[0].readinessProbe.httpGet.port
229-
value: 9000
229+
value: 9000
230+
231+
- it: should not include imagePullSecrets when not configured
232+
asserts:
233+
- isNull:
234+
path: spec.template.spec.imagePullSecrets
235+
236+
- it: should include imagePullSecrets when configured with single secret
237+
set:
238+
global:
239+
imagePullSecrets:
240+
- name: regcred
241+
asserts:
242+
- isNotNull:
243+
path: spec.template.spec.imagePullSecrets
244+
- equal:
245+
path: spec.template.spec.imagePullSecrets[0].name
246+
value: regcred
247+
- lengthEqual:
248+
path: spec.template.spec.imagePullSecrets
249+
count: 1
250+
251+
- it: should include imagePullSecrets when configured with multiple secrets
252+
set:
253+
global:
254+
imagePullSecrets:
255+
- name: regcred
256+
- name: docker-hub-secret
257+
- name: private-registry-secret
258+
asserts:
259+
- isNotNull:
260+
path: spec.template.spec.imagePullSecrets
261+
- equal:
262+
path: spec.template.spec.imagePullSecrets[0].name
263+
value: regcred
264+
- equal:
265+
path: spec.template.spec.imagePullSecrets[1].name
266+
value: docker-hub-secret
267+
- equal:
268+
path: spec.template.spec.imagePullSecrets[2].name
269+
value: private-registry-secret
270+
- lengthEqual:
271+
path: spec.template.spec.imagePullSecrets
272+
count: 3

charts/hdx-oss-v2/tests/mongodb-deployment_test.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,28 @@ tests:
265265
equal:
266266
path: spec.storageClassName
267267
value: fast-ssd
268+
269+
- it: should not include imagePullSecrets when not configured
270+
set:
271+
mongodb:
272+
enabled: true
273+
asserts:
274+
- documentIndex: 0
275+
isNull:
276+
path: spec.template.spec.imagePullSecrets
277+
278+
- it: should include imagePullSecrets when configured
279+
set:
280+
mongodb:
281+
enabled: true
282+
global:
283+
imagePullSecrets:
284+
- name: regcred
285+
asserts:
286+
- documentIndex: 1
287+
isNotNull:
288+
path: spec.template.spec.imagePullSecrets
289+
- documentIndex: 1
290+
equal:
291+
path: spec.template.spec.imagePullSecrets[0].name
292+
value: regcred

charts/hdx-oss-v2/tests/otel-collector_test.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,3 +807,28 @@ tests:
807807
equal:
808808
path: spec.template.spec.containers[0].readinessProbe.httpGet.port
809809
value: 13134
810+
811+
- it: should not include imagePullSecrets when not configured
812+
set:
813+
otel:
814+
enabled: true
815+
asserts:
816+
- documentIndex: 0
817+
isNull:
818+
path: spec.template.spec.imagePullSecrets
819+
820+
- it: should include imagePullSecrets when configured
821+
set:
822+
otel:
823+
enabled: true
824+
global:
825+
imagePullSecrets:
826+
- name: regcred
827+
asserts:
828+
- documentIndex: 0
829+
isNotNull:
830+
path: spec.template.spec.imagePullSecrets
831+
- documentIndex: 0
832+
equal:
833+
path: spec.template.spec.imagePullSecrets[0].name
834+
value: regcred

0 commit comments

Comments
 (0)