test.yaml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. "helm.sh/hook-delete-policy": "before-hook-creation,hook-succeeded"
  11. namespace: {{ template "grafana.namespace" . }}
  12. spec:
  13. serviceAccountName: {{ template "grafana.serviceAccountNameTest" . }}
  14. {{- if .Values.testFramework.securityContext }}
  15. securityContext: {{ toYaml .Values.testFramework.securityContext | nindent 4 }}
  16. {{- end }}
  17. {{- $root := . }}
  18. {{- if .Values.image.pullSecrets }}
  19. imagePullSecrets:
  20. {{- range .Values.image.pullSecrets }}
  21. - name: {{ tpl . $root }}
  22. {{- end}}
  23. {{- end }}
  24. {{- with .Values.nodeSelector }}
  25. nodeSelector:
  26. {{ toYaml . | indent 4 }}
  27. {{- end }}
  28. {{- $root := . }}
  29. {{- with .Values.affinity }}
  30. affinity:
  31. {{ tpl (toYaml .) $root | indent 4 }}
  32. {{- end }}
  33. {{- with .Values.tolerations }}
  34. tolerations:
  35. {{ toYaml . | indent 4 }}
  36. {{- end }}
  37. containers:
  38. - name: {{ .Release.Name }}-test
  39. image: "{{ .Values.testFramework.image}}:{{ .Values.testFramework.tag }}"
  40. imagePullPolicy: "{{ .Values.testFramework.imagePullPolicy}}"
  41. command: ["/opt/bats/bin/bats", "-t", "/tests/run.sh"]
  42. volumeMounts:
  43. - mountPath: /tests
  44. name: tests
  45. readOnly: true
  46. volumes:
  47. - name: tests
  48. configMap:
  49. name: {{ template "grafana.fullname" . }}-test
  50. restartPolicy: Never
  51. {{- end }}