Skip to content

Commit cf399d2

Browse files
yue9944882MikeSpreitzer
authored andcommitted
[PATCH] Fix bugs and names in API priority and fairness
1 parent eb33e06 commit cf399d2

File tree

16 files changed

+1378
-708
lines changed

16 files changed

+1378
-708
lines changed

cmd/kube-apiserver/app/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ go_library(
2727
"//pkg/master/reconcilers:go_default_library",
2828
"//pkg/master/tunneler:go_default_library",
2929
"//pkg/registry/cachesize:go_default_library",
30-
"//pkg/registry/flowcontrol/bootstrap:go_default_library",
3130
"//pkg/registry/rbac/rest:go_default_library",
3231
"//pkg/serviceaccount:go_default_library",
3332
"//pkg/util/flag:go_default_library",

cmd/kube-apiserver/app/server.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ import (
8282
"k8s.io/kubernetes/pkg/master/reconcilers"
8383
"k8s.io/kubernetes/pkg/master/tunneler"
8484
"k8s.io/kubernetes/pkg/registry/cachesize"
85-
flowcontrolbootstrap "k8s.io/kubernetes/pkg/registry/flowcontrol/bootstrap"
8685
rbacrest "k8s.io/kubernetes/pkg/registry/rbac/rest"
8786
"k8s.io/kubernetes/pkg/serviceaccount"
8887
utilflag "k8s.io/kubernetes/pkg/util/flag"
@@ -524,7 +523,7 @@ func buildGenericConfig(
524523
}
525524

526525
if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.RequestManagement) {
527-
genericConfig.RequestManagement = BuildRequestManager(s, clientgoExternalClient, versionedInformers)
526+
genericConfig.FlowControl = BuildRequestManager(s, clientgoExternalClient, versionedInformers)
528527
}
529528

530529
return
@@ -556,13 +555,12 @@ func BuildAuthorizer(s *options.ServerRunOptions, versionedInformers clientgoinf
556555

557556
// BuildRequestManager constructs the request manager
558557
func BuildRequestManager(s *options.ServerRunOptions, extclient clientgoclientset.Interface, versionedInformer clientgoinformers.SharedInformerFactory) utilflowcontrol.Interface {
559-
return utilflowcontrol.NewRequestManagerWithPreservation(
558+
return utilflowcontrol.NewRequestManager(
560559
versionedInformer,
561560
extclient.FlowcontrolV1alpha1(),
562561
s.GenericServerRunOptions.MaxRequestsInFlight+s.GenericServerRunOptions.MaxMutatingRequestsInFlight,
563562
s.GenericServerRunOptions.RequestTimeout/4,
564-
flowcontrolbootstrap.PreservingFlowSchemas,
565-
flowcontrolbootstrap.PreservingPriorityLevelConfigurations,
563+
true,
566564
)
567565
}
568566

pkg/kubeapiserver/server/insecure_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func BuildInsecureHandlerChain(apiHandler http.Handler, c *server.Config) http.H
3131
handler := apiHandler
3232
handler = genericapifilters.WithAudit(handler, c.AuditBackend, c.AuditPolicyChecker, c.LongRunningFunc)
3333
if feature.DefaultFeatureGate.Enabled(features.RequestManagement) {
34-
handler = genericfilters.WithRequestManagement(handler, c.LongRunningFunc, c.RequestManagement)
34+
handler = genericfilters.WithPriorityAndFairness(handler, c.LongRunningFunc, c.FlowControl)
3535
} else {
3636
handler = genericfilters.WithMaxInFlightLimit(handler, c.MaxRequestsInFlight, c.MaxMutatingRequestsInFlight, c.LongRunningFunc)
3737
}

pkg/registry/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ filegroup(
7575
"//pkg/registry/events/rest:all-srcs",
7676
"//pkg/registry/extensions/controller/storage:all-srcs",
7777
"//pkg/registry/extensions/rest:all-srcs",
78-
"//pkg/registry/flowcontrol/bootstrap:all-srcs",
7978
"//pkg/registry/flowcontrol/flowschema:all-srcs",
8079
"//pkg/registry/flowcontrol/prioritylevelconfiguration:all-srcs",
8180
"//pkg/registry/flowcontrol/rest:all-srcs",

pkg/registry/flowcontrol/rest/BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ go_library(
88
deps = [
99
"//pkg/api/legacyscheme:go_default_library",
1010
"//pkg/apis/flowcontrol:go_default_library",
11-
"//pkg/registry/flowcontrol/bootstrap:go_default_library",
1211
"//pkg/registry/flowcontrol/flowschema/storage:go_default_library",
1312
"//pkg/registry/flowcontrol/prioritylevelconfiguration/storage:go_default_library",
1413
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
@@ -20,6 +19,7 @@ go_library(
2019
"//staging/src/k8s.io/apiserver/pkg/registry/rest:go_default_library",
2120
"//staging/src/k8s.io/apiserver/pkg/server:go_default_library",
2221
"//staging/src/k8s.io/apiserver/pkg/server/storage:go_default_library",
22+
"//staging/src/k8s.io/apiserver/pkg/util/flowcontrol/bootstrap:go_default_library",
2323
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1:go_default_library",
2424
"//vendor/k8s.io/klog:go_default_library",
2525
],

pkg/registry/flowcontrol/rest/storage_flowcontrol.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ import (
2929
"k8s.io/apiserver/pkg/registry/rest"
3030
genericapiserver "k8s.io/apiserver/pkg/server"
3131
serverstorage "k8s.io/apiserver/pkg/server/storage"
32+
flowcontrolbootstrap "k8s.io/apiserver/pkg/util/flowcontrol/bootstrap"
3233
flowcontrolclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1"
3334
"k8s.io/klog"
3435
"k8s.io/kubernetes/pkg/api/legacyscheme"
3536
"k8s.io/kubernetes/pkg/apis/flowcontrol"
36-
flowcontrolbootstrap "k8s.io/kubernetes/pkg/registry/flowcontrol/bootstrap"
3737
flowschemastore "k8s.io/kubernetes/pkg/registry/flowcontrol/flowschema/storage"
3838
prioritylevelconfigurationstore "k8s.io/kubernetes/pkg/registry/flowcontrol/prioritylevelconfiguration/storage"
3939
)
@@ -70,20 +70,19 @@ func (p RESTStorageProvider) v1alpha1Storage(apiResourceConfigSource serverstora
7070
}
7171

7272
func (p RESTStorageProvider) PostStartHook() (string, genericapiserver.PostStartHookFunc, error) {
73-
systemPreset := SystemPresetData{
74-
FlowSchemas: flowcontrolbootstrap.DefaultFlowSchemas(),
75-
PriorityLevelConfigurations: flowcontrolbootstrap.DefaultPriorityLevelConfigurations(),
73+
predefined := PredefinedData{
74+
FlowSchemas: flowcontrolbootstrap.PredefinedFlowSchemas(),
75+
PriorityLevelConfigurations: flowcontrolbootstrap.PredefinedPriorityLevelConfigurations(),
7676
}
77-
// TODO: default flow-schemas and priority levels
78-
return PostStartHookName, systemPreset.EnsureSystemPresetConfiguration(), nil
77+
return PostStartHookName, predefined.EnsurePredefinedConfiguration(), nil
7978
}
8079

81-
type SystemPresetData struct {
80+
type PredefinedData struct {
8281
FlowSchemas []*flowcontrolv1alpha1.FlowSchema
8382
PriorityLevelConfigurations []*flowcontrolv1alpha1.PriorityLevelConfiguration
8483
}
8584

86-
func (d SystemPresetData) EnsureSystemPresetConfiguration() genericapiserver.PostStartHookFunc {
85+
func (d PredefinedData) EnsurePredefinedConfiguration() genericapiserver.PostStartHookFunc {
8786
return func(hookContext genericapiserver.PostStartHookContext) error {
8887
flowcontrolClientSet := flowcontrolclient.NewForConfigOrDie(hookContext.LoopbackClientConfig)
8988
// Adding system priority classes is important. If they fail to add, many critical system

0 commit comments

Comments
 (0)