Job deletion hook deletes all the jobs

When Job deletion hook is enabled for any one of the jobs in KOTS. It deletes all the jobs including the ones for which job deletion hook annotation is not enabled. As per the documentation here hook-delete policy is supposed to delete only the jobs which have these annotations are enabled. But KOTS deletes jobs on which these annotations are not enabled as well.

Mani,

Can you provide more info, specifically kots version, logs, and job spec would be useful.

Kots version : 1.40.0,1.46.0
Kubernetes Version : 1.20.4

Job Spec:

apiVersion: batch/v1
kind: Job
metadata:
  annotations:
    "kots.io/hook-delete-policy": "hook-succeeded, hook-failed"
  name: sql-init
  namespace: '{{repl Namespace}}'
spec:
  ttlSecondsAfterFinished: 5
  backoffLimit: 1
  template:
    spec:
      shareProcessNamespace: true
      imagePullSecrets:
      - name: replicatedregistrykey
      serviceAccountName: job-editor
      containers:
      - name: sqldeploy
        image: sql-job-image:tag
        imagePullPolicy: Always
        command: ["/bin/bash"]
        args: ["-c" ,"/home/sql/deployment.sh"]
        env:
        - name: stconnection_var
          value: '{{repl ConfigOption "systemdb_connection_string"}}'
        volumeMounts:
          - name: logs-volume
            mountPath: /logs
      restartPolicy: Never
      volumes:
      - name: logs-volume
        emptyDir: {}

Job Spec: (This is not supposed to be deleted)

apiVersion: batch/v1
kind: Job
metadata:
  name: es-deploy
  namespace: '{{repl Namespace}}'
spec:
  ttlSecondsAfterFinished: 5
  backoffLimit: 2
  template:
    spec:
      imagePullSecrets:
      - name: replicatedregistrykey
      initContainers:
      - name: es-availablity-check
        env:
        - name: ELASTICSEARCH_PASSWORD
          valueFrom:
            secretKeyRef:
              key: elastic
              name: elasticsearch-es-elastic-user
        envFrom:
        - configMapRef:
            name: deployelasticindicies-config
        image: curlimages/curl
        command: ["/bin/sh"]
        args: ["-c", "while ! $(curl --silent -f -u $ELASTICSEARCH_USER:$ELASTICSEARCH_PASSWORD $ELASTICSEARCH_URI &> /dev/null); do echo \"$(date) Elasticsearch Instance not yet up\";sleep 10s; done;echo \"Elasticsearch Instance is Up\""]
      containers:
      - name: restapi-elasticdeploy-job
        image: elasticsearch-image:tag
        imagePullPolicy: Always
        envFrom:
        - configMapRef:
            name: deployelasticindicies-config
        env:
        - name: ELASTICSEARCH_PASSWORD
          valueFrom:
            secretKeyRef:
              name: elasticsearch-es-elastic-user
              key: elastic
        - name: FQDN
          valueFrom:
            configMapKeyRef:
              key: FQDN
              name: restapi-config
      restartPolicy: Never

NOTE: We thought the issue might be with 1.40.0 and upgraded admin-console. Even with 1.46.0 same behaviour is being noted

@dmitriy