mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
matches specific usernames instead of "*"
This commit is contained in:
parent
ee31c93748
commit
812f13fbec
@ -159,7 +159,7 @@ var _ = SIGDescribe("API priority and fairness", func() {
|
|||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
framework.Logf("creating FlowSchema %q", flowSchemaName)
|
framework.Logf("creating FlowSchema %q", flowSchemaName)
|
||||||
_, cleanup = createFlowSchema(f, flowSchemaName, 1000, priorityLevelName, "*")
|
_, cleanup = createFlowSchema(f, flowSchemaName, 1000, priorityLevelName, "highqps", "lowqps")
|
||||||
defer cleanup()
|
defer cleanup()
|
||||||
|
|
||||||
type client struct {
|
type client struct {
|
||||||
@ -265,9 +265,9 @@ func getPriorityLevelConcurrency(f *framework.Framework, priorityLevelName strin
|
|||||||
|
|
||||||
// createFlowSchema creates a flow schema referring to a particular priority
|
// createFlowSchema creates a flow schema referring to a particular priority
|
||||||
// level and matching the username provided.
|
// level and matching the username provided.
|
||||||
func createFlowSchema(f *framework.Framework, flowSchemaName string, matchingPrecedence int32, priorityLevelName string, matchingUsername string) (*flowcontrol.FlowSchema, func()) {
|
func createFlowSchema(f *framework.Framework, flowSchemaName string, matchingPrecedence int32, priorityLevelName string, matchingUsernames ...string) (*flowcontrol.FlowSchema, func()) {
|
||||||
var subjects []flowcontrol.Subject
|
var subjects []flowcontrol.Subject
|
||||||
if matchingUsername == "*" {
|
if len(matchingUsernames) == 1 && matchingUsernames[0] == "*" {
|
||||||
subjects = append(subjects, flowcontrol.Subject{
|
subjects = append(subjects, flowcontrol.Subject{
|
||||||
Kind: flowcontrol.SubjectKindGroup,
|
Kind: flowcontrol.SubjectKindGroup,
|
||||||
Group: &flowcontrol.GroupSubject{
|
Group: &flowcontrol.GroupSubject{
|
||||||
@ -275,6 +275,7 @@ func createFlowSchema(f *framework.Framework, flowSchemaName string, matchingPre
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
for _, matchingUsername := range matchingUsernames {
|
||||||
subjects = append(subjects, flowcontrol.Subject{
|
subjects = append(subjects, flowcontrol.Subject{
|
||||||
Kind: flowcontrol.SubjectKindUser,
|
Kind: flowcontrol.SubjectKindUser,
|
||||||
User: &flowcontrol.UserSubject{
|
User: &flowcontrol.UserSubject{
|
||||||
@ -282,6 +283,7 @@ func createFlowSchema(f *framework.Framework, flowSchemaName string, matchingPre
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
createdFlowSchema, err := f.ClientSet.FlowcontrolV1beta1().FlowSchemas().Create(
|
createdFlowSchema, err := f.ClientSet.FlowcontrolV1beta1().FlowSchemas().Create(
|
||||||
context.TODO(),
|
context.TODO(),
|
||||||
|
Loading…
Reference in New Issue
Block a user