mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
Merge pull request #97957 from yue9944882/aa-server-apf-optionality
Disables APF if the aggregated apiserver cannot locate the core kube-apiserver
This commit is contained in:
commit
5c58b22251
@ -28,6 +28,7 @@ import (
|
|||||||
utilflowcontrol "k8s.io/apiserver/pkg/util/flowcontrol"
|
utilflowcontrol "k8s.io/apiserver/pkg/util/flowcontrol"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
"k8s.io/component-base/featuregate"
|
"k8s.io/component-base/featuregate"
|
||||||
|
"k8s.io/klog/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// RecommendedOptions contains the recommended options for running an API server.
|
// RecommendedOptions contains the recommended options for running an API server.
|
||||||
@ -124,12 +125,16 @@ func (o *RecommendedOptions) ApplyTo(config *server.RecommendedConfig) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if feature.DefaultFeatureGate.Enabled(features.APIPriorityAndFairness) {
|
if feature.DefaultFeatureGate.Enabled(features.APIPriorityAndFairness) {
|
||||||
config.FlowControl = utilflowcontrol.New(
|
if config.ClientConfig != nil {
|
||||||
config.SharedInformerFactory,
|
config.FlowControl = utilflowcontrol.New(
|
||||||
kubernetes.NewForConfigOrDie(config.ClientConfig).FlowcontrolV1beta1(),
|
config.SharedInformerFactory,
|
||||||
config.MaxRequestsInFlight+config.MaxMutatingRequestsInFlight,
|
kubernetes.NewForConfigOrDie(config.ClientConfig).FlowcontrolV1beta1(),
|
||||||
config.RequestTimeout/4,
|
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
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user