Skip to content

Commit c4037c8

Browse files
feat: support overriding test image
Signed-off-by: vincent-onebrief <vincent@onebrief.com>
1 parent fe724c2 commit c4037c8

File tree

2 files changed

+41
-3
lines changed

2 files changed

+41
-3
lines changed

charts/cluster/templates/tests/ping.yaml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- if .Values.test.enabled }}
12
apiVersion: batch/v1
23
kind: Job
34
metadata:
@@ -16,10 +17,15 @@ spec:
1617
app.kubernetes.io/component: database-ping-test
1718
spec:
1819
restartPolicy: Never
20+
{{- if .Values.test.securityContext }}
21+
securityContext:
22+
{{- .Values.test.securityContext | toYaml | nindent 8 }}
23+
{{- end }}
1924
containers:
20-
- name: alpine
21-
image: alpine:3.17
22-
command: [ 'sh' ]
25+
- name: ping
26+
image: "{{ .Values.test.image.registry }}/{{ .Values.test.image.repository }}:{{ .Values.test.image.tag }}"
27+
command:
28+
- {{ .Values.test.shell }}
2329
env:
2430
- name: PGUSER
2531
valueFrom:
@@ -42,3 +48,10 @@ spec:
4248
- >-
4349
apk add postgresql-client &&
4450
psql "postgresql://$PGUSER:$PGPASS@{{ include "cluster.fullname" . }}-rw.{{ include "cluster.namespace" . }}.svc.cluster.local:5432/${PGDBNAME:-$PGUSER}" -c 'SELECT 1'
51+
resources:
52+
{{- .Values.test.resources | toYaml | nindent 12 }}
53+
{{- if .Values.test.containerSecurityContext }}
54+
securityContext:
55+
{{- .Values.test.containerSecurityContext | toYaml | nindent 12 }}
56+
{{- end }}
57+
{{- end }}

charts/cluster/values.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,3 +528,28 @@ poolers: []
528528
# # -- Custom PgBouncer deployment template.
529529
# # Use to override image, specify resources, etc.
530530
# template: {}
531+
532+
# -- Define values for chart tests
533+
test:
534+
enabled: true
535+
# -- Container image for ping.yaml
536+
image:
537+
registry: docker.io
538+
repository: alpine
539+
tag: 3.17
540+
shell: sh
541+
# -- Resources request/limit for ping Pod
542+
resources: {}
543+
# limits:
544+
# cpu: 50m
545+
# memory: 32Mi
546+
# requests:
547+
# cpu: 25m
548+
# memory: 16Mi
549+
# -- Security context for ping Pod
550+
securityContext:
551+
runAsUser: 5051
552+
runAsGroup: 5051
553+
fsGroup: 5051
554+
# -- Container security context for ping Pod
555+
containerSecurityContext: null

0 commit comments

Comments
 (0)