-
Notifications
You must be signed in to change notification settings - Fork 68
🌱 Update inline config docs and annotations #2366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for olmv1 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this 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 improves the inline configuration documentation and adds the +unionMember annotation to the ClusterExtensionConfig.Inline field as suggested by an API review. The changes make the documentation clearer, fix a grammatical error in the original text, and ensure proper union type annotation for the Kubernetes API.
Key Changes:
- Rewrote inline configuration documentation for better clarity and grammar
- Added
// +unionMemberannotation to theInlinefield inClusterExtensionConfig - Updated all generated CRD manifests and API documentation to reflect the source changes
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
api/v1/clusterextension_types.go |
Updated inline configuration documentation comments and added +unionMember annotation |
manifests/experimental.yaml |
Generated CRD manifest updated with new documentation text |
manifests/experimental-e2e.yaml |
Generated E2E CRD manifest updated with new documentation text |
helm/olmv1/base/operator-controller/crd/experimental/olm.operatorframework.io_clusterextensions.yaml |
Helm CRD manifest updated with new documentation text |
docs/api-reference/olmv1-api-reference.md |
API reference documentation updated to match source code comments |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2366 +/- ##
==========================================
+ Coverage 70.61% 74.51% +3.90%
==========================================
Files 93 93
Lines 7333 7333
==========================================
+ Hits 5178 5464 +286
+ Misses 1720 1435 -285
+ Partials 435 434 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
/approve |
5067091 to
0f50768
Compare
Signed-off-by: Per Goncalves da Silva <pegoncal@redhat.com>
0f50768 to
6b65cca
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: tmshort The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this 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 6 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // +kubebuilder:validation:Type=object | ||
| // +kubebuilder:validation:MinProperties=1 | ||
| // +optional | ||
| // +unionMember |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding this did not produce any change on CRD, should it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great call out! I went poking about and here's what I found out (with the help of Gemini):
| Annotation | Effect on CRD Schema | Notes |
|---|---|---|
| // +union | None (Visible) | Treated as documentation only. |
| // +unionMember | None | Fields remain standard optional pointers. |
| // +unionDiscriminator | None (usually) | Does not automatically generate an Enum or validation. |
This means that the CEL expressions must be manually created to enforce
While controller-gen generates no visible effect, in client-gen they seem to be used.
If you are generating a full-blown Kubernetes Clientset (using k8s.io/code-generator rather than just controller-runtime), these annotations become functional.
Specifically, they affect the generation of ApplyConfigurations.
When using Server-Side Apply (SSA) in Go code, the generated ApplyConfiguration structs need to know if a field is a union.
If tagged correctly, the generated Go client code for "applying" the object will know to clear the other fields in the union when you set a new one.
It also suggests to keep them for other developers to make the intent clear to other developers (not a huge argument for me since it's pretty clear anyway, but ok...)
Description
Addresses enhancement PR reviewer comments by:
// +unionMemberannotation toInline// +kubebuilder:validation:MinProperties=1validation toInlineto ensure empty configurations{}cannot be specifiedReviewer Checklist