test.yaml 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. {{- if .Values.testFramework.enabled }}
  2. apiVersion: v1
  3. kind: Pod
  4. metadata:
  5. name: {{ template "grafana.fullname" . }}-test
  6. labels:
  7. {{- include "grafana.labels" . | nindent 4 }}
  8. annotations:
  9. "helm.sh/hook": test-success
  10. namespace: {{ template "grafana.namespace" . }}
  11. spec:
  12. serviceAccountName: {{ template "grafana.serviceAccountNameTest" . }}
  13. {{- if .Values.testFramework.securityContext }}
  14. securityContext: {{ toYaml .Values.testFramework.securityContext | nindent 4 }}
  15. {{- end }}
  16. {{- if .Values.image.pullSecrets }}
  17. imagePullSecrets:
  18. {{- range .Values.image.pullSecrets }}
  19. - name: {{ . }}
  20. {{- end}}
  21. {{- end }}
  22. {{- with .Values.nodeSelector }}
  23. nodeSelector:
  24. {{ toYaml . | indent 4 }}
  25. {{- end }}
  26. {{- with .Values.affinity }}
  27. affinity:
  28. {{ toYaml . | indent 4 }}
  29. {{- end }}
  30. {{- with .Values.tolerations }}
  31. tolerations:
  32. {{ toYaml . | indent 4 }}
  33. {{- end }}
  34. containers:
  35. - name: {{ .Release.Name }}-test
  36. image: "{{ .Values.testFramework.image}}:{{ .Values.testFramework.tag }}"
  37. imagePullPolicy: "{{ .Values.testFramework.imagePullPolicy}}"
  38. command: ["/opt/bats/bin/bats", "-t", "/tests/run.sh"]
  39. volumeMounts:
  40. - mountPath: /tests
  41. name: tests
  42. readOnly: true
  43. volumes:
  44. - name: tests
  45. configMap:
  46. name: {{ template "grafana.fullname" . }}-test
  47. restartPolicy: Never
  48. {{- end }}