apiVersion: batch/v1
kind: Job
metadata:
  labels:
    app.kubernetes.io/component: spark-operator
    app.kubernetes.io/instance: spark-operator-v1.0.0
    app.kubernetes.io/managed-by: kfctl
    app.kubernetes.io/name: sparkoperator
    app.kubernetes.io/part-of: kubeflow
    app.kubernetes.io/version: v1.0.0
    kustomize.component: spark-operator
  name: spark-operatorcrd-cleanup
  namespace: kubeflow
spec:
  template:
    metadata:
      labels:
        app.kubernetes.io/component: spark-operator
        app.kubernetes.io/instance: spark-operator-v1.0.0
        app.kubernetes.io/managed-by: kfctl
        app.kubernetes.io/name: sparkoperator
        app.kubernetes.io/part-of: kubeflow
        app.kubernetes.io/version: v1.0.0
        kustomize.component: spark-operator
    spec:
      containers:
      - command:
        - /bin/sh
        - -c
        - 'curl -ik -X DELETE -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)"
          -H "Accept: application/json" -H "Content-Type: application/json" https://kubernetes.default.svc/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/sparkapplications.sparkoperator.k8s.io'
        image: gcr.io/spark-operator/spark-operator:v1beta2-1.0.0-2.4.4
        imagePullPolicy: IfNotPresent
        name: delete-sparkapp-crd
      - command:
        - /bin/sh
        - -c
        - 'curl -ik -X DELETE -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)"
          -H "Accept: application/json" -H "Content-Type: application/json" https://kubernetes.default.svc/apis/apiextensions.k8s.io/v1beta1/customresourcedefinitions/scheduledsparkapplications.sparkoperator.k8s.io'
        image: gcr.io/spark-operator/spark-operator:v1beta2-1.0.0-2.4.4
        imagePullPolicy: IfNotPresent
        name: delete-scheduledsparkapp-crd
      restartPolicy: OnFailure
      serviceAccountName: spark-operatoroperator-sa
