Skip to content

Conversation

bnallapeta
Copy link
Contributor

@bnallapeta bnallapeta commented Sep 25, 2025

What this PR does / why we need it:

Adds GetUncachedClient method to the ClusterCache interface to support live (uncached) API calls to workload clusters. This helps reduce memory usage when you want to cache only a few types instead of having to exclude most types via DisableFor.
The uncached client is created alongside the cached one during connection setup and follows the same lifecycle (connect/disconnect).
Note: This introduces a breaking change to any existing implementations that are directly using ClusterCache.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #12784

/area controllers
/area clustercache

@k8s-ci-robot k8s-ci-robot added the area/clustercache Issues or PRs related to the clustercachetracker label Sep 25, 2025
@k8s-ci-robot
Copy link
Contributor

@bnallapeta: The label(s) area/controllers cannot be applied, because the repository doesn't have them.

In response to this:

What this PR does / why we need it:

  • Introduces an optional extension interface to access a live (uncached) reader for workload clusters: UncachedReaderProvider with GetUncachedReader(ctx, cluster) (client.Reader, error)
  • Wires a finalized uncached client into the connection lifecycle and exposes it via the accessor and a forwarder on clusterCache.
  • Keeps existing ClusterCache API unchanged and fully backward compatible.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #12784

/area controllers
/area clustercache

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.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 25, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @bnallapeta!

It looks like this is your first PR to kubernetes-sigs/cluster-api 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/cluster-api has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
Copy link
Contributor

Hi @bnallapeta. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 25, 2025
@sbueringer
Copy link
Member

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 29, 2025
@bnallapeta bnallapeta changed the title ✨ clustercache: add optional uncached reader support for workload clusters ✨ clustercache: add optional uncached client support for workload clusters Sep 30, 2025
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 1, 2025
@k8s-ci-robot
Copy link
Contributor

@bnallapeta: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-apidiff-main 6f2d5be link false /test pull-cluster-api-apidiff-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@bnallapeta bnallapeta requested a review from sbueringer October 3, 2025 07:59
@bnallapeta
Copy link
Contributor Author

@sbueringer I believe all the comments are addressed. Please take a look and let me know if there's anything else. Thank you.

@bnallapeta
Copy link
Contributor Author

How do we handle the pull-cluster-api-apidiff-main that is failing? I get that its failing due to a API breaking change. But I could not find any file in the codebase where we can make it happy.

@sbueringer
Copy link
Member

How do we handle the pull-cluster-api-apidiff-main that is failing? I get that its failing due to a API breaking change. But I could not find any file in the codebase where we can make it happy.

The job is optional for merge. It's just to highlight API differences to reviewers so they can make an informed choice if the change is acceptable (which it is in this case)

@sbueringer sbueringer changed the title ✨ clustercache: add optional uncached client support for workload clusters ✨ ClusterCache: Add GetUncachedClient() Oct 6, 2025
@sbueringer
Copy link
Member

Thank you very much!

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 6, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 21efe23c4328518176f1bd00b5b58e3a968f7cc6

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 6, 2025
@k8s-ci-robot k8s-ci-robot merged commit a5f35db into kubernetes-sigs:main Oct 6, 2025
27 of 28 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v1.12 milestone Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/clustercache Issues or PRs related to the clustercachetracker cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support uncached client for ClusterCache
3 participants