Skip to content

Commit

Permalink
Helm chart: add tests with helm-unit (apache#387)
Browse files Browse the repository at this point in the history
Co-authored-by: JB Onofré <jbonofre@apache.org>
  • Loading branch information
adutra and jbonofre authored Oct 22, 2024
1 parent 333fadc commit 734ecd4
Show file tree
Hide file tree
Showing 3 changed files with 543 additions and 4 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ jobs:
echo "::endgroup::"
done
- name: Run Helm unit tests
if: steps.list-changed.outputs.changed == 'true'
run: |
helm plugin install https://github.com/helm-unittest/helm-unittest.git || true
helm unittest helm/polaris
- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }} --debug --charts ./helm/polaris
Expand Down
14 changes: 10 additions & 4 deletions helm/polaris/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ spec:
{{- include "polaris.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- if .Values.podAnnotations }}
annotations:
{{- if .Values.podAnnotations }}
{{- tpl (toYaml .Values.podAnnotations) . | nindent 8 }}
{{- end }}
{{- end }}
labels:
{{- include "polaris.selectorLabels" . | nindent 8 }}
{{- if .Values.podLabels }}
Expand All @@ -66,20 +66,24 @@ spec:
{{- end }}
{{- end }}
serviceAccountName: {{ include "polaris.serviceAccountName" . }}
{{- if .Values.podSecurityContext }}
securityContext:
{{- tpl (toYaml .Values.podSecurityContext) . | nindent 8 }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
{{- if .Values.securityContext}}
securityContext:
{{- tpl (toYaml .Values.securityContext) . | nindent 12 }}
{{- end }}
image: "{{ tpl .Values.image.repository . }}:{{ tpl .Values.image.tag . | default .Chart.Version }}"
imagePullPolicy: {{ tpl .Values.image.pullPolicy . }}
command: ["/app/bin/polaris-service"]
args: ["server", "/app/config/polaris-server.yml"]
{{- if .Values.extraEnv }}
env:
{{- if .Values.extraEnv }}
{{- tpl (toYaml .Values.extraEnv) . | nindent 12 }}
{{- end }}
{{- end }}
volumeMounts:
- name: config-volume
mountPath: /app/config/polaris-server.yml
Expand Down Expand Up @@ -115,8 +119,10 @@ spec:
successThreshold: {{ .Values.readinessProbe.successThreshold }}
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
{{- if .Values.resources }}
resources:
{{- tpl (toYaml .Values.resources) . | nindent 12 }}
{{- end }}
volumes:
- name: config-volume
configMap:
Expand Down
Loading

0 comments on commit 734ecd4

Please sign in to comment.