Skip to content

Annotations not being passed on from scaledjobs to jobs and pods #6629

@diegoduarte-gb

Description

@diegoduarte-gb

Report

Hello there!

I'm strugglinng with a issue here where I'm trying to pass the karpenter.sh/do-not-disrupt: 'true' to avoid disruption of these jobs by our Karpenter.

As far as I understood from here https://keda.sh/docs/2.15/reference/scaledjob-spec/#overview, these annotations should be inherited by the childs, hence, jobs and its pods, is it right?

However, Im not seeing that happening, and our Karpenter is disrupting those jobs during the reconsolidation.

apiVersion: keda.sh/v1alpha1
kind: ScaledJob
metadata:
  annotations:
    karpenter.sh/do-not-disrupt: 'true'
    kubectl.kubernetes.io/last-applied-configuration: <redacted>
  creationTimestamp: '2024-10-16T14:18:09Z'
  finalizers:
    - finalizer.keda.sh
  generation: 37
  labels:
    App: celery
    Environment: prd
    Tier: backend
    argocd.argoproj.io/instance: <redacted>
  name: <redacted>
  namespace: <redacted>
  resourceVersion: '1381993212'
  uid: bd4e184c-cb19-450a-a62d-5b4247e4d759
spec:
  failedJobsHistoryLimit: 2
  jobTargetRef:
    activeDeadlineSeconds: 30000
    backoffLimit: 4
    completions: 1
    parallelism: 1
    template:
      metadata:
        creationTimestamp: null

------ snip ------------

However, as you can see, there's no info about this annotation in the metadata info inside jobs and pods:

JOBS:

apiVersion: batch/v1
kind: Job
metadata:
  creationTimestamp: '2025-03-19T13:10:48Z'
  generateName: <redacted>
  generation: 1
  labels:
    App: celery
    Environment: prd
    Tier: backend
    app.kubernetes.io/managed-by: keda-operator
    app.kubernetes.io/name: <redacted>
    app.kubernetes.io/part-of:  <redacted>
    app.kubernetes.io/version: 2.11.2
    argocd.argoproj.io/instance:  <redacted>
    scaledjob.keda.sh/name:  <redacted>
  name: celery-dpm-integration-scalejob-j4jv5
  namespace: martech-automation
  ownerReferences:
    - apiVersion: keda.sh/v1alpha1
      blockOwnerDeletion: true
      controller: true
      kind: ScaledJob
      name: celery-dpm-integration-scalejob
      uid: bd4e184c-cb19-450a-a62d-5b4247e4d759
  resourceVersion: '1381986332'
  uid: 3e1f38f4-4882-4b56-bc17-2b7ad5235111
spec:
  activeDeadlineSeconds: 30000
  backoffLimit: 4
  completionMode: NonIndexed
  completions: 1
  manualSelector: false
```
---- snip here ----


Is there another way to accomplish that which I could be (probably) missing?

Thanks for the help!

### Expected Behavior

annotations (specifically the karpenter ones) should being passed to jobs and pods, from scaledjobs

### Actual Behavior

Annotations are not being passed

### Steps to Reproduce the Problem

1. Create a new scaledjob with the annotation:

apiVersion: keda.sh/v1alpha1
kind: ScaledJob
metadata:
annotations:
karpenter.sh/do-not-disrupt: 'true'


2. Deploy it
3. Observe that the info is being ignored and not passed ahead. Since Karpenter cannot find this info, its killing the worker with the job.

### Logs from KEDA operator

_No response_

### KEDA Version

2.13.1

### Kubernetes Version

1.30

### Platform

Amazon Web Services

### Scaler Details

_No response_

### Anything else?

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Ready To Ship

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions