Repository navigation
Conversation
The k8s_locker uses the default Kubernetes client QPS (5) and Burst (10)
inherited from rest.InClusterConfig(). Under high-churn conditions or
large clusters, these limits cause the locker to back-pressure against
the API server, which can manifest as intermittent watch errors when the
lease-renewal and peer-discovery goroutines compete for the same rate
bucket.
Add two optional config fields:
locker:
type: k8s
qps: 100 # max sustained requests/s to the k8s API (default: unchanged)
burst: 100 # max burst above QPS (default: unchanged)
When either field is zero or absent, the in-cluster default is kept, so
the change is fully backward-compatible.
Resolves: intermittent 'k8s_locker watch ended with error' log spam in
multi-replica deployments where lease + EndpointSlice watches share a
single rate-limited client.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
karimra
approved these changes
Oct 24, 2026
karimra
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for the contribution, clear and simple!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The k8s_locker uses the default Kubernetes client rate limits inherited from
rest.InClusterConfig():In multi-replica gNMIc deployments, the lease-renewal goroutine and the peer-discovery watch (via EndpointSlices, added in #980) share the same rate-limited client. Under high-churn conditions or larger clusters, this causes API requests to be queued and delayed, which manifests as intermittent
k8s_locker watch ended with errorlog spam — even when the API server itself is healthy.Solution
Add two optional config fields to
k8s_locker:When either field is zero or absent the in-cluster default is preserved, so the change is fully backward-compatible.
Changes
pkg/lockers/k8s_locker/k8s_locker.go: two new optional fields (QPS float32,Burst int) in theconfigstruct; conditionally applied to therest.Configbefore the clientset is created.Testing
Verified with
go buildandgo vetagainst the currentmain. The existing locker tests continue to pass unchanged since zero values leave the defaults in place.