Skip to content

Commit

Permalink
Merge pull request kubernetes#99438 from yue9944882/automated-cherry-…
Browse files Browse the repository at this point in the history
…pick-of-#97957-upstream-release-1.20

Automated cherry pick of kubernetes#97957 upstream release 1.20
  • Loading branch information
k8s-ci-robot committed Mar 11, 2021
2 parents 2826326 + f90c43e commit 4e4aea6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions staging/src/k8s.io/apiserver/pkg/server/options/recommended.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
utilflowcontrol "k8s.io/apiserver/pkg/util/flowcontrol"
"k8s.io/client-go/kubernetes"
"k8s.io/component-base/featuregate"
"k8s.io/klog/v2"
)

// RecommendedOptions contains the recommended options for running an API server.
Expand Down Expand Up @@ -124,12 +125,16 @@ func (o *RecommendedOptions) ApplyTo(config *server.RecommendedConfig) error {
return err
}
if feature.DefaultFeatureGate.Enabled(features.APIPriorityAndFairness) {
config.FlowControl = utilflowcontrol.New(
config.SharedInformerFactory,
kubernetes.NewForConfigOrDie(config.ClientConfig).FlowcontrolV1beta1(),
config.MaxRequestsInFlight+config.MaxMutatingRequestsInFlight,
config.RequestTimeout/4,
)
if config.ClientConfig != nil {
config.FlowControl = utilflowcontrol.New(
config.SharedInformerFactory,
kubernetes.NewForConfigOrDie(config.ClientConfig).FlowcontrolV1beta1(),
config.MaxRequestsInFlight+config.MaxMutatingRequestsInFlight,
config.RequestTimeout/4,
)
} else {
klog.Warningf("Neither kubeconfig is provided nor service-account is mounted, so APIPriorityAndFairness will be disabled")
}
}
return nil
}
Expand Down

0 comments on commit 4e4aea6

Please sign in to comment.