Skip to content

feat: add support for targeting Jobs in chaos experiments#5433

Open
Maximus-08 wants to merge 2 commits intolitmuschaos:masterfrom
Maximus-08:enhancement/issue-5000-job-targeting
Open

feat: add support for targeting Jobs in chaos experiments#5433
Maximus-08 wants to merge 2 commits intolitmuschaos:masterfrom
Maximus-08:enhancement/issue-5000-job-targeting

Conversation

@Maximus-08
Copy link
Contributor

Proposed changes

This PR enables chaos experiments to target pods controlled by Kubernetes Jobs. Previously, Jobs were not included in the appkind validation or RBAC permissions, preventing users from running experiments against batch workloads.

Fixes: #5000

Detailed Changes:

CRDs: Updated the appkind pattern regex to include job as a valid workload type.
RBAC: Added the batch API group and jobs resource to the operator/runner rules to allow the chaos engine to interact with Job-managed pods.
Frontend: Added batch/v1/job to the target application dropdown in the ChaosCenter UI for a better user experience when configuring experiments.

Types of changes

[x] New feature (non-breaking change which adds functionality)
[ ] Bugfix (non-breaking change which fixes an issue)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] Documentation Update (if none of the other choices applies)

Checklist

[x] I have read the CONTRIBUTING doc
[x] I have signed the commit for DCO to be passed.
[x] Lint and unit tests pass locally with my changes
[ ] I have added tests that prove my fix is effective or that my feature works (if appropriate)
[ ] I have added necessary documentation (if appropriate)

Dependency

None.

Special notes for your reviewer:

The manual testing was performed using a pod-delete experiment. I verified that:
The UI successfully displays "Job" in the workload selection.
The Chaos Engine correctly identifies the parent Job of the target pod.
The RBAC changes do not grant excessive permissions beyond what is required for the batch group.

Validation of the fix:

Attaching a screenshot of the test, here Chaos result shows that the pod-delete experiment was targeted on kind : job

image

Also a screenshot of the UI dropdown addition

image

@Maximus-08
Copy link
Contributor Author

I hit this same backend ci check fail in this pr #5415, so I committed a fix for this in the same, seems to be a go import ordering issue. Please have a look at it. The frontend check fail seems to not be related to changes either.


- apiGroups: [ "apps" ]
resources: [ "deployments", "daemonsets", "replicasets", "statefulsets" ]
- apiGroups: [ "apps", "batch" ]
Copy link
Member

Choose a reason for hiding this comment

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

We already have batch/jobs RBACs (line 55). You can just add list verb

verbs: [ "delete" ]
- apiGroups: [ "apps" ]
resources: [ "deployments", "daemonsets", "replicasets", "statefulsets" ]
- apiGroups: [ "apps", "batch" ]
Copy link
Member

Choose a reason for hiding this comment

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

separate the apps and batch apiGroups

@ispeakc0de
Copy link
Member

You need to add changes in litmus-go to add the job workload type support

@Maximus-08
Copy link
Contributor Author

Hey @ispeakc0de thanks for the review
Removed jobs from apps API group rules, sorry for the mistake
Updated existing batch/jobs rule (line 55) to include list verb
I am going to open a pr in Litmus-go to address job workload type support

Copy link
Contributor

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 Kubernetes Jobs in chaos experiments by updating CRDs, RBAC permissions, and the frontend UI.

Changes:

  • Updated CRD schemas to accept "job" as a valid appkind value in chaos engine specifications
  • Added "list" verb to batch API group permissions for the subscriber component
  • Added batch/v1/job to the frontend GVR data for workload selection

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
chaoscenter/web/src/controllers/TargetApplicationTab/grvData.ts Added batch/v1/job entry to enable Job selection in the UI dropdown
chaoscenter/manifests/litmus-portal-crds.yml Updated appkind pattern regex to include "job" in two locations (appinfo and selectors.workloads)
chaoscenter/graphql/server/manifests/cluster/2a_litmus_crds.yaml Updated appkind pattern regex to include "job" in two locations (appinfo and selectors.workloads)
chaoscenter/graphql/server/manifests/cluster/3a_agents_rbac.yaml Added "list" verb to batch/jobs permissions for subscriber component

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

@Maximus-08 Maximus-08 force-pushed the enhancement/issue-5000-job-targeting branch 2 times, most recently from 7437812 to 4f28adc Compare February 16, 2026 13:47
@Maximus-08
Copy link
Contributor Author

Forgot to rebase to upstream and also implemented the changes copliot suggested so should be good for review now.

Copy link
Contributor

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

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.


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

Maximus-08 and others added 2 commits February 18, 2026 19:13
Signed-off-by: Avnish Jaltare <avnishjaltare8@gmail.com>
…yaml


Redundancy suggested by copilot removed

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Avnish Jaltare <145644393+Maximus-08@users.noreply.github.com>
@Maximus-08 Maximus-08 force-pushed the enhancement/issue-5000-job-targeting branch from 5935d06 to 74846c1 Compare February 18, 2026 13:43
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