Skip to content

Go auto-instrumentation sidecar prevents Kubernetes Jobs/CronJobs from completingΒ #4539

@brachi-gytpol

Description

@brachi-gytpol

Component(s)

auto-instrumentation

What happened?

Description

When using Go auto-instrumentation on Kubernetes Jobs or CronJobs, the injected sidecar container does not terminate when the main application container exits. This causes the Job to remain in Running state indefinitely.

apiVersion: batch/v1
kind: CronJob
metadata:
  name: test-job
spec:
  schedule: "*/5 * * * *"
  jobTemplate:
    spec:
      template:
        metadata:
          annotations:
            instrumentation.opentelemetry.io/inject-go: "grafana/apm-instrumentation"
            instrumentation.opentelemetry.io/otel-go-auto-target-exe: /app
        spec:
          containers:
            - name: app
              image: my-go-app:latest
              command: ["/app"]

Expected Behavior

When the main container exits (code 0 or 1), the sidecar should terminate and the Job should complete.

Actual Behavior

  • Main container: Terminated (exit code 0 or 1)
  • Sidecar container: Running (indefinitely)
  • Pod status: Running
  • Job status: Never completes

Kubernetes Version

v1.33.5-eks-3cfe0ce

Operator version

opentelemetry-operator-0.99.1

Collector version

Environment information

No response

Log output

Additional context

No response

Tip

React with πŸ‘ to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions