Kaushal
Kaushal

Reputation: 83

In helm hooks annotation the previous job is not getting deleted

Im using latest helm version v3.17.1. but while trying to upgrade it always throws Error:

UPGRADE FAILED: cannot patch "populate-ifsc-job" with kind Job: Job.batch "populate-ifsc-job" is invalid: spec.template: Invalid value.

apiVersion: batch/v1
kind: Job
metadata:
  name: {{ include "helm-generic-template.fullname" . }}-job
  labels:
    {{- include "helm-generic-template.labels" . | nindent 4 }}-job
  annotations:
    "helm.sh/hook-weight": "100"
    "helm.sh/hook-delete-policy": before-hook-creation
spec:
  template:
    metadata:
      {{- with .Values.podAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      labels:
        {{- include "helm-generic-template.selectorLabels" . | nindent 8 }}
  backoffLimit: 1
  template:
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      containers:
        {{- range .Values.job.containers }}
          - name: {{ .name }}
            image: "{{ .image.repository }}:{{ .image.tag }}"
            imagePullPolicy: "{{ .image.pullPolicy }}"
            {{- if .args }}
            args:
              {{- toYaml .args | nindent 12 }}
            {{- end }}
      restartPolicy: Never

when i dispatch this job from the github actions it works, but on new commits it fails to upgrade.

Upvotes: 0

Views: 25

Answers (0)

Related Questions