feat: client cache for configurable list of gvks#1042
Conversation
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Test Coverage ReportTest Coverage 📊: 70.3% |
mblos
left a comment
There was a problem hiding this comment.
Very nice work :) some first comments (still not completed with reviewing)
| // overlayList merges the overlay entries for the GVK into the informer result, | ||
| // deduplicating by objectKey (overlay wins), dropping tombstones, and filtering | ||
| // overlay-only entries against the list options' label and field selectors. | ||
| func (o *overlay) overlayList(gvk schema.GroupVersionKind, existing []runtime.Object, lo *client.ListOptions) []runtime.Object { |
There was a problem hiding this comment.
If a write changes an indexed field, the inner List filters against the informer (old value), then overlayList silently replaces the object with the new version.
Example: informer has spec.hostName=host-A (RV=5), overlay has spec.hostName=host-B (RV=6). List(MatchingFields{"spec.hostName": "host-A"}) includes the object from the informer, then overlayList swaps in the overlay version.
So you get a host-B object in a host-A query.
Or am I overlooking something?
|
|
||
| // evictionHandler returns an informer event handler that evicts overlay entries | ||
| // for the GVK when the real object is observed at a >= ResourceVersion. | ||
| func (c *CachingClient) evictionHandler(gvk schema.GroupVersionKind) toolscachek8s.ResourceEventHandler { |
There was a problem hiding this comment.
is DeleteFunc missing here? what if eg someone via kubectl deletes the crd, the informer fires a delete .. but the overlay does not react on it, or?
|
|
||
| // Delete delegates to the inner client and, on success for a cached GVK, stores | ||
| // a tombstone in the overlay. | ||
| func (c *CachingClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error { |
| } | ||
|
|
||
| func keyForObject(obj client.Object) objectKey { | ||
| return objectKey{namespace: obj.GetNamespace(), name: obj.GetName()} |
There was a problem hiding this comment.
What if a crd resource has the same name across lh clusters?
No description provided.