apiVersion: v1
kind: Pod
metadata:
  name: {{ include "vertical-pod-autoscaler.tests.fullname" . }}
  labels:
    {{- include "vertical-pod-autoscaler.tests.labels" . | nindent 4 }}
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
  annotations:
    helm.sh/hook: test
    {{- if .Values.commonAnnotations }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    {{- end }}
spec:
  {{- with .Values.imagePullSecrets }}
  imagePullSecrets:
    {{- toYaml . | nindent 8 }}
  {{- end }}
  containers:
    - name: tests
      image: "{{ .Values.tests.image.repository }}:{{ .Values.tests.image.tag }}"
      imagePullPolicy: {{ .Values.tests.image.pullPolicy }}
      volumeMounts:
        - name: tests
          mountPath: /tests
          readOnly: true
        - name: admission-controller-tls-secret
          mountPath: /admission-controller-tls-secret
          readOnly: true
      workingDir: /tests
  restartPolicy: Never
  volumes:
    - name: tests
      configMap:
        name: {{ include "vertical-pod-autoscaler.tests.fullname" . }}
    - name: admission-controller-tls-secret
      secret:
        secretName: {{ include "vertical-pod-autoscaler.admissionController.tls.secretName" . }}
