mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-11-06 05:17:08 +00:00
A raw rest.Config lets a controller build a client that bypasses the client configuration and transport wrappers the controller manager applies to the clients it builds, such as the leader election write gate of KEP-6361. Deprecate Config and ConfigOrDie on ControllerClientBuilder and on the cloud-provider copy of the interface; out-of-tree cloud providers and controller managers that call them keep working, and the configs they get still carry the controller manager's wrappers. Add TypedClientBuilder, implemented by both in-tree builders, with the clients controllers were building from raw configs: metadata, dynamic and scale clients, WithRateLimits for controllers that need more QPS and burst than the defaults, and WithDropManagedFields for the informer clients. The controller managers hand the builder to their controllers, and a forbidigo rule keeps in-tree code off the deprecated methods. Unit tests cover the derived builders on both implementations. DiscoveryClient's discovery-tuned limits become a floor rather than an override, so a builder configured with higher limits keeps them; the storage version migrator relies on that for its discovery client. The HPA metrics and apiextensions clients still need a config and are built in one lint-exempted place in the controller context, since k8s.io/controller-manager does not depend on those client packages. DynamicControllerClientBuilder cached the composed WrapTransport, so the base config's wrapper was applied twice to every client after the first one built under a service account name. Cache only the token wrapper.