apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: cleaner
spec:
  schedule: "0 0 * * 6"
  suspend: false
  concurrencyPolicy: Forbid
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: cleaner
              image: ivukotic/vpservice:cleanup
              imagePullPolicy: Always
              command: ["/usr/src/app/start.sh"]
              env:
                - name: RUCIO_ACCOUNT
                  value: "ivukotic"
                - name: RUCIO_AUTH_TYPE
                  value: "x509_proxy"
              volumeMounts:
                - name: certs-volume
                  mountPath: "/etc/grid-certs/"
                  readOnly: true
          volumes:
            - name: certs-volume
              secret:
                secretName: cert-secret
                items:
                  - key: userkey
                    path: userkey.pem
                    mode: 0400
                  - key: usercert
                    path: usercert.pem
          restartPolicy: Never
