mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
feat: remove EnableAggregatedDiscoveryTimeout feature gate
This commit is contained in:
parent
7bc8c70f20
commit
14dc59ee54
@ -50,7 +50,6 @@ import (
|
||||
informers "k8s.io/kube-aggregator/pkg/client/informers/externalversions/apiregistration/v1"
|
||||
"k8s.io/kube-aggregator/pkg/controllers/autoregister"
|
||||
"k8s.io/kubernetes/cmd/kube-apiserver/app/options"
|
||||
kubefeatures "k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/pkg/master/controller/crdregistration"
|
||||
)
|
||||
|
||||
@ -110,11 +109,10 @@ func createAggregatorConfig(
|
||||
SharedInformerFactory: externalInformers,
|
||||
},
|
||||
ExtraConfig: aggregatorapiserver.ExtraConfig{
|
||||
ProxyClientCert: certBytes,
|
||||
ProxyClientKey: keyBytes,
|
||||
ServiceResolver: serviceResolver,
|
||||
ProxyTransport: proxyTransport,
|
||||
EnableAggregatedDiscoveryTimeout: utilfeature.DefaultFeatureGate.Enabled(kubefeatures.EnableAggregatedDiscoveryTimeout),
|
||||
ProxyClientCert: certBytes,
|
||||
ProxyClientKey: keyBytes,
|
||||
ServiceResolver: serviceResolver,
|
||||
ProxyTransport: proxyTransport,
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -482,13 +482,6 @@ const (
|
||||
//
|
||||
// Enables the startupProbe in kubelet worker.
|
||||
StartupProbe featuregate.Feature = "StartupProbe"
|
||||
|
||||
// owner @deads2k
|
||||
// deprecated: v1.16
|
||||
//
|
||||
// Enable the aggregated discovery timeout to ensure client responsiveness. Note this feature is present
|
||||
// only for backward compatibility, it will be removed in the 1.17 release.
|
||||
EnableAggregatedDiscoveryTimeout featuregate.Feature = "EnableAggregatedDiscoveryTimeout"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -589,8 +582,6 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
||||
apiextensionsfeatures.CustomResourcePublishOpenAPI: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
||||
apiextensionsfeatures.CustomResourceDefaulting: {Default: true, PreRelease: featuregate.Beta},
|
||||
|
||||
EnableAggregatedDiscoveryTimeout: {Default: true, PreRelease: featuregate.Deprecated},
|
||||
|
||||
// features that enable backwards compatibility but are scheduled to be removed
|
||||
// ...
|
||||
HPAScaleToZero: {Default: false, PreRelease: featuregate.Alpha},
|
||||
|
@ -71,8 +71,6 @@ type ExtraConfig struct {
|
||||
|
||||
// Mechanism by which the Aggregator will resolve services. Required.
|
||||
ServiceResolver ServiceResolver
|
||||
|
||||
EnableAggregatedDiscoveryTimeout bool
|
||||
}
|
||||
|
||||
// Config represents the configuration needed to create an APIAggregator.
|
||||
@ -134,8 +132,6 @@ type APIAggregator struct {
|
||||
|
||||
// openAPIAggregationController downloads and merges OpenAPI specs.
|
||||
openAPIAggregationController *openapicontroller.AggregationController
|
||||
|
||||
enableAggregatedDiscoveryTimeout bool
|
||||
}
|
||||
|
||||
// Complete fills in any fields not set that are required to have valid data. It's mutating the receiver.
|
||||
@ -176,18 +172,17 @@ func (c completedConfig) NewWithDelegate(delegationTarget genericapiserver.Deleg
|
||||
)
|
||||
|
||||
s := &APIAggregator{
|
||||
GenericAPIServer: genericServer,
|
||||
delegateHandler: delegationTarget.UnprotectedHandler(),
|
||||
proxyClientCert: c.ExtraConfig.ProxyClientCert,
|
||||
proxyClientKey: c.ExtraConfig.ProxyClientKey,
|
||||
proxyTransport: c.ExtraConfig.ProxyTransport,
|
||||
proxyHandlers: map[string]*proxyHandler{},
|
||||
handledGroups: sets.String{},
|
||||
lister: informerFactory.Apiregistration().V1().APIServices().Lister(),
|
||||
APIRegistrationInformers: informerFactory,
|
||||
serviceResolver: c.ExtraConfig.ServiceResolver,
|
||||
openAPIConfig: openAPIConfig,
|
||||
enableAggregatedDiscoveryTimeout: c.ExtraConfig.EnableAggregatedDiscoveryTimeout,
|
||||
GenericAPIServer: genericServer,
|
||||
delegateHandler: delegationTarget.UnprotectedHandler(),
|
||||
proxyClientCert: c.ExtraConfig.ProxyClientCert,
|
||||
proxyClientKey: c.ExtraConfig.ProxyClientKey,
|
||||
proxyTransport: c.ExtraConfig.ProxyTransport,
|
||||
proxyHandlers: map[string]*proxyHandler{},
|
||||
handledGroups: sets.String{},
|
||||
lister: informerFactory.Apiregistration().V1().APIServices().Lister(),
|
||||
APIRegistrationInformers: informerFactory,
|
||||
serviceResolver: c.ExtraConfig.ServiceResolver,
|
||||
openAPIConfig: openAPIConfig,
|
||||
}
|
||||
|
||||
apiGroupInfo := apiservicerest.NewRESTStorage(c.GenericConfig.MergedResourceConfig, c.GenericConfig.RESTOptionsGetter)
|
||||
@ -291,12 +286,11 @@ func (s *APIAggregator) AddAPIService(apiService *v1.APIService) error {
|
||||
|
||||
// register the proxy handler
|
||||
proxyHandler := &proxyHandler{
|
||||
localDelegate: s.delegateHandler,
|
||||
proxyClientCert: s.proxyClientCert,
|
||||
proxyClientKey: s.proxyClientKey,
|
||||
proxyTransport: s.proxyTransport,
|
||||
serviceResolver: s.serviceResolver,
|
||||
enableAggregatedDiscoveryTimeout: s.enableAggregatedDiscoveryTimeout,
|
||||
localDelegate: s.delegateHandler,
|
||||
proxyClientCert: s.proxyClientCert,
|
||||
proxyClientKey: s.proxyClientKey,
|
||||
proxyTransport: s.proxyTransport,
|
||||
serviceResolver: s.serviceResolver,
|
||||
}
|
||||
proxyHandler.updateAPIService(apiService)
|
||||
if s.openAPIAggregationController != nil {
|
||||
|
@ -63,8 +63,6 @@ type proxyHandler struct {
|
||||
serviceResolver ServiceResolver
|
||||
|
||||
handlingInfo atomic.Value
|
||||
|
||||
enableAggregatedDiscoveryTimeout bool
|
||||
}
|
||||
|
||||
type proxyHandlingInfo struct {
|
||||
@ -148,7 +146,7 @@ func (r *proxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
location.Path = req.URL.Path
|
||||
location.RawQuery = req.URL.Query().Encode()
|
||||
|
||||
newReq, cancelFn := newRequestForProxy(location, req, r.enableAggregatedDiscoveryTimeout)
|
||||
newReq, cancelFn := newRequestForProxy(location, req)
|
||||
defer cancelFn()
|
||||
|
||||
if handlingInfo.proxyRoundTripper == nil {
|
||||
@ -177,14 +175,14 @@ func (r *proxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
|
||||
// newRequestForProxy returns a shallow copy of the original request with a context that may include a timeout for discovery requests
|
||||
func newRequestForProxy(location *url.URL, req *http.Request, enableAggregatedDiscoveryTimeout bool) (*http.Request, context.CancelFunc) {
|
||||
func newRequestForProxy(location *url.URL, req *http.Request) (*http.Request, context.CancelFunc) {
|
||||
newCtx := req.Context()
|
||||
cancelFn := func() {}
|
||||
|
||||
if requestInfo, ok := genericapirequest.RequestInfoFrom(req.Context()); ok {
|
||||
// trim leading and trailing slashes. Then "/apis/group/version" requests are for discovery, so if we have exactly three
|
||||
// segments that we are going to proxy, we have a discovery request.
|
||||
if enableAggregatedDiscoveryTimeout && !requestInfo.IsResourceRequest && len(strings.Split(strings.Trim(requestInfo.Path, "/"), "/")) == 3 {
|
||||
if !requestInfo.IsResourceRequest && len(strings.Split(strings.Trim(requestInfo.Path, "/"), "/")) == 3 {
|
||||
// discovery requests are used by kubectl and others to determine which resources a server has. This is a cheap call that
|
||||
// should be fast for every aggregated apiserver. Latency for aggregation is expected to be low (as for all extensions)
|
||||
// so forcing a short timeout here helps responsiveness of all clients.
|
||||
|
@ -541,7 +541,7 @@ func TestGetContextForNewRequest(t *testing.T) {
|
||||
location.Path = req.URL.Path
|
||||
|
||||
nestedReq := req.WithContext(genericapirequest.WithRequestInfo(req.Context(), &genericapirequest.RequestInfo{Path: req.URL.Path}))
|
||||
newReq, cancelFn := newRequestForProxy(location, nestedReq, true)
|
||||
newReq, cancelFn := newRequestForProxy(location, nestedReq)
|
||||
defer cancelFn()
|
||||
|
||||
theproxy := proxy.NewUpgradeAwareHandler(location, server.Client().Transport, true, false, &responder{w: w})
|
||||
|
Loading…
Reference in New Issue
Block a user