-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
✨ Backport support for metadata-only watches to release-0.6 #1248
✨ Backport support for metadata-only watches to release-0.6 #1248
Conversation
Add support for metadata-only watches. This backports a series of commits from the main branch: Add low-level metadata-only informer support This adds support for informers that communicate with the API server in metadata-only form. They are *completely* separate from normal informers -- that is: just like unstructured, if you ask for both a "normal" informer & a metadata-only informer, you'll get two copies of the cache. Support metadata-only client operations This adds support for a metadata-only client. It only implements the operations supported by metadata (delete, deleteallof, patch, get, list, status.patch). The higher-level client will now delegate to this for when a PartialObjectMetadata object is passed in. Support "projections" in the controller builder This adds options to "project" watches as only metadata to the builder, making it more convienient to use these forms. For instance: ```go .Owns(&corev1.Pod{}, builder.OnlyMetadata) ``` is equivalent to ```go .Owns(&metav1.PartialObjectMetadata{ TypeMeta: metav1.TypeMeta{ APIVersion: "v1", Kind: "Pod", }, }) ``` Co-authored-by: Solly Ross <sollyross@google.com>
This change allows builders to use builder.OnlyMetadata when creating extra watches with .Watches(...). The code inspects the passed source.Source, and if it's of type *source.Kind, it calls the internal project method that allows to use metav1.PartialObjectMetadata in mapping functions. Signed-off-by: Vince Prignano <vincepri@vmware.com> (cherry picked from commit df54dc5)
I copied over all the changes in the main branch in |
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.
/approve
/assign @alvaroaleman
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alvaroaleman, ncdc, vincepri 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 |
Add support for metadata-only watches to release-0.6. Note, this was a manual backport, as there were several conflicts when trying to cherry-pick. All the tests should be passing, but I encourage reviewers to 👀 carefully. Thanks!
From the original PRs:
#1174:
This introduces metadata-only support (PartialObjectMetadata) to the client, cache, and controller builder. It works much like unstructured does, with an end-use of:
Note that like unstructured, the caches are completely separate -- asking for an unstructured object or concrete object will end up constructing a separate cache.
#1242:
This change allows builders to use builder.OnlyMetadata when creating
extra watches with .Watches(...). The code inspects the passed
source.Source, and if it's of type *source.Kind, it calls the internal
project method that allows to use metav1.PartialObjectMetadata in
mapping functions.
Fixes #1236