Skip to content

feat: add Job workload type support for pod targeting#794

Merged
ispeakc0de merged 2 commits intolitmuschaos:masterfrom
Maximus-08:feat/issue-5000-job-workload-support
Feb 27, 2026
Merged

feat: add Job workload type support for pod targeting#794
ispeakc0de merged 2 commits intolitmuschaos:masterfrom
Maximus-08:feat/issue-5000-job-workload-support

Conversation

@Maximus-08
Copy link
Copy Markdown
Contributor

What this PR does / why we need it
This PR adds support for targeting pods owned by Kubernetes Jobs in chaos experiments. Previously, the GetPodOwnerTypeAndName function did not recognize Jobs, causing targeting to fail. I’ve updated the logic to include Job as a valid owner

Which issue this PR fixes
Fixes litmuschaos/litmus#5000

Special notes for your reviewer
Logic update including a unit test. It is needed for adding Job targeting in the main litmus repo as told by @ispeakc0de

Checklist
[ ] PR message has document related information
[ ] Labelled this PR & related issue with breaking-changes tag
[ ] PR message has breaking changes related information
[ ] Labelled this PR & related issue with requires-upgrade tag
[ ] PR message has upgrade related information
[x] Commit has unit tests
[ ] Commit has integration tests
[ ] E2E run Required for the changes

This commit adds support for targeting pods owned by Kubernetes Jobs in chaos experiments by updating the GetPodOwnerTypeAndName function to recognize Job as a valid owner.

Fixes litmuschaos/litmus#5000

Signed-off-by: Avnish Jaltare <[email protected]>
Copilot AI review requested due to automatic review settings February 16, 2026 15:49
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for targeting pods owned by Kubernetes Jobs in chaos experiments. The GetPodOwnerTypeAndName function previously only recognized StatefulSet and DaemonSet as direct pod owners, causing Job-owned pods to be unrecognized during targeting operations.

Changes:

  • Added Job to the list of directly supported workload types in GetPodOwnerTypeAndName
  • Added unit test case to verify Job owner recognition works correctly

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/workloads/workloads.go Extended owner kind check to include "Job" alongside StatefulSet and DaemonSet
pkg/workloads/workloads_test.go Added test case for Job owner to validate the new functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ispeakc0de ispeakc0de merged commit 7b0c22d into litmuschaos:master Feb 27, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Possibility to target jobs in pod faults

3 participants