Skip to content

Commit d1f62ea

Browse files
yue9944882MikeSpreitzer
authored andcommitted
fork out a new global-default from catch-all to handle unclassified traffic
1 parent e92a7cf commit d1f62ea

File tree

1 file changed

+48
-13
lines changed
  • staging/src/k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap

1 file changed

+48
-13
lines changed

staging/src/k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap/default.go

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ var (
5959
// "workload-low" is used by those workloads with lower priority which availability only has a
6060
// minor impact on the cluster.
6161
SuggestedPriorityLevelConfigurationWorkloadLow,
62+
// "global-default" serves the rest traffic not handled by the other suggested flow-schemas above.
63+
SuggestedPriorityLevelConfigurationGlobalDefault,
6264
}
6365
SuggestedFlowSchemas = []*flowcontrol.FlowSchema{
6466
SuggestedFlowSchemaSystemNodes, // references "system" priority-level
@@ -68,6 +70,7 @@ var (
6870
SuggestedFlowSchemaKubeScheduler, // references "workload-high" priority-level
6971
SuggestedFlowSchemaKubeSystemServiceAccounts, // references "workload-high" priority-level
7072
SuggestedFlowSchemaServiceAccounts, // references "workload-low" priority-level
73+
SuggestedFlowSchemaGlobalDefault, // references "global-default" priority-level
7174
}
7275
)
7376

@@ -84,22 +87,18 @@ var (
8487
flowcontrol.PriorityLevelConfigurationSpec{
8588
Type: flowcontrol.PriorityLevelEnablementLimited,
8689
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
87-
AssuredConcurrencyShares: 100,
90+
AssuredConcurrencyShares: 1,
8891
LimitResponse: flowcontrol.LimitResponse{
89-
Type: flowcontrol.LimitResponseTypeQueue,
90-
Queuing: &flowcontrol.QueuingConfiguration{
91-
Queues: 128,
92-
HandSize: 6,
93-
QueueLengthLimit: 100,
94-
},
92+
Type: flowcontrol.LimitResponseTypeReject,
9593
},
9694
},
9795
})
9896
)
9997

10098
// Mandatory FlowSchema objects
10199
var (
102-
// exempt priority-level
100+
// "exempt" priority-level is used for preventing priority inversion and ensuring that sysadmin
101+
// requests are always possible.
103102
MandatoryFlowSchemaExempt = newFlowSchema(
104103
"exempt",
105104
flowcontrol.PriorityLevelConfigurationNameExempt,
@@ -124,7 +123,8 @@ var (
124123
},
125124
},
126125
)
127-
// catch-all priority-level
126+
// "catch-all" priority-level only gets a minimal positive share of concurrency and won't be reaching
127+
// ideally unless you intentionally deleted the suggested "global-default".
128128
MandatoryFlowSchemaCatchAll = newFlowSchema(
129129
"catch-all",
130130
"catch-all",
@@ -165,7 +165,7 @@ var (
165165
Queuing: &flowcontrol.QueuingConfiguration{
166166
Queues: 64,
167167
HandSize: 6,
168-
QueueLengthLimit: 1000,
168+
QueueLengthLimit: 50,
169169
},
170170
},
171171
},
@@ -182,7 +182,7 @@ var (
182182
Queuing: &flowcontrol.QueuingConfiguration{
183183
Queues: 16,
184184
HandSize: 4,
185-
QueueLengthLimit: 100,
185+
QueueLengthLimit: 50,
186186
},
187187
},
188188
},
@@ -199,7 +199,7 @@ var (
199199
Queuing: &flowcontrol.QueuingConfiguration{
200200
Queues: 128,
201201
HandSize: 6,
202-
QueueLengthLimit: 100,
202+
QueueLengthLimit: 50,
203203
},
204204
},
205205
},
@@ -216,7 +216,24 @@ var (
216216
Queuing: &flowcontrol.QueuingConfiguration{
217217
Queues: 128,
218218
HandSize: 6,
219-
QueueLengthLimit: 100,
219+
QueueLengthLimit: 50,
220+
},
221+
},
222+
},
223+
})
224+
// global-default priority-level
225+
SuggestedPriorityLevelConfigurationGlobalDefault = newPriorityLevelConfiguration(
226+
"global-default",
227+
flowcontrol.PriorityLevelConfigurationSpec{
228+
Type: flowcontrol.PriorityLevelEnablementLimited,
229+
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
230+
AssuredConcurrencyShares: 100,
231+
LimitResponse: flowcontrol.LimitResponse{
232+
Type: flowcontrol.LimitResponseTypeQueue,
233+
Queuing: &flowcontrol.QueuingConfiguration{
234+
Queues: 128,
235+
HandSize: 6,
236+
QueueLengthLimit: 50,
220237
},
221238
},
222239
},
@@ -359,6 +376,24 @@ var (
359376
},
360377
},
361378
)
379+
SuggestedFlowSchemaGlobalDefault = newFlowSchema(
380+
"global-default", "global-default", 9900,
381+
flowcontrol.FlowDistinguisherMethodByUserType,
382+
flowcontrol.PolicyRulesWithSubjects{
383+
Subjects: groups(serviceaccount.AllServiceAccountsGroup),
384+
ResourceRules: []flowcontrol.ResourcePolicyRule{resourceRule(
385+
[]string{flowcontrol.VerbAll},
386+
[]string{flowcontrol.APIGroupAll},
387+
[]string{flowcontrol.ResourceAll},
388+
[]string{flowcontrol.NamespaceEvery},
389+
true)},
390+
NonResourceRules: []flowcontrol.NonResourcePolicyRule{
391+
nonResourceRule(
392+
[]string{flowcontrol.VerbAll},
393+
[]string{flowcontrol.NonResourceAll}),
394+
},
395+
},
396+
)
362397
)
363398

364399
func newPriorityLevelConfiguration(name string, spec flowcontrol.PriorityLevelConfigurationSpec) *flowcontrol.PriorityLevelConfiguration {

0 commit comments

Comments
 (0)