refactor(coordinated-policy): add name field in policy#235
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the coordinated policy API by introducing a mandatory Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new name field to CoordinatedPolicyRule and also refactors RoleBasedGroupSetSpec. While the changes themselves seem internally consistent, there are a few important points. Firstly, the refactoring of RoleBasedGroupSetSpec is a breaking API change that is not mentioned in the PR title or description. It's also mixed with an unrelated feature, which makes the PR harder to review and track. It's recommended to split these changes into separate PRs. Secondly, the new name field in CoordinatedPolicyRule should likely be unique within a policy, but this is not enforced. Finally, there are no test updates, which is a concern for a PR with API changes.
a5209b1 to
41ffe7b
Compare
41ffe7b to
674882e
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the CoordinatedPolicy v1alpha2 API schema to introduce a required name field on each spec.policies[] rule and to treat spec.policies as a map-like list keyed by that name (improving patch/SSA merge behavior for individual rules).
Changes:
- Add required
CoordinatedPolicyRule.namewith validation (minLength=1). - Change
spec.policiestolistType=map/listMapKey=name(CRDx-kubernetes-list-type: mapkeyed byname). - Regenerate/update client-go applyconfiguration to support
name(WithName).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| config/crd/bases/workloads.x-k8s.io_coordinatedpolicies.yaml | CRD schema updated to require spec.policies[].name and define policies as a map-keyed list. |
| client-go/applyconfiguration/workloads/v1alpha2/coordinatedpolicyrule.go | Apply configuration updated with Name field and WithName() builder. |
| api/workloads/v1alpha2/coordinatedpolicy_types.go | API types updated to add Name on policy rules and mark Policies as listType=map keyed by name. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Ⅰ. Motivation
Ⅱ. Modifications
Ⅲ. Does this pull request fix one issue?
fixes #XXXX
Ⅳ. List the added test cases (unit test/integration test) if any, please explain if no tests are needed.
Ⅴ. Describe how to verify it
VI. Special notes for reviews
Checklist
make fmt.