Check full GVK for PodSpec helpers#144
Conversation
There was a problem hiding this comment.
Pull request overview
Updates PodSpec extraction/mutation helpers to dispatch on full Group/Version/Kind (GVK) instead of kind-only, preventing collisions like argocd.io/v1 Deployment being treated as apps/v1 Deployment (Fixes #63).
Changes:
- Switch PodSpec helper dispatch logic to match full GVK (group + version + kind).
- Improve rejection messaging to reference supported group/version/kind combinations.
- Add regression tests covering mismatched GVKs for both mutate and extract paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| kubewarden.go | Match PodSpec helper behavior on full GVK and unify supported-object messaging. |
| kubewarden_test.go | Update existing tests to provide full GVK; add regression tests for mismatched GVK scenarios. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
jvanz
left a comment
There was a problem hiding this comment.
Please, take a look in the copilot comments. Special the ones about panicking when using nil pointer.
|
Thanks, I addressed the nil-deref issue now. The PodSpec mutation and extraction paths share the same decoding/target lookup logic, validate the nested spec/template fields before dereferencing them, and return an error for malformed supported objects while keeping the existing rejection response for unsupported GVKs. I also added regression coverage for missing PodSpec/template paths across the supported resource types. Validated with:
|
|
@AkashKumar7902, please resolve the conflicts. |
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
Signed-off-by: Akash Kumar <meakash7902@gmail.com>
3a671cc to
1721dd6
Compare
|
Resolved the conflicts by rebasing the branch onto current |
Summary
Fixes #63
Testing