-
Notifications
You must be signed in to change notification settings - Fork 40.9k
[WIP] reflector: watchlist supports decoding meta.Table #132702
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: master
Are you sure you want to change the base?
[WIP] reflector: watchlist supports decoding meta.Table #132702
Conversation
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: p0lyn0mial The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
if table == nil || err != nil { | ||
return false, err | ||
} | ||
if len(table.Rows) == 0 { |
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.
an alternative to checking the length would be to simply loop over all rows
func decodeIntoTable(rawObject runtime.Object) (*metav1.Table, error) { | ||
unstructuredObj, ok := rawObject.(*unstructured.Unstructured) | ||
if !ok { | ||
return nil, nil |
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.
Table is only supported for unstructured
// 2. Otherwise, it decodes row.Object.Raw into a runtime.Object and then returns its metadata. | ||
// | ||
// If both row.Object.Object and row.Object.Raw are nil | ||
// e.g. when IncludeObject=None, it returns (nil, nil). |
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.
though, ListOptions
doesn't allow for specifying a policy
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.
For watchlist when IncludeObject=None
we need to send at least metadata, I will open a separate PR to address it.
/test pull-kubernetes-unit |
While working on an e2e test for decoding a Table resource, I realized that the default key function used by the informer relies on the name and namespace fields. However, since the Table resource does not contain these fields, events are being overwritten, and as a result, only a single item remains in the store. One possible way forward would be to detect the Table resource in the reflector and return an error - at least for the watchlist feature. |
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR is related to:
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: