{{- include "common.values.setup" . -}}
---
apiVersion: batch/v1
kind: Job
metadata:
  name: {{ include "common.names.fullname" . }}-uninstall
  labels:
    {{- include "common.labels" . | nindent 4 }}
  annotations:
    # This is what defines this resource as a hook. Without this line, the
    # job is considered part of the release.
    "helm.sh/hook": pre-delete
    "helm.sh/hook-weight": "-5"
    "helm.sh/hook-delete-policy": hook-succeeded
spec:
  template:
    metadata:
      name: {{ include "common.names.fullname" . }}-uninstall
      labels:
        {{- include "common.labels" . | nindent 8 }}
    spec:
      restartPolicy: OnFailure
      containers:
      - name: remove-config
        image: "alpine"
        command: ["/bin/sh","-c", "rm -rf  /host/etc/cni/net.d/*multus*"]
        volumeMounts:
        - name: cni
          mountPath: /host/etc/cni/net.d
      volumes:
      - name: cni
        hostPath:
          path: {{ .Values.cni.paths.config }}
          type: Directory
