feat: add Job workload type support for pod targeting#794
Merged
ispeakc0de merged 2 commits intolitmuschaos:masterfrom Feb 27, 2026
Merged
Conversation
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]>
There was a problem hiding this comment.
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
approved these changes
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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