test-operator.yaml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. ---
  2. {{ if and .Values.deploy.operator (not (and .Values.developer.externalOperatorIp .Values.developer.externalOperatorPort)) }}
  3. apiVersion: v1
  4. kind: Pod
  5. metadata:
  6. name: "{{ .Release.Name }}-test-connection"
  7. labels:
  8. app: "{{ .Release.Name }}"
  9. group: helm-tests
  10. annotations:
  11. "helm.sh/hook": test
  12. spec:
  13. {{- with .Values.jobs.affinity}}
  14. affinity:
  15. {{- toYaml . | nindent 8 }}
  16. {{- end}}
  17. {{- with .Values.jobs.nodeSelector}}
  18. nodeSelector:
  19. {{- toYaml . | nindent 8 }}
  20. {{- end }}
  21. serviceAccountName: {{ .Release.Name }}
  22. restartPolicy: Never
  23. terminationGracePeriodSeconds: 0
  24. {{- with .Values.jobs.tolerations }}
  25. tolerations:
  26. {{- toYaml . | nindent 8 }}
  27. {{- end }}
  28. securityContext:
  29. {{- if or (not (.Capabilities.APIVersions.Has "project.openshift.io/v1")) .Values.developer.disableArbitraryUser }}
  30. runAsNonRoot: true
  31. runAsUser: 1000
  32. runAsGroup: 1000
  33. fsGroup: 1000
  34. {{- end }}
  35. containers:
  36. - name: conn-check
  37. image: '{{ template "kubectl-image" . }}'
  38. imagePullPolicy: "IfNotPresent"
  39. command:
  40. - "bash"
  41. - "-xe"
  42. - "-c"
  43. - |
  44. POD_NAME=$(kubectl get pod -n {{ .Release.Namespace }} -o name | grep -v {{ .Release.Name }}-test-connection | grep {{ .Release.Name }})
  45. POD_IP=$(kubectl get ${POD_NAME} -n {{ .Release.Namespace }} -o jsonpath="{ .status.podIP }")
  46. curl -v ${POD_IP}:8080/q/health/live
  47. {{ end }}