feat: add support for targeting Jobs in chaos experiments#5433
feat: add support for targeting Jobs in chaos experiments#5433Maximus-08 wants to merge 2 commits intolitmuschaos:masterfrom
Conversation
|
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" ] |
There was a problem hiding this comment.
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" ] |
There was a problem hiding this comment.
separate the apps and batch apiGroups
|
You need to add changes in litmus-go to add the job workload type support |
|
Hey @ispeakc0de thanks for the review |
a5dbbd2 to
65a615c
Compare
There was a problem hiding this comment.
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.
7437812 to
4f28adc
Compare
|
Forgot to rebase to upstream and also implemented the changes copliot suggested so should be good for review now. |
There was a problem hiding this comment.
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.
chaoscenter/graphql/server/manifests/namespace/3a_agents_rbac.yaml
Outdated
Show resolved
Hide resolved
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>
5935d06 to
74846c1
Compare
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
Also a screenshot of the UI dropdown addition