---
apiVersion: batch/v1
kind: Job
metadata:
  name: delete-csv
  annotations:
    # This is what defines this resource as a hook. Without this line, the
    # job is considered part of the release.
    "helm.sh/hook": post-delete
    "helm.sh/hook-weight": "2"
    "helm.sh/hook-delete-policy": hook-succeeded
spec:
  template:
    spec:
      containers:
        - image: registry.redhat.io/openshift4/ose-cli:v4.4
          command:
            - /bin/bash
            - -c
            - |
              oc delete $(oc get csv -o name)
          imagePullPolicy: Always
          name: installplan-approver
      dnsPolicy: ClusterFirst
      restartPolicy: OnFailure
      serviceAccount: delete-csv-job
      serviceAccountName: delete-csv-job
      terminationGracePeriodSeconds: 30