mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #61743 from rramkumar1/apply-cloud-provider-patch
Automatic merge from submit-queue (batch tested with PRs 61644, 61624, 61743, 61019, 61287). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Add support for setting a custom rate limiter in gce cloud provider **What this PR does / why we need it**: This PR makes it possible to use a custom rate limiter for the GCE cloud provider layer. This is a copy of the raw vendor patch made in https://github.com/kubernetes/ingress-gce/pull/148. Fixes: https://github.com/kubernetes/ingress-gce/issues/154 **Special notes for your reviewer**: **Release note**: ```release-note None ``` /assign @bowei
This commit is contained in:
commit
2edeb07aac
@ -152,6 +152,9 @@ type GCECloud struct {
|
||||
|
||||
// New code generated interface to the GCE compute library.
|
||||
c cloud.Cloud
|
||||
|
||||
// Keep a reference of this around so we can inject a new cloud.RateLimiter implementation.
|
||||
s *cloud.Service
|
||||
}
|
||||
|
||||
// TODO: replace gcfg with json
|
||||
@ -508,17 +511,27 @@ func CreateGCECloud(config *CloudConfig) (*GCECloud, error) {
|
||||
}
|
||||
|
||||
gce.manager = &gceServiceManager{gce}
|
||||
gce.c = cloud.NewGCE(&cloud.Service{
|
||||
gce.s = &cloud.Service{
|
||||
GA: service,
|
||||
Alpha: serviceAlpha,
|
||||
Beta: serviceBeta,
|
||||
ProjectRouter: &gceProjectRouter{gce},
|
||||
RateLimiter: &gceRateLimiter{gce},
|
||||
})
|
||||
}
|
||||
gce.c = cloud.NewGCE(gce.s)
|
||||
|
||||
return gce, nil
|
||||
}
|
||||
|
||||
// SetRateLimiter adds a custom cloud.RateLimiter implementation.
|
||||
// WARNING: Calling this could have unexpected behavior if you have in-flight
|
||||
// requests. It is best to use this immediately after creating a GCECloud.
|
||||
func (g *GCECloud) SetRateLimiter(rl cloud.RateLimiter) {
|
||||
if rl != nil {
|
||||
g.s.RateLimiter = rl
|
||||
}
|
||||
}
|
||||
|
||||
// determineSubnetURL queries for all subnetworks in a region for a given network and returns
|
||||
// the URL of the subnetwork which exists in the auto-subnet range.
|
||||
func determineSubnetURL(service *compute.Service, networkProjectID, networkName, region string) (string, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user