简体   繁体   中英

Not able to delete Helm releases from a CronJob

Here is a YAML file for a CronJob that should find and delete Helm releases. The resulting Job is not able to complete the deletion.

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: cronbox
  namespace: avinash-new
spec:
  serviceAccount: default
  successfulJobsHistoryLimit: 2
  failedJobsHistoryLimit: 2
  schedule: "*/1 * * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: cronbox
            image: busybox
            args:
            #command: 'sh'
            - '-uexc'
            - 'releases=$(helm ls -a -q nodejs-chart.*); helm delete --purge $releases;'
            env:
            - name: TILLER_NAMESPACE
              value: mynamespace-build
            - name: KUBECONFIG
              value: /kube/config
            #volumeMounts:
            #- mountPath: /kube
              #name: kubeconfig
          restartPolicy: OnFailure
          volumes:
          - name: kubeconfig
            configMap:
              name: cronjob-kubeconfig

I need to delete some Helm releases periodically, for example every 5 minutes.

image: busybox does not come with helm command. You can try this image instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM