diff --git a/api/openapi-spec/swagger.json b/api/openapi-spec/swagger.json index 2cf41eceba8..79945b8975f 100644 --- a/api/openapi-spec/swagger.json +++ b/api/openapi-spec/swagger.json @@ -10633,14 +10633,14 @@ "io.k8s.api.flowcontrol.v1beta3.LimitedPriorityLevelConfiguration": { "description": "LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. It addresses two issues:\n - How are requests for this priority level limited?\n - What should be done with requests that exceed the limit?", "properties": { - "assuredConcurrencyShares": { - "description": "`assuredConcurrencyShares` (ACS) configures the execution limit, which is a limit on the number of requests of this priority level that may be exeucting at a given time. ACS must be a positive number. The server's concurrency limit (SCL) is divided among the concurrency-controlled priority levels in proportion to their assured concurrency shares. This produces the assured concurrency value (ACV) --- the number of requests that may be executing at a time --- for each such priority level:\n\n ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) )\n\nbigger numbers of ACS mean more reserved concurrent requests (at the expense of every other PL). This field has a default value of 30.", - "format": "int32", - "type": "integer" - }, "limitResponse": { "$ref": "#/definitions/io.k8s.api.flowcontrol.v1beta3.LimitResponse", "description": "`limitResponse` indicates what to do with requests that can not be executed right now" + }, + "nominalConcurrencyShares": { + "description": "`nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats available at this priority level. This is used both for requests dispatched from this priority level as well as requests dispatched from other priority levels borrowing seats from this level. The server's concurrency limit (ServerCL) is divided among the Limited priority levels in proportion to their NCS values:\n\nNominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum[limited priority level k] NCS(k)\n\nBigger numbers mean a larger nominal concurrency limit, at the expense of every other Limited priority level. This field has a default value of 30.", + "format": "int32", + "type": "integer" } }, "type": "object" diff --git a/api/openapi-spec/v3/apis__flowcontrol.apiserver.k8s.io__v1beta3_openapi.json b/api/openapi-spec/v3/apis__flowcontrol.apiserver.k8s.io__v1beta3_openapi.json index 0b9e8697225..0718ef406c2 100644 --- a/api/openapi-spec/v3/apis__flowcontrol.apiserver.k8s.io__v1beta3_openapi.json +++ b/api/openapi-spec/v3/apis__flowcontrol.apiserver.k8s.io__v1beta3_openapi.json @@ -255,12 +255,6 @@ "io.k8s.api.flowcontrol.v1beta3.LimitedPriorityLevelConfiguration": { "description": "LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. It addresses two issues:\n - How are requests for this priority level limited?\n - What should be done with requests that exceed the limit?", "properties": { - "assuredConcurrencyShares": { - "default": 0, - "description": "`assuredConcurrencyShares` (ACS) configures the execution limit, which is a limit on the number of requests of this priority level that may be exeucting at a given time. ACS must be a positive number. The server's concurrency limit (SCL) is divided among the concurrency-controlled priority levels in proportion to their assured concurrency shares. This produces the assured concurrency value (ACV) --- the number of requests that may be executing at a time --- for each such priority level:\n\n ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) )\n\nbigger numbers of ACS mean more reserved concurrent requests (at the expense of every other PL). This field has a default value of 30.", - "format": "int32", - "type": "integer" - }, "limitResponse": { "allOf": [ { @@ -269,6 +263,12 @@ ], "default": {}, "description": "`limitResponse` indicates what to do with requests that can not be executed right now" + }, + "nominalConcurrencyShares": { + "default": 0, + "description": "`nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats available at this priority level. This is used both for requests dispatched from this priority level as well as requests dispatched from other priority levels borrowing seats from this level. The server's concurrency limit (ServerCL) is divided among the Limited priority levels in proportion to their NCS values:\n\nNominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum[limited priority level k] NCS(k)\n\nBigger numbers mean a larger nominal concurrency limit, at the expense of every other Limited priority level. This field has a default value of 30.", + "format": "int32", + "type": "integer" } }, "type": "object" diff --git a/pkg/apis/flowcontrol/types.go b/pkg/apis/flowcontrol/types.go index 9e28fa8e94b..51a1fa5d3cf 100644 --- a/pkg/apis/flowcontrol/types.go +++ b/pkg/apis/flowcontrol/types.go @@ -396,23 +396,23 @@ const ( // - How are requests for this priority level limited? // - What should be done with requests that exceed the limit? type LimitedPriorityLevelConfiguration struct { - // `assuredConcurrencyShares` (ACS) configures the execution - // limit, which is a limit on the number of requests of this - // priority level that may be executing at a given time. ACS must - // be a positive number. The server's concurrency limit (SCL) is - // divided among the concurrency-controlled priority levels in - // proportion to their assured concurrency shares. This produces - // the assured concurrency value (ACV) --- the number of requests - // that may be executing at a time --- for each such priority - // level: + // `nominalConcurrencyShares` (NCS) contributes to the computation of the + // NominalConcurrencyLimit (NominalCL) of this level. + // This is the number of execution seats available at this priority level. + // This is used both for requests dispatched from this priority level + // as well as requests dispatched from other priority levels + // borrowing seats from this level. + // The server's concurrency limit (ServerCL) is divided among the + // Limited priority levels in proportion to their NCS values: // - // ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) ) + // NominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) + // sum_ncs = sum[limited priority level k] NCS(k) // - // bigger numbers of ACS mean more reserved concurrent requests (at the - // expense of every other PL). + // Bigger numbers mean a larger nominal concurrency limit, + // at the expense of every other Limited priority level. // This field has a default value of 30. // +optional - AssuredConcurrencyShares int32 + NominalConcurrencyShares int32 // `limitResponse` indicates what to do with requests that can not be executed right now LimitResponse LimitResponse diff --git a/pkg/apis/flowcontrol/v1alpha1/conversion.go b/pkg/apis/flowcontrol/v1alpha1/conversion.go new file mode 100644 index 00000000000..8c6f644db02 --- /dev/null +++ b/pkg/apis/flowcontrol/v1alpha1/conversion.go @@ -0,0 +1,45 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "k8s.io/api/flowcontrol/v1alpha1" + "k8s.io/apimachinery/pkg/conversion" + "k8s.io/kubernetes/pkg/apis/flowcontrol" +) + +// LimitedPriorityLevelConfiguration.AssuredConcurrencyShares has been +// renamed to NominalConcurrencyShares in v1beta3. +func Convert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1alpha1.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error { + if err := autoConvert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in, out, nil); err != nil { + return err + } + + out.NominalConcurrencyShares = in.AssuredConcurrencyShares + return nil +} + +// LimitedPriorityLevelConfiguration.AssuredConcurrencyShares has been +// renamed to NominalConcurrencyShares in v1beta3. +func Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1alpha1.LimitedPriorityLevelConfiguration, s conversion.Scope) error { + if err := autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration(in, out, nil); err != nil { + return err + } + + out.AssuredConcurrencyShares = in.NominalConcurrencyShares + return nil +} diff --git a/pkg/apis/flowcontrol/v1alpha1/conversion_test.go b/pkg/apis/flowcontrol/v1alpha1/conversion_test.go new file mode 100644 index 00000000000..255c2339d07 --- /dev/null +++ b/pkg/apis/flowcontrol/v1alpha1/conversion_test.go @@ -0,0 +1,97 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "k8s.io/api/flowcontrol/v1alpha1" + "k8s.io/kubernetes/pkg/apis/flowcontrol" +) + +func TestConvert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(t *testing.T) { + tests := []struct { + name string + in *v1alpha1.LimitedPriorityLevelConfiguration + expected *flowcontrol.LimitedPriorityLevelConfiguration + }{ + { + name: "nominal concurrency shares is set as expected", + in: &v1alpha1.LimitedPriorityLevelConfiguration{ + AssuredConcurrencyShares: 100, + LimitResponse: v1alpha1.LimitResponse{ + Type: v1alpha1.LimitResponseTypeReject, + }, + }, + expected: &flowcontrol.LimitedPriorityLevelConfiguration{ + NominalConcurrencyShares: 100, + LimitResponse: flowcontrol.LimitResponse{ + Type: flowcontrol.LimitResponseTypeReject, + }, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + out := &flowcontrol.LimitedPriorityLevelConfiguration{} + if err := Convert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(test.in, out, nil); err != nil { + t.Errorf("Expected no error, but got: %v", err) + } + if !cmp.Equal(test.expected, out) { + t.Errorf("Expected a match, diff: %s", cmp.Diff(test.expected, out)) + } + }) + } +} + +func TestConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration(t *testing.T) { + tests := []struct { + name string + in *flowcontrol.LimitedPriorityLevelConfiguration + expected *v1alpha1.LimitedPriorityLevelConfiguration + }{ + { + name: "assured concurrency shares is set as expected", + in: &flowcontrol.LimitedPriorityLevelConfiguration{ + NominalConcurrencyShares: 100, + LimitResponse: flowcontrol.LimitResponse{ + Type: flowcontrol.LimitResponseTypeReject, + }, + }, + expected: &v1alpha1.LimitedPriorityLevelConfiguration{ + AssuredConcurrencyShares: 100, + LimitResponse: v1alpha1.LimitResponse{ + Type: v1alpha1.LimitResponseTypeReject, + }, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + out := &v1alpha1.LimitedPriorityLevelConfiguration{} + if err := Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration(test.in, out, nil); err != nil { + t.Errorf("Expected no error, but got: %v", err) + } + if !cmp.Equal(test.expected, out) { + t.Errorf("Expected a match, diff: %s", cmp.Diff(test.expected, out)) + } + }) + } +} diff --git a/pkg/apis/flowcontrol/v1alpha1/zz_generated.conversion.go b/pkg/apis/flowcontrol/v1alpha1/zz_generated.conversion.go index 93724931552..97a11746bb2 100644 --- a/pkg/apis/flowcontrol/v1alpha1/zz_generated.conversion.go +++ b/pkg/apis/flowcontrol/v1alpha1/zz_generated.conversion.go @@ -117,16 +117,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1alpha1.LimitedPriorityLevelConfiguration)(nil), (*flowcontrol.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(a.(*v1alpha1.LimitedPriorityLevelConfiguration), b.(*flowcontrol.LimitedPriorityLevelConfiguration), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*flowcontrol.LimitedPriorityLevelConfiguration)(nil), (*v1alpha1.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration(a.(*flowcontrol.LimitedPriorityLevelConfiguration), b.(*v1alpha1.LimitedPriorityLevelConfiguration), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*v1alpha1.NonResourcePolicyRule)(nil), (*flowcontrol.NonResourcePolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule(a.(*v1alpha1.NonResourcePolicyRule), b.(*flowcontrol.NonResourcePolicyRule), scope) }); err != nil { @@ -257,6 +247,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*flowcontrol.LimitedPriorityLevelConfiguration)(nil), (*v1alpha1.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration(a.(*flowcontrol.LimitedPriorityLevelConfiguration), b.(*v1alpha1.LimitedPriorityLevelConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1alpha1.LimitedPriorityLevelConfiguration)(nil), (*flowcontrol.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(a.(*v1alpha1.LimitedPriorityLevelConfiguration), b.(*flowcontrol.LimitedPriorityLevelConfiguration), scope) + }); err != nil { + return err + } return nil } @@ -455,31 +455,21 @@ func Convert_flowcontrol_LimitResponse_To_v1alpha1_LimitResponse(in *flowcontrol } func autoConvert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1alpha1.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - out.AssuredConcurrencyShares = in.AssuredConcurrencyShares + // WARNING: in.AssuredConcurrencyShares requires manual conversion: does not exist in peer-type if err := Convert_v1alpha1_LimitResponse_To_flowcontrol_LimitResponse(&in.LimitResponse, &out.LimitResponse, s); err != nil { return err } return nil } -// Convert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration is an autogenerated conversion function. -func Convert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1alpha1.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - return autoConvert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in, out, s) -} - func autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1alpha1.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - out.AssuredConcurrencyShares = in.AssuredConcurrencyShares + // WARNING: in.NominalConcurrencyShares requires manual conversion: does not exist in peer-type if err := Convert_flowcontrol_LimitResponse_To_v1alpha1_LimitResponse(&in.LimitResponse, &out.LimitResponse, s); err != nil { return err } return nil } -// Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration is an autogenerated conversion function. -func Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1alpha1.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - return autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration(in, out, s) -} - func autoConvert_v1alpha1_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule(in *v1alpha1.NonResourcePolicyRule, out *flowcontrol.NonResourcePolicyRule, s conversion.Scope) error { out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs)) out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs)) @@ -588,7 +578,17 @@ func Convert_flowcontrol_PriorityLevelConfigurationCondition_To_v1alpha1_Priorit func autoConvert_v1alpha1_PriorityLevelConfigurationList_To_flowcontrol_PriorityLevelConfigurationList(in *v1alpha1.PriorityLevelConfigurationList, out *flowcontrol.PriorityLevelConfigurationList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]flowcontrol.PriorityLevelConfiguration)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]flowcontrol.PriorityLevelConfiguration, len(*in)) + for i := range *in { + if err := Convert_v1alpha1_PriorityLevelConfiguration_To_flowcontrol_PriorityLevelConfiguration(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -599,7 +599,17 @@ func Convert_v1alpha1_PriorityLevelConfigurationList_To_flowcontrol_PriorityLeve func autoConvert_flowcontrol_PriorityLevelConfigurationList_To_v1alpha1_PriorityLevelConfigurationList(in *flowcontrol.PriorityLevelConfigurationList, out *v1alpha1.PriorityLevelConfigurationList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v1alpha1.PriorityLevelConfiguration)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1alpha1.PriorityLevelConfiguration, len(*in)) + for i := range *in { + if err := Convert_flowcontrol_PriorityLevelConfiguration_To_v1alpha1_PriorityLevelConfiguration(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -630,7 +640,15 @@ func Convert_flowcontrol_PriorityLevelConfigurationReference_To_v1alpha1_Priorit func autoConvert_v1alpha1_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevelConfigurationSpec(in *v1alpha1.PriorityLevelConfigurationSpec, out *flowcontrol.PriorityLevelConfigurationSpec, s conversion.Scope) error { out.Type = flowcontrol.PriorityLevelEnablement(in.Type) - out.Limited = (*flowcontrol.LimitedPriorityLevelConfiguration)(unsafe.Pointer(in.Limited)) + if in.Limited != nil { + in, out := &in.Limited, &out.Limited + *out = new(flowcontrol.LimitedPriorityLevelConfiguration) + if err := Convert_v1alpha1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.Limited = nil + } return nil } @@ -641,7 +659,15 @@ func Convert_v1alpha1_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLeve func autoConvert_flowcontrol_PriorityLevelConfigurationSpec_To_v1alpha1_PriorityLevelConfigurationSpec(in *flowcontrol.PriorityLevelConfigurationSpec, out *v1alpha1.PriorityLevelConfigurationSpec, s conversion.Scope) error { out.Type = v1alpha1.PriorityLevelEnablement(in.Type) - out.Limited = (*v1alpha1.LimitedPriorityLevelConfiguration)(unsafe.Pointer(in.Limited)) + if in.Limited != nil { + in, out := &in.Limited, &out.Limited + *out = new(v1alpha1.LimitedPriorityLevelConfiguration) + if err := Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1alpha1_LimitedPriorityLevelConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.Limited = nil + } return nil } diff --git a/pkg/apis/flowcontrol/v1beta1/conversion.go b/pkg/apis/flowcontrol/v1beta1/conversion.go new file mode 100644 index 00000000000..20a2b528b07 --- /dev/null +++ b/pkg/apis/flowcontrol/v1beta1/conversion.go @@ -0,0 +1,45 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "k8s.io/api/flowcontrol/v1beta1" + "k8s.io/apimachinery/pkg/conversion" + "k8s.io/kubernetes/pkg/apis/flowcontrol" +) + +// LimitedPriorityLevelConfiguration.AssuredConcurrencyShares has been +// renamed to NominalConcurrencyShares in v1beta3. +func Convert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1beta1.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error { + if err := autoConvert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in, out, nil); err != nil { + return err + } + + out.NominalConcurrencyShares = in.AssuredConcurrencyShares + return nil +} + +// LimitedPriorityLevelConfiguration.AssuredConcurrencyShares has been +// renamed to NominalConcurrencyShares in v1beta3. +func Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1beta1.LimitedPriorityLevelConfiguration, s conversion.Scope) error { + if err := autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(in, out, nil); err != nil { + return err + } + + out.AssuredConcurrencyShares = in.NominalConcurrencyShares + return nil +} diff --git a/pkg/apis/flowcontrol/v1beta1/conversion_test.go b/pkg/apis/flowcontrol/v1beta1/conversion_test.go new file mode 100644 index 00000000000..a51cbdcaeae --- /dev/null +++ b/pkg/apis/flowcontrol/v1beta1/conversion_test.go @@ -0,0 +1,97 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1 + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "k8s.io/api/flowcontrol/v1beta1" + "k8s.io/kubernetes/pkg/apis/flowcontrol" +) + +func TestConvert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(t *testing.T) { + tests := []struct { + name string + in *v1beta1.LimitedPriorityLevelConfiguration + expected *flowcontrol.LimitedPriorityLevelConfiguration + }{ + { + name: "nominal concurrency shares is set as expected", + in: &v1beta1.LimitedPriorityLevelConfiguration{ + AssuredConcurrencyShares: 100, + LimitResponse: v1beta1.LimitResponse{ + Type: v1beta1.LimitResponseTypeReject, + }, + }, + expected: &flowcontrol.LimitedPriorityLevelConfiguration{ + NominalConcurrencyShares: 100, + LimitResponse: flowcontrol.LimitResponse{ + Type: flowcontrol.LimitResponseTypeReject, + }, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + out := &flowcontrol.LimitedPriorityLevelConfiguration{} + if err := Convert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(test.in, out, nil); err != nil { + t.Errorf("Expected no error, but got: %v", err) + } + if !cmp.Equal(test.expected, out) { + t.Errorf("Expected a match, diff: %s", cmp.Diff(test.expected, out)) + } + }) + } +} + +func TestConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(t *testing.T) { + tests := []struct { + name string + in *flowcontrol.LimitedPriorityLevelConfiguration + expected *v1beta1.LimitedPriorityLevelConfiguration + }{ + { + name: "assured concurrency shares is set as expected", + in: &flowcontrol.LimitedPriorityLevelConfiguration{ + NominalConcurrencyShares: 100, + LimitResponse: flowcontrol.LimitResponse{ + Type: flowcontrol.LimitResponseTypeReject, + }, + }, + expected: &v1beta1.LimitedPriorityLevelConfiguration{ + AssuredConcurrencyShares: 100, + LimitResponse: v1beta1.LimitResponse{ + Type: v1beta1.LimitResponseTypeReject, + }, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + out := &v1beta1.LimitedPriorityLevelConfiguration{} + if err := Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(test.in, out, nil); err != nil { + t.Errorf("Expected no error, but got: %v", err) + } + if !cmp.Equal(test.expected, out) { + t.Errorf("Expected a match, diff: %s", cmp.Diff(test.expected, out)) + } + }) + } +} diff --git a/pkg/apis/flowcontrol/v1beta1/zz_generated.conversion.go b/pkg/apis/flowcontrol/v1beta1/zz_generated.conversion.go index 86b66135d29..35eaa05fe1a 100644 --- a/pkg/apis/flowcontrol/v1beta1/zz_generated.conversion.go +++ b/pkg/apis/flowcontrol/v1beta1/zz_generated.conversion.go @@ -117,16 +117,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta1.LimitedPriorityLevelConfiguration)(nil), (*flowcontrol.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(a.(*v1beta1.LimitedPriorityLevelConfiguration), b.(*flowcontrol.LimitedPriorityLevelConfiguration), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*flowcontrol.LimitedPriorityLevelConfiguration)(nil), (*v1beta1.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(a.(*flowcontrol.LimitedPriorityLevelConfiguration), b.(*v1beta1.LimitedPriorityLevelConfiguration), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*v1beta1.NonResourcePolicyRule)(nil), (*flowcontrol.NonResourcePolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta1_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule(a.(*v1beta1.NonResourcePolicyRule), b.(*flowcontrol.NonResourcePolicyRule), scope) }); err != nil { @@ -257,6 +247,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*flowcontrol.LimitedPriorityLevelConfiguration)(nil), (*v1beta1.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(a.(*flowcontrol.LimitedPriorityLevelConfiguration), b.(*v1beta1.LimitedPriorityLevelConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta1.LimitedPriorityLevelConfiguration)(nil), (*flowcontrol.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(a.(*v1beta1.LimitedPriorityLevelConfiguration), b.(*flowcontrol.LimitedPriorityLevelConfiguration), scope) + }); err != nil { + return err + } return nil } @@ -455,31 +455,21 @@ func Convert_flowcontrol_LimitResponse_To_v1beta1_LimitResponse(in *flowcontrol. } func autoConvert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1beta1.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - out.AssuredConcurrencyShares = in.AssuredConcurrencyShares + // WARNING: in.AssuredConcurrencyShares requires manual conversion: does not exist in peer-type if err := Convert_v1beta1_LimitResponse_To_flowcontrol_LimitResponse(&in.LimitResponse, &out.LimitResponse, s); err != nil { return err } return nil } -// Convert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration is an autogenerated conversion function. -func Convert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1beta1.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - return autoConvert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in, out, s) -} - func autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1beta1.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - out.AssuredConcurrencyShares = in.AssuredConcurrencyShares + // WARNING: in.NominalConcurrencyShares requires manual conversion: does not exist in peer-type if err := Convert_flowcontrol_LimitResponse_To_v1beta1_LimitResponse(&in.LimitResponse, &out.LimitResponse, s); err != nil { return err } return nil } -// Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration is an autogenerated conversion function. -func Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1beta1.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - return autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(in, out, s) -} - func autoConvert_v1beta1_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule(in *v1beta1.NonResourcePolicyRule, out *flowcontrol.NonResourcePolicyRule, s conversion.Scope) error { out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs)) out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs)) @@ -588,7 +578,17 @@ func Convert_flowcontrol_PriorityLevelConfigurationCondition_To_v1beta1_Priority func autoConvert_v1beta1_PriorityLevelConfigurationList_To_flowcontrol_PriorityLevelConfigurationList(in *v1beta1.PriorityLevelConfigurationList, out *flowcontrol.PriorityLevelConfigurationList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]flowcontrol.PriorityLevelConfiguration)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]flowcontrol.PriorityLevelConfiguration, len(*in)) + for i := range *in { + if err := Convert_v1beta1_PriorityLevelConfiguration_To_flowcontrol_PriorityLevelConfiguration(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -599,7 +599,17 @@ func Convert_v1beta1_PriorityLevelConfigurationList_To_flowcontrol_PriorityLevel func autoConvert_flowcontrol_PriorityLevelConfigurationList_To_v1beta1_PriorityLevelConfigurationList(in *flowcontrol.PriorityLevelConfigurationList, out *v1beta1.PriorityLevelConfigurationList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v1beta1.PriorityLevelConfiguration)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta1.PriorityLevelConfiguration, len(*in)) + for i := range *in { + if err := Convert_flowcontrol_PriorityLevelConfiguration_To_v1beta1_PriorityLevelConfiguration(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -630,7 +640,15 @@ func Convert_flowcontrol_PriorityLevelConfigurationReference_To_v1beta1_Priority func autoConvert_v1beta1_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevelConfigurationSpec(in *v1beta1.PriorityLevelConfigurationSpec, out *flowcontrol.PriorityLevelConfigurationSpec, s conversion.Scope) error { out.Type = flowcontrol.PriorityLevelEnablement(in.Type) - out.Limited = (*flowcontrol.LimitedPriorityLevelConfiguration)(unsafe.Pointer(in.Limited)) + if in.Limited != nil { + in, out := &in.Limited, &out.Limited + *out = new(flowcontrol.LimitedPriorityLevelConfiguration) + if err := Convert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.Limited = nil + } return nil } @@ -641,7 +659,15 @@ func Convert_v1beta1_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevel func autoConvert_flowcontrol_PriorityLevelConfigurationSpec_To_v1beta1_PriorityLevelConfigurationSpec(in *flowcontrol.PriorityLevelConfigurationSpec, out *v1beta1.PriorityLevelConfigurationSpec, s conversion.Scope) error { out.Type = v1beta1.PriorityLevelEnablement(in.Type) - out.Limited = (*v1beta1.LimitedPriorityLevelConfiguration)(unsafe.Pointer(in.Limited)) + if in.Limited != nil { + in, out := &in.Limited, &out.Limited + *out = new(v1beta1.LimitedPriorityLevelConfiguration) + if err := Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.Limited = nil + } return nil } diff --git a/pkg/apis/flowcontrol/v1beta2/conversion.go b/pkg/apis/flowcontrol/v1beta2/conversion.go new file mode 100644 index 00000000000..9c9c9e15eb1 --- /dev/null +++ b/pkg/apis/flowcontrol/v1beta2/conversion.go @@ -0,0 +1,45 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + "k8s.io/api/flowcontrol/v1beta2" + "k8s.io/apimachinery/pkg/conversion" + "k8s.io/kubernetes/pkg/apis/flowcontrol" +) + +// LimitedPriorityLevelConfiguration.AssuredConcurrencyShares has been +// renamed to NominalConcurrencyShares in v1beta3. +func Convert_v1beta2_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1beta2.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error { + if err := autoConvert_v1beta2_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in, out, nil); err != nil { + return err + } + + out.NominalConcurrencyShares = in.AssuredConcurrencyShares + return nil +} + +// LimitedPriorityLevelConfiguration.AssuredConcurrencyShares has been +// renamed to NominalConcurrencyShares in v1beta3. +func Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta2_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1beta2.LimitedPriorityLevelConfiguration, s conversion.Scope) error { + if err := autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta2_LimitedPriorityLevelConfiguration(in, out, nil); err != nil { + return err + } + + out.AssuredConcurrencyShares = in.NominalConcurrencyShares + return nil +} diff --git a/pkg/apis/flowcontrol/v1beta2/conversion_test.go b/pkg/apis/flowcontrol/v1beta2/conversion_test.go new file mode 100644 index 00000000000..142eef8c831 --- /dev/null +++ b/pkg/apis/flowcontrol/v1beta2/conversion_test.go @@ -0,0 +1,97 @@ +/* +Copyright 2022 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + "testing" + + "github.com/google/go-cmp/cmp" + "k8s.io/api/flowcontrol/v1beta2" + "k8s.io/kubernetes/pkg/apis/flowcontrol" +) + +func TestConvert_v1beta2_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(t *testing.T) { + tests := []struct { + name string + in *v1beta2.LimitedPriorityLevelConfiguration + expected *flowcontrol.LimitedPriorityLevelConfiguration + }{ + { + name: "nominal concurrency shares is set as expected", + in: &v1beta2.LimitedPriorityLevelConfiguration{ + AssuredConcurrencyShares: 100, + LimitResponse: v1beta2.LimitResponse{ + Type: v1beta2.LimitResponseTypeReject, + }, + }, + expected: &flowcontrol.LimitedPriorityLevelConfiguration{ + NominalConcurrencyShares: 100, + LimitResponse: flowcontrol.LimitResponse{ + Type: flowcontrol.LimitResponseTypeReject, + }, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + out := &flowcontrol.LimitedPriorityLevelConfiguration{} + if err := Convert_v1beta2_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(test.in, out, nil); err != nil { + t.Errorf("Expected no error, but got: %v", err) + } + if !cmp.Equal(test.expected, out) { + t.Errorf("Expected a match, diff: %s", cmp.Diff(test.expected, out)) + } + }) + } +} + +func TestConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta2_LimitedPriorityLevelConfiguration(t *testing.T) { + tests := []struct { + name string + in *flowcontrol.LimitedPriorityLevelConfiguration + expected *v1beta2.LimitedPriorityLevelConfiguration + }{ + { + name: "assured concurrency shares is set as expected", + in: &flowcontrol.LimitedPriorityLevelConfiguration{ + NominalConcurrencyShares: 100, + LimitResponse: flowcontrol.LimitResponse{ + Type: flowcontrol.LimitResponseTypeReject, + }, + }, + expected: &v1beta2.LimitedPriorityLevelConfiguration{ + AssuredConcurrencyShares: 100, + LimitResponse: v1beta2.LimitResponse{ + Type: v1beta2.LimitResponseTypeReject, + }, + }, + }, + } + + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + out := &v1beta2.LimitedPriorityLevelConfiguration{} + if err := Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta2_LimitedPriorityLevelConfiguration(test.in, out, nil); err != nil { + t.Errorf("Expected no error, but got: %v", err) + } + if !cmp.Equal(test.expected, out) { + t.Errorf("Expected a match, diff: %s", cmp.Diff(test.expected, out)) + } + }) + } +} diff --git a/pkg/apis/flowcontrol/v1beta2/zz_generated.conversion.go b/pkg/apis/flowcontrol/v1beta2/zz_generated.conversion.go index 2ca6d462773..572750746e2 100644 --- a/pkg/apis/flowcontrol/v1beta2/zz_generated.conversion.go +++ b/pkg/apis/flowcontrol/v1beta2/zz_generated.conversion.go @@ -117,16 +117,6 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } - if err := s.AddGeneratedConversionFunc((*v1beta2.LimitedPriorityLevelConfiguration)(nil), (*flowcontrol.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_v1beta2_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(a.(*v1beta2.LimitedPriorityLevelConfiguration), b.(*flowcontrol.LimitedPriorityLevelConfiguration), scope) - }); err != nil { - return err - } - if err := s.AddGeneratedConversionFunc((*flowcontrol.LimitedPriorityLevelConfiguration)(nil), (*v1beta2.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { - return Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta2_LimitedPriorityLevelConfiguration(a.(*flowcontrol.LimitedPriorityLevelConfiguration), b.(*v1beta2.LimitedPriorityLevelConfiguration), scope) - }); err != nil { - return err - } if err := s.AddGeneratedConversionFunc((*v1beta2.NonResourcePolicyRule)(nil), (*flowcontrol.NonResourcePolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1beta2_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule(a.(*v1beta2.NonResourcePolicyRule), b.(*flowcontrol.NonResourcePolicyRule), scope) }); err != nil { @@ -257,6 +247,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddConversionFunc((*flowcontrol.LimitedPriorityLevelConfiguration)(nil), (*v1beta2.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta2_LimitedPriorityLevelConfiguration(a.(*flowcontrol.LimitedPriorityLevelConfiguration), b.(*v1beta2.LimitedPriorityLevelConfiguration), scope) + }); err != nil { + return err + } + if err := s.AddConversionFunc((*v1beta2.LimitedPriorityLevelConfiguration)(nil), (*flowcontrol.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1beta2_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(a.(*v1beta2.LimitedPriorityLevelConfiguration), b.(*flowcontrol.LimitedPriorityLevelConfiguration), scope) + }); err != nil { + return err + } return nil } @@ -455,31 +455,21 @@ func Convert_flowcontrol_LimitResponse_To_v1beta2_LimitResponse(in *flowcontrol. } func autoConvert_v1beta2_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1beta2.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - out.AssuredConcurrencyShares = in.AssuredConcurrencyShares + // WARNING: in.AssuredConcurrencyShares requires manual conversion: does not exist in peer-type if err := Convert_v1beta2_LimitResponse_To_flowcontrol_LimitResponse(&in.LimitResponse, &out.LimitResponse, s); err != nil { return err } return nil } -// Convert_v1beta2_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration is an autogenerated conversion function. -func Convert_v1beta2_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1beta2.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - return autoConvert_v1beta2_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in, out, s) -} - func autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta2_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1beta2.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - out.AssuredConcurrencyShares = in.AssuredConcurrencyShares + // WARNING: in.NominalConcurrencyShares requires manual conversion: does not exist in peer-type if err := Convert_flowcontrol_LimitResponse_To_v1beta2_LimitResponse(&in.LimitResponse, &out.LimitResponse, s); err != nil { return err } return nil } -// Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta2_LimitedPriorityLevelConfiguration is an autogenerated conversion function. -func Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta2_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1beta2.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - return autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta2_LimitedPriorityLevelConfiguration(in, out, s) -} - func autoConvert_v1beta2_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule(in *v1beta2.NonResourcePolicyRule, out *flowcontrol.NonResourcePolicyRule, s conversion.Scope) error { out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs)) out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs)) @@ -588,7 +578,17 @@ func Convert_flowcontrol_PriorityLevelConfigurationCondition_To_v1beta2_Priority func autoConvert_v1beta2_PriorityLevelConfigurationList_To_flowcontrol_PriorityLevelConfigurationList(in *v1beta2.PriorityLevelConfigurationList, out *flowcontrol.PriorityLevelConfigurationList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]flowcontrol.PriorityLevelConfiguration)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]flowcontrol.PriorityLevelConfiguration, len(*in)) + for i := range *in { + if err := Convert_v1beta2_PriorityLevelConfiguration_To_flowcontrol_PriorityLevelConfiguration(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -599,7 +599,17 @@ func Convert_v1beta2_PriorityLevelConfigurationList_To_flowcontrol_PriorityLevel func autoConvert_flowcontrol_PriorityLevelConfigurationList_To_v1beta2_PriorityLevelConfigurationList(in *flowcontrol.PriorityLevelConfigurationList, out *v1beta2.PriorityLevelConfigurationList, s conversion.Scope) error { out.ListMeta = in.ListMeta - out.Items = *(*[]v1beta2.PriorityLevelConfiguration)(unsafe.Pointer(&in.Items)) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]v1beta2.PriorityLevelConfiguration, len(*in)) + for i := range *in { + if err := Convert_flowcontrol_PriorityLevelConfiguration_To_v1beta2_PriorityLevelConfiguration(&(*in)[i], &(*out)[i], s); err != nil { + return err + } + } + } else { + out.Items = nil + } return nil } @@ -630,7 +640,15 @@ func Convert_flowcontrol_PriorityLevelConfigurationReference_To_v1beta2_Priority func autoConvert_v1beta2_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevelConfigurationSpec(in *v1beta2.PriorityLevelConfigurationSpec, out *flowcontrol.PriorityLevelConfigurationSpec, s conversion.Scope) error { out.Type = flowcontrol.PriorityLevelEnablement(in.Type) - out.Limited = (*flowcontrol.LimitedPriorityLevelConfiguration)(unsafe.Pointer(in.Limited)) + if in.Limited != nil { + in, out := &in.Limited, &out.Limited + *out = new(flowcontrol.LimitedPriorityLevelConfiguration) + if err := Convert_v1beta2_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.Limited = nil + } return nil } @@ -641,7 +659,15 @@ func Convert_v1beta2_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevel func autoConvert_flowcontrol_PriorityLevelConfigurationSpec_To_v1beta2_PriorityLevelConfigurationSpec(in *flowcontrol.PriorityLevelConfigurationSpec, out *v1beta2.PriorityLevelConfigurationSpec, s conversion.Scope) error { out.Type = v1beta2.PriorityLevelEnablement(in.Type) - out.Limited = (*v1beta2.LimitedPriorityLevelConfiguration)(unsafe.Pointer(in.Limited)) + if in.Limited != nil { + in, out := &in.Limited, &out.Limited + *out = new(v1beta2.LimitedPriorityLevelConfiguration) + if err := Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta2_LimitedPriorityLevelConfiguration(*in, *out, s); err != nil { + return err + } + } else { + out.Limited = nil + } return nil } diff --git a/pkg/apis/flowcontrol/v1beta3/defaults.go b/pkg/apis/flowcontrol/v1beta3/defaults.go index 8c1833c64e9..77580145bc3 100644 --- a/pkg/apis/flowcontrol/v1beta3/defaults.go +++ b/pkg/apis/flowcontrol/v1beta3/defaults.go @@ -30,7 +30,7 @@ const ( PriorityLevelConfigurationDefaultHandSize int32 = 8 PriorityLevelConfigurationDefaultQueues int32 = 64 PriorityLevelConfigurationDefaultQueueLengthLimit int32 = 50 - PriorityLevelConfigurationDefaultAssuredConcurrencyShares int32 = 30 + PriorityLevelConfigurationDefaultNominalConcurrencyShares int32 = 30 ) // SetDefaults_FlowSchema sets default values for flow schema @@ -41,8 +41,8 @@ func SetDefaults_FlowSchemaSpec(spec *v1beta3.FlowSchemaSpec) { } func SetDefaults_LimitedPriorityLevelConfiguration(lplc *v1beta3.LimitedPriorityLevelConfiguration) { - if lplc.AssuredConcurrencyShares == 0 { - lplc.AssuredConcurrencyShares = PriorityLevelConfigurationDefaultAssuredConcurrencyShares + if lplc.NominalConcurrencyShares == 0 { + lplc.NominalConcurrencyShares = PriorityLevelConfigurationDefaultNominalConcurrencyShares } } diff --git a/pkg/apis/flowcontrol/v1beta3/zz_generated.conversion.go b/pkg/apis/flowcontrol/v1beta3/zz_generated.conversion.go index e6f410bceb2..0728ae34df2 100644 --- a/pkg/apis/flowcontrol/v1beta3/zz_generated.conversion.go +++ b/pkg/apis/flowcontrol/v1beta3/zz_generated.conversion.go @@ -455,7 +455,7 @@ func Convert_flowcontrol_LimitResponse_To_v1beta3_LimitResponse(in *flowcontrol. } func autoConvert_v1beta3_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1beta3.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - out.AssuredConcurrencyShares = in.AssuredConcurrencyShares + out.NominalConcurrencyShares = in.NominalConcurrencyShares if err := Convert_v1beta3_LimitResponse_To_flowcontrol_LimitResponse(&in.LimitResponse, &out.LimitResponse, s); err != nil { return err } @@ -468,7 +468,7 @@ func Convert_v1beta3_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPri } func autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta3_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1beta3.LimitedPriorityLevelConfiguration, s conversion.Scope) error { - out.AssuredConcurrencyShares = in.AssuredConcurrencyShares + out.NominalConcurrencyShares = in.NominalConcurrencyShares if err := Convert_flowcontrol_LimitResponse_To_v1beta3_LimitResponse(&in.LimitResponse, &out.LimitResponse, s); err != nil { return err } diff --git a/pkg/apis/flowcontrol/validation/validation.go b/pkg/apis/flowcontrol/validation/validation.go index 5f6aa7f73d0..bb88eb3409a 100644 --- a/pkg/apis/flowcontrol/validation/validation.go +++ b/pkg/apis/flowcontrol/validation/validation.go @@ -20,8 +20,12 @@ import ( "fmt" "strings" + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" apiequality "k8s.io/apimachinery/pkg/api/equality" apimachineryvalidation "k8s.io/apimachinery/pkg/api/validation" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/apiserver/pkg/util/shufflesharding" @@ -337,10 +341,10 @@ func ValidateFlowSchemaCondition(condition *flowcontrol.FlowSchemaCondition, fld } // ValidatePriorityLevelConfiguration validates priority-level-configuration. -func ValidatePriorityLevelConfiguration(pl *flowcontrol.PriorityLevelConfiguration) field.ErrorList { +func ValidatePriorityLevelConfiguration(pl *flowcontrol.PriorityLevelConfiguration, requestGV schema.GroupVersion) field.ErrorList { allErrs := apivalidation.ValidateObjectMeta(&pl.ObjectMeta, false, ValidatePriorityLevelConfigurationName, field.NewPath("metadata")) specPath := field.NewPath("spec") - allErrs = append(allErrs, ValidatePriorityLevelConfigurationSpec(&pl.Spec, pl.Name, specPath)...) + allErrs = append(allErrs, ValidatePriorityLevelConfigurationSpec(&pl.Spec, requestGV, pl.Name, specPath)...) if mand, ok := internalbootstrap.MandatoryPriorityLevelConfigurations[pl.Name]; ok { // Check for almost exact equality. This is a pretty // strict test, and it is OK in this context because both @@ -354,13 +358,8 @@ func ValidatePriorityLevelConfiguration(pl *flowcontrol.PriorityLevelConfigurati return allErrs } -// ValidatePriorityLevelConfigurationUpdate validates the update of priority-level-configuration. -func ValidatePriorityLevelConfigurationUpdate(old, pl *flowcontrol.PriorityLevelConfiguration) field.ErrorList { - return ValidatePriorityLevelConfiguration(pl) -} - // ValidatePriorityLevelConfigurationSpec validates priority-level-configuration's spec. -func ValidatePriorityLevelConfigurationSpec(spec *flowcontrol.PriorityLevelConfigurationSpec, name string, fldPath *field.Path) field.ErrorList { +func ValidatePriorityLevelConfigurationSpec(spec *flowcontrol.PriorityLevelConfigurationSpec, requestGV schema.GroupVersion, name string, fldPath *field.Path) field.ErrorList { var allErrs field.ErrorList if (name == flowcontrol.PriorityLevelConfigurationNameExempt) != (spec.Type == flowcontrol.PriorityLevelEnablementExempt) { allErrs = append(allErrs, field.Invalid(fldPath.Child("type"), spec.Type, "type must be 'Exempt' if and only if name is 'exempt'")) @@ -374,7 +373,7 @@ func ValidatePriorityLevelConfigurationSpec(spec *flowcontrol.PriorityLevelConfi if spec.Limited == nil { allErrs = append(allErrs, field.Required(fldPath.Child("limited"), "must not be empty when type is Limited")) } else { - allErrs = append(allErrs, ValidateLimitedPriorityLevelConfiguration(spec.Limited, fldPath.Child("limited"))...) + allErrs = append(allErrs, ValidateLimitedPriorityLevelConfiguration(spec.Limited, requestGV, fldPath.Child("limited"))...) } default: allErrs = append(allErrs, field.NotSupported(fldPath.Child("type"), spec.Type, supportedPriorityLevelEnablement.List())) @@ -383,15 +382,26 @@ func ValidatePriorityLevelConfigurationSpec(spec *flowcontrol.PriorityLevelConfi } // ValidateLimitedPriorityLevelConfiguration validates the configuration for an execution-limited priority level -func ValidateLimitedPriorityLevelConfiguration(lplc *flowcontrol.LimitedPriorityLevelConfiguration, fldPath *field.Path) field.ErrorList { +func ValidateLimitedPriorityLevelConfiguration(lplc *flowcontrol.LimitedPriorityLevelConfiguration, requestGV schema.GroupVersion, fldPath *field.Path) field.ErrorList { var allErrs field.ErrorList - if lplc.AssuredConcurrencyShares <= 0 { - allErrs = append(allErrs, field.Invalid(fldPath.Child("assuredConcurrencyShares"), lplc.AssuredConcurrencyShares, "must be positive")) + if lplc.NominalConcurrencyShares <= 0 { + allErrs = append(allErrs, field.Invalid(fldPath.Child(getVersionedFieldNameForConcurrencyShares(requestGV)), lplc.NominalConcurrencyShares, "must be positive")) } allErrs = append(allErrs, ValidateLimitResponse(lplc.LimitResponse, fldPath.Child("limitResponse"))...) return allErrs } +func getVersionedFieldNameForConcurrencyShares(requestGV schema.GroupVersion) string { + switch { + case requestGV == flowcontrolv1alpha1.SchemeGroupVersion || + requestGV == flowcontrolv1beta1.SchemeGroupVersion || + requestGV == flowcontrolv1beta2.SchemeGroupVersion: + return "assuredConcurrencyShares" + default: + return "nominalConcurrencyShares" + } +} + // ValidateLimitResponse validates a LimitResponse func ValidateLimitResponse(lr flowcontrol.LimitResponse, fldPath *field.Path) field.ErrorList { var allErrs field.ErrorList diff --git a/pkg/apis/flowcontrol/validation/validation_test.go b/pkg/apis/flowcontrol/validation/validation_test.go index cd67b1870ae..559a7e050b7 100644 --- a/pkg/apis/flowcontrol/validation/validation_test.go +++ b/pkg/apis/flowcontrol/validation/validation_test.go @@ -22,7 +22,12 @@ import ( "github.com/google/go-cmp/cmp" "github.com/stretchr/testify/assert" + flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1" + flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1" + flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2" + flowcontrolv1beta3 "k8s.io/api/flowcontrol/v1beta3" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/validation/field" "k8s.io/apiserver/pkg/authentication/user" "k8s.io/kubernetes/pkg/apis/flowcontrol" @@ -910,7 +915,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { badSpec := flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 42, + NominalConcurrencyShares: 42, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeReject}, }, @@ -966,7 +971,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 42, + NominalConcurrencyShares: 42, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeReject}, }, @@ -983,7 +988,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 100, + NominalConcurrencyShares: 100, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeReject, Queuing: &flowcontrol.QueuingConfiguration{ @@ -1013,7 +1018,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 5, + NominalConcurrencyShares: 5, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeReject, }}}, @@ -1029,7 +1034,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 100, + NominalConcurrencyShares: 100, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, }}}, @@ -1045,7 +1050,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 100, + NominalConcurrencyShares: 100, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -1065,7 +1070,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 100, + NominalConcurrencyShares: 100, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -1087,7 +1092,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 100, + NominalConcurrencyShares: 100, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -1109,7 +1114,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 100, + NominalConcurrencyShares: 100, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -1132,7 +1137,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 100, + NominalConcurrencyShares: 100, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -1152,7 +1157,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 100, + NominalConcurrencyShares: 100, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -1168,7 +1173,7 @@ func TestPriorityLevelConfigurationValidation(t *testing.T) { } for _, testCase := range testCases { t.Run(testCase.name, func(t *testing.T) { - errs := ValidatePriorityLevelConfiguration(testCase.priorityLevelConfiguration) + errs := ValidatePriorityLevelConfiguration(testCase.priorityLevelConfiguration, flowcontrolv1beta3.SchemeGroupVersion) if !assert.ElementsMatch(t, testCase.expectedErrors, errs) { t.Logf("mismatch: %v", cmp.Diff(testCase.expectedErrors, errs)) } @@ -1358,3 +1363,74 @@ func TestValidateNonResourceURLPath(t *testing.T) { }) } } + +func TestValidateLimitedPriorityLevelConfiguration(t *testing.T) { + errExpectedFn := func(fieldName string) field.ErrorList { + return field.ErrorList{ + field.Invalid(field.NewPath("spec").Child("limited").Child(fieldName), int32(0), "must be positive"), + } + } + + tests := []struct { + requestVersion schema.GroupVersion + concurrencyShares int32 + errExpected field.ErrorList + }{ + { + requestVersion: flowcontrolv1alpha1.SchemeGroupVersion, + concurrencyShares: 0, + errExpected: errExpectedFn("assuredConcurrencyShares"), + }, + { + requestVersion: flowcontrolv1beta1.SchemeGroupVersion, + concurrencyShares: 0, + errExpected: errExpectedFn("assuredConcurrencyShares"), + }, + { + requestVersion: flowcontrolv1beta2.SchemeGroupVersion, + concurrencyShares: 0, + errExpected: errExpectedFn("assuredConcurrencyShares"), + }, + { + requestVersion: flowcontrolv1beta3.SchemeGroupVersion, + concurrencyShares: 0, + errExpected: errExpectedFn("nominalConcurrencyShares"), + }, + { + // let's simulate a post v1beta3 version, we expect the + // error to return the new field introduced in v1beta3. + requestVersion: schema.GroupVersion{Group: flowcontrolv1beta3.GroupName, Version: "v1"}, + concurrencyShares: 0, + errExpected: errExpectedFn("nominalConcurrencyShares"), + }, + { + // this should never really happen in real life, the request + // context should always contain the request {group, version} + requestVersion: schema.GroupVersion{}, + concurrencyShares: 0, + errExpected: errExpectedFn("nominalConcurrencyShares"), + }, + { + requestVersion: flowcontrolv1beta3.SchemeGroupVersion, + concurrencyShares: 100, + errExpected: nil, + }, + } + + for _, test := range tests { + t.Run(test.requestVersion.String(), func(t *testing.T) { + configuration := &flowcontrol.LimitedPriorityLevelConfiguration{ + NominalConcurrencyShares: test.concurrencyShares, + LimitResponse: flowcontrol.LimitResponse{ + Type: flowcontrol.LimitResponseTypeReject, + }, + } + specPath := field.NewPath("spec").Child("limited") + + errGot := ValidateLimitedPriorityLevelConfiguration(configuration, test.requestVersion, specPath) + if !cmp.Equal(test.errExpected, errGot) { + t.Errorf("Expected error: %v, diff: %s", test.errExpected, cmp.Diff(test.errExpected, errGot)) + } + }) + } +} diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/pkg/generated/openapi/zz_generated.openapi.go index 634d00aa070..788ea3205b5 100644 --- a/pkg/generated/openapi/zz_generated.openapi.go +++ b/pkg/generated/openapi/zz_generated.openapi.go @@ -33599,9 +33599,9 @@ func schema_k8sio_api_flowcontrol_v1beta3_LimitedPriorityLevelConfiguration(ref Description: "LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. It addresses two issues:\n - How are requests for this priority level limited?\n - What should be done with requests that exceed the limit?", Type: []string{"object"}, Properties: map[string]spec.Schema{ - "assuredConcurrencyShares": { + "nominalConcurrencyShares": { SchemaProps: spec.SchemaProps{ - Description: "`assuredConcurrencyShares` (ACS) configures the execution limit, which is a limit on the number of requests of this priority level that may be exeucting at a given time. ACS must be a positive number. The server's concurrency limit (SCL) is divided among the concurrency-controlled priority levels in proportion to their assured concurrency shares. This produces the assured concurrency value (ACV) --- the number of requests that may be executing at a time --- for each such priority level:\n\n ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) )\n\nbigger numbers of ACS mean more reserved concurrent requests (at the expense of every other PL). This field has a default value of 30.", + Description: "`nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats available at this priority level. This is used both for requests dispatched from this priority level as well as requests dispatched from other priority levels borrowing seats from this level. The server's concurrency limit (ServerCL) is divided among the Limited priority levels in proportion to their NCS values:\n\nNominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum[limited priority level k] NCS(k)\n\nBigger numbers mean a larger nominal concurrency limit, at the expense of every other Limited priority level. This field has a default value of 30.", Default: 0, Type: []string{"integer"}, Format: "int32", diff --git a/pkg/printers/internalversion/printers.go b/pkg/printers/internalversion/printers.go index 65ea1e7d4b6..7a5bfe0af01 100644 --- a/pkg/printers/internalversion/printers.go +++ b/pkg/printers/internalversion/printers.go @@ -567,7 +567,7 @@ func AddHandlers(h printers.PrintHandler) { priorityLevelColumnDefinitions := []metav1.TableColumnDefinition{ {Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]}, {Name: "Type", Type: "string", Description: flowcontrolv1beta3.PriorityLevelConfigurationSpec{}.SwaggerDoc()["type"]}, - {Name: "AssuredConcurrencyShares", Type: "string", Description: flowcontrolv1beta3.LimitedPriorityLevelConfiguration{}.SwaggerDoc()["assuredConcurrencyShares"]}, + {Name: "NominalConcurrencyShares", Type: "string", Description: flowcontrolv1beta3.LimitedPriorityLevelConfiguration{}.SwaggerDoc()["nominalConcurrencyShares"]}, {Name: "Queues", Type: "string", Description: flowcontrolv1beta3.QueuingConfiguration{}.SwaggerDoc()["queues"]}, {Name: "HandSize", Type: "string", Description: flowcontrolv1beta3.QueuingConfiguration{}.SwaggerDoc()["handSize"]}, {Name: "QueueLengthLimit", Type: "string", Description: flowcontrolv1beta3.QueuingConfiguration{}.SwaggerDoc()["queueLengthLimit"]}, @@ -2608,19 +2608,19 @@ func printPriorityLevelConfiguration(obj *flowcontrol.PriorityLevelConfiguration Object: runtime.RawExtension{Object: obj}, } name := obj.Name - acs := interface{}("") + ncs := interface{}("") queues := interface{}("") handSize := interface{}("") queueLengthLimit := interface{}("") if obj.Spec.Limited != nil { - acs = obj.Spec.Limited.AssuredConcurrencyShares + ncs = obj.Spec.Limited.NominalConcurrencyShares if qc := obj.Spec.Limited.LimitResponse.Queuing; qc != nil { queues = qc.Queues handSize = qc.HandSize queueLengthLimit = qc.QueueLengthLimit } } - row.Cells = append(row.Cells, name, string(obj.Spec.Type), acs, queues, handSize, queueLengthLimit, translateTimestampSince(obj.CreationTimestamp)) + row.Cells = append(row.Cells, name, string(obj.Spec.Type), ncs, queues, handSize, queueLengthLimit, translateTimestampSince(obj.CreationTimestamp)) return []metav1.TableRow{row}, nil } diff --git a/pkg/printers/internalversion/printers_test.go b/pkg/printers/internalversion/printers_test.go index d21da9bff15..941cb747726 100644 --- a/pkg/printers/internalversion/printers_test.go +++ b/pkg/printers/internalversion/printers_test.go @@ -5643,7 +5643,7 @@ func TestPrintPriorityLevelConfiguration(t *testing.T) { Type: flowcontrol.PriorityLevelEnablementExempt, }, }, - // Columns: Name, Type, AssuredConcurrencyShares, Queues, HandSize, QueueLengthLimit, Age + // Columns: Name, Type, NominalConcurrencyShares, Queues, HandSize, QueueLengthLimit, Age expected: []metav1.TableRow{{Cells: []interface{}{"unlimited", "Exempt", "", "", "", "", "0s"}}}, }, { @@ -5655,14 +5655,14 @@ func TestPrintPriorityLevelConfiguration(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 47, + NominalConcurrencyShares: 47, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeReject, }, }, }, }, - // Columns: Name, Type, AssuredConcurrencyShares, Queues, HandSize, QueueLengthLimit, Age + // Columns: Name, Type, NominalConcurrencyShares, Queues, HandSize, QueueLengthLimit, Age expected: []metav1.TableRow{{Cells: []interface{}{"unqueued", "Limited", int32(47), "", "", "", "0s"}}}, }, { @@ -5674,7 +5674,7 @@ func TestPrintPriorityLevelConfiguration(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 42, + NominalConcurrencyShares: 42, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -5686,7 +5686,7 @@ func TestPrintPriorityLevelConfiguration(t *testing.T) { }, }, }, - // Columns: Name, Type, AssuredConcurrencyShares, Queues, HandSize, QueueLengthLimit, Age + // Columns: Name, Type, NominalConcurrencyShares, Queues, HandSize, QueueLengthLimit, Age expected: []metav1.TableRow{{Cells: []interface{}{"queued", "Limited", int32(42), int32(8), int32(3), int32(4), "0s"}}}, }, } diff --git a/pkg/registry/flowcontrol/ensurer/prioritylevelconfiguration_test.go b/pkg/registry/flowcontrol/ensurer/prioritylevelconfiguration_test.go index 9feedad2858..3db69b57944 100644 --- a/pkg/registry/flowcontrol/ensurer/prioritylevelconfiguration_test.go +++ b/pkg/registry/flowcontrol/ensurer/prioritylevelconfiguration_test.go @@ -248,7 +248,7 @@ func TestPriorityLevelSpecChanged(t *testing.T) { Spec: flowcontrolv1beta3.PriorityLevelConfigurationSpec{ Type: flowcontrolv1beta3.PriorityLevelEnablementLimited, Limited: &flowcontrolv1beta3.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 1, + NominalConcurrencyShares: 1, }, }, } @@ -256,7 +256,7 @@ func TestPriorityLevelSpecChanged(t *testing.T) { Spec: flowcontrolv1beta3.PriorityLevelConfigurationSpec{ Type: flowcontrolv1beta3.PriorityLevelEnablementLimited, Limited: &flowcontrolv1beta3.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: flowcontrolapisv1beta3.PriorityLevelConfigurationDefaultAssuredConcurrencyShares, + NominalConcurrencyShares: flowcontrolapisv1beta3.PriorityLevelConfigurationDefaultNominalConcurrencyShares, LimitResponse: flowcontrolv1beta3.LimitResponse{ Type: flowcontrolv1beta3.LimitResponseTypeReject, }, @@ -468,10 +468,10 @@ func (b *plBuilder) WithAutoUpdateAnnotation(value string) *plBuilder { return b } -func (b *plBuilder) WithLimited(assuredConcurrencyShares int32) *plBuilder { +func (b *plBuilder) WithLimited(nominalConcurrencyShares int32) *plBuilder { b.object.Spec.Type = flowcontrolv1beta3.PriorityLevelEnablementLimited b.object.Spec.Limited = &flowcontrolv1beta3.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: assuredConcurrencyShares, + NominalConcurrencyShares: nominalConcurrencyShares, LimitResponse: flowcontrolv1beta3.LimitResponse{ Type: flowcontrolv1beta3.LimitResponseTypeReject, }, diff --git a/pkg/registry/flowcontrol/prioritylevelconfiguration/strategy.go b/pkg/registry/flowcontrol/prioritylevelconfiguration/strategy.go index 29557cc22f7..1ab004c74ff 100644 --- a/pkg/registry/flowcontrol/prioritylevelconfiguration/strategy.go +++ b/pkg/registry/flowcontrol/prioritylevelconfiguration/strategy.go @@ -21,7 +21,9 @@ import ( apiequality "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" "k8s.io/apimachinery/pkg/util/validation/field" + genericapirequest "k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/storage/names" "k8s.io/kubernetes/pkg/api/legacyscheme" "k8s.io/kubernetes/pkg/apis/flowcontrol" @@ -85,7 +87,7 @@ func (priorityLevelConfigurationStrategy) PrepareForUpdate(ctx context.Context, // Validate validates a new priority-level. func (priorityLevelConfigurationStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList { - return validation.ValidatePriorityLevelConfiguration(obj.(*flowcontrol.PriorityLevelConfiguration)) + return validation.ValidatePriorityLevelConfiguration(obj.(*flowcontrol.PriorityLevelConfiguration), getRequestGroupVersion(ctx)) } // WarningsOnCreate returns warnings for the creation of the given object. @@ -108,7 +110,7 @@ func (priorityLevelConfigurationStrategy) AllowCreateOnUpdate() bool { // ValidateUpdate is the default update validation for an end user. func (priorityLevelConfigurationStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.Object) field.ErrorList { - return validation.ValidatePriorityLevelConfiguration(obj.(*flowcontrol.PriorityLevelConfiguration)) + return validation.ValidatePriorityLevelConfiguration(obj.(*flowcontrol.PriorityLevelConfiguration), getRequestGroupVersion(ctx)) } // WarningsOnUpdate returns warnings for the given update. @@ -168,3 +170,10 @@ func (priorityLevelConfigurationStatusStrategy) ValidateUpdate(ctx context.Conte func (priorityLevelConfigurationStatusStrategy) WarningsOnUpdate(ctx context.Context, obj, old runtime.Object) []string { return nil } + +func getRequestGroupVersion(ctx context.Context) schema.GroupVersion { + if requestInfo, exists := genericapirequest.RequestInfoFrom(ctx); exists { + return schema.GroupVersion{Group: requestInfo.APIGroup, Version: requestInfo.APIVersion} + } + return schema.GroupVersion{} +} diff --git a/staging/src/k8s.io/api/flowcontrol/v1beta3/generated.pb.go b/staging/src/k8s.io/api/flowcontrol/v1beta3/generated.pb.go index a52fcf8ee9d..fff88dabf46 100644 --- a/staging/src/k8s.io/api/flowcontrol/v1beta3/generated.pb.go +++ b/staging/src/k8s.io/api/flowcontrol/v1beta3/generated.pb.go @@ -690,100 +690,100 @@ func init() { var fileDescriptor_803504887082f044 = []byte{ // 1498 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4d, 0x73, 0xdb, 0xc4, - 0x1b, 0x8f, 0x1c, 0x3b, 0x89, 0x9f, 0xbc, 0x76, 0xd3, 0x4e, 0x3c, 0xe9, 0x8c, 0x9d, 0xea, 0x3f, - 0xf3, 0x2f, 0xd0, 0x56, 0xee, 0x2b, 0x2d, 0x30, 0xbc, 0x44, 0x29, 0x94, 0xd2, 0x24, 0x4d, 0x37, - 0x2d, 0x30, 0xa5, 0x33, 0x54, 0x96, 0x37, 0xb6, 0x1a, 0x5b, 0x52, 0xb5, 0x2b, 0x67, 0x42, 0x2f, - 0x0c, 0x9f, 0x80, 0x33, 0x1c, 0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, 0x4e, 0xe2, 0xa3, 0x47, 0xb0, 0xd4, 0x55, 0x76, 0x10, 0x73, 0x52, 0xc4, - 0xbc, 0x94, 0x16, 0x73, 0xe0, 0xa1, 0xe8, 0x05, 0x19, 0x76, 0x69, 0xbb, 0x07, 0x16, 0xf7, 0x05, - 0x52, 0x7f, 0xcd, 0xc0, 0x88, 0x41, 0xfc, 0x0a, 0x96, 0xaa, 0xfb, 0x89, 0xa5, 0xea, 0xbd, 0x17, - 0x7f, 0x61, 0x86, 0x2e, 0x59, 0xf5, 0x9e, 0x25, 0xeb, 0x83, 0x97, 0x88, 0x31, 0x7a, 0xe9, 0xfa, - 0x3b, 0x03, 0xff, 0x1b, 0xee, 0x1c, 0x2f, 0x61, 0x37, 0x12, 0x23, 0xed, 0x72, 0xcf, 0x48, 0x3b, - 0x39, 0x06, 0xc4, 0x7f, 0x4b, 0x59, 0xcf, 0x52, 0xf6, 0x9b, 0x02, 0xc5, 0xe1, 0x7d, 0x7b, 0x05, - 0x4b, 0xda, 0x97, 0xc9, 0x25, 0xed, 0xed, 0x17, 0x27, 0xd9, 0x90, 0xa5, 0xed, 0xda, 0x28, 0x6e, - 0x45, 0xeb, 0xd5, 0x18, 0x4f, 0xec, 0x2f, 0x23, 0x5b, 0x25, 0xb6, 0xc1, 0x94, 0xbf, 0x12, 0x12, - 0xde, 0x1f, 0xda, 0x46, 0xa5, 0x41, 0x9a, 0xc4, 0x66, 0x92, 0x90, 0x75, 0x98, 0x6e, 0x04, 0x6f, - 0xa3, 0xbc, 0xd4, 0xeb, 0x63, 0x3d, 0x49, 0xa3, 0x9e, 0xd2, 0xe0, 0x19, 0x96, 0x66, 0x38, 0x84, - 0x57, 0xbf, 0x57, 0x60, 0x2d, 0xed, 0xb2, 0xa2, 0x83, 0x01, 0xcb, 0xce, 0x4b, 0x2c, 0xb2, 0xe3, - 0x2f, 0x3f, 0x3f, 0x29, 0x70, 0x74, 0xd0, 0x4e, 0xc1, 0xe9, 0xcf, 0x17, 0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, 0x65, 0x57, 0x25, 0xf2, 0xf1, 0xd0, 0xfa, 0x86, 0x65, 0x57, 0x9f, 0xb7, 0x4b, - 0xb3, 0xd2, 0x8c, 0x7f, 0x62, 0x61, 0x88, 0xae, 0x43, 0xd6, 0xa7, 0xc4, 0x93, 0xd7, 0xeb, 0x54, - 0x1a, 0x99, 0xef, 0x50, 0xe2, 0x85, 0x9b, 0xcf, 0x0c, 0x47, 0xe6, 0x02, 0x2c, 0x20, 0xd0, 0x16, - 0xe4, 0x6a, 0xfc, 0x50, 0xe4, 0xd4, 0x3f, 0x9d, 0x86, 0xd5, 0xbd, 0xce, 0x07, 0x34, 0x10, 0x12, - 0x1c, 0xa0, 0xa0, 0x87, 0xb0, 0x40, 0x13, 0x2d, 0x14, 0xc7, 0x35, 0xc6, 0x26, 0x33, 0xb0, 0xf1, - 0x3a, 0xea, 0xb4, 0x4b, 0x0b, 0x49, 0x15, 0xee, 0x09, 0xa0, 0x96, 0x61, 0xb6, 0xab, 0xc0, 0xf4, - 0xf9, 0xa7, 0x5f, 0x7d, 0xfc, 0xac, 0x38, 0xf1, 0xe4, 0x59, 0x71, 0xe2, 0xe9, 0xb3, 0xe2, 0xc4, - 0xd7, 0x9d, 0xa2, 0xf2, 0xb8, 0x53, 0x54, 0x9e, 0x74, 0x8a, 0xca, 0xd3, 0x4e, 0x51, 0xf9, 0xbd, - 0x53, 0x54, 0xbe, 0xfd, 0xa3, 0x38, 0x71, 0xb7, 0x38, 0xfa, 0xff, 0x7a, 0xff, 0x06, 0x00, 0x00, - 0xff, 0xff, 0x36, 0x4f, 0xce, 0xba, 0x11, 0x14, 0x00, 0x00, + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4b, 0x73, 0x13, 0xc7, + 0x16, 0xf6, 0xc8, 0x92, 0x6d, 0x1d, 0x3f, 0x69, 0x43, 0x59, 0x65, 0xaa, 0x24, 0x33, 0xb7, 0xea, + 0x72,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xac, 0x7a, 0x3e, 0x75, 0x7d, 0xca, 0x0f, 0x37, 0x48, 0x93, 0xd4, 0xd7, 0x5d, 0x67, + 0x8f, 0x56, 0x03, 0xdf, 0x12, 0xad, 0x54, 0x45, 0xad, 0xa7, 0x45, 0xde, 0x1e, 0x8a, 0x80, 0xc9, + 0x1e, 0xf1, 0x89, 0x63, 0x13, 0x53, 0x57, 0x29, 0xad, 0x8e, 0x30, 0x1e, 0x91, 0x0a, 0xfa, 0x08, + 0x50, 0xc3, 0xe2, 0xa2, 0xa3, 0xd5, 0x6d, 0x9f, 0xd8, 0xa4, 0x22, 0x50, 0x25, 0x21, 0x73, 0x31, + 0x3b, 0x36, 0xfb, 0x2c, 0xf0, 0x00, 0x2f, 0xf4, 0x95, 0x06, 0xcb, 0x95, 0xfe, 0x21, 0xa3, 0x78, + 0x79, 0x79, 0x9c, 0x46, 0x0f, 0x98, 0x51, 0xe6, 0x4a, 0xbb, 0x55, 0x5a, 0x1e, 0xa0, 0xc0, 0x83, + 0x82, 0xa1, 0xfb, 0x90, 0xf3, 0x83, 0x3a, 0x61, 0x85, 0xac, 0x3c, 0xde, 0xd4, 0xa8, 0xdb, 0x6e, + 0x9d, 0xda, 0x87, 0x58, 0xb8, 0x7c, 0x42, 0x79, 0x6d, 0x27, 0x90, 0xb3, 0x8a, 0xc5, 0x67, 0x2d, + 0x55, 0x38, 0x04, 0xd5, 0x1f, 0xc3, 0x52, 0xef, 0xd0, 0x40, 0x55, 0x00, 0xbb, 0x73, 0x4f, 0x59, + 0x41, 0x93, 0x61, 0x2f, 0x8c, 0xcf, 0xaa, 0xe8, 0x8e, 0xc7, 0xf3, 0x32, 0x12, 0x31, 0xdc, 0x05, + 0xad, 0x9f, 0x85, 0xb9, 0xeb, 0xbe, 0x1b, 0x78, 0x2a, 0x47, 0xb4, 0x06, 0x59, 0xc7, 0x6a, 0x74, + 0xa6, 0x4f, 0x34, 0x11, 0xb7, 0xac, 0x06, 0xc1, 0x52, 0xa3, 0x7f, 0xa7, 0xc1, 0xfc, 0x06, 0x6d, + 0x50, 0x8e, 0x09, 0xf3, 0x5c, 0x87, 0x11, 0x74, 0x29, 0x31, 0xb1, 0x4e, 0xf4, 0x4c, 0xac, 0x23, + 0x09, 0xe3, 0xae, 0x59, 0xf5, 0x19, 0x4c, 0x3f, 0x0a, 0x48, 0x40, 0x9d, 0xaa, 0x9a, 0xd7, 0x17, + 0xd3, 0x0a, 0xbc, 0x1d, 0x9a, 0x27, 0xd8, 0x66, 0xce, 0x8a, 0x11, 0xa0, 0x34, 0xb8, 0x83, 0xa8, + 0xff, 0xa1, 0xc1, 0x09, 0x19, 0x98, 0x54, 0x86, 0xb3, 0x18, 0xdd, 0x87, 0x82, 0xe3, 0x36, 0xa8, + 0x63, 0x09, 0xb9, 0x1d, 0xf8, 0x82, 0xff, 0x87, 0x3b, 0x35, 0xcb, 0x27, 0x4c, 0x56, 0x93, 0x33, + 0xd7, 0x54, 0x35, 0x85, 0xad, 0x21, 0x76, 0x78, 0x28, 0x02, 0x7a, 0x08, 0xf3, 0xf5, 0xee, 0xda, + 0x55, 0x99, 0x67, 0xd2, 0xca, 0x4c, 0x34, 0xcc, 0x3c, 0xa6, 0x32, 0x48, 0x36, 0x1d, 0x27, 0xa1, + 0xf5, 0x03, 0x38, 0xb6, 0x25, 0xee, 0x30, 0x73, 0x03, 0xdf, 0x26, 0x31, 0x01, 0x51, 0x09, 0x72, + 0x4d, 0xe2, 0xef, 0x86, 0x24, 0xca, 0x9b, 0x79, 0x41, 0xbf, 0x8f, 0x85, 0x00, 0x87, 0x72, 0xf4, + 0x36, 0x2c, 0x3a, 0xb1, 0xe7, 0x5d, 0xbc, 0xc1, 0x0a, 0x53, 0xd2, 0x74, 0xb9, 0xdd, 0x2a, 0x2d, + 0x6e, 0x25, 0x55, 0xb8, 0xd7, 0x56, 0x6f, 0x65, 0x60, 0x65, 0x08, 0xdf, 0xd1, 0x5d, 0x98, 0x61, + 0xea, 0xb7, 0xe2, 0xf0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ec, 0x35, 0xcf, 0x11, 0x14, 0x00, 0x00, } func (m *FlowDistinguisherMethod) Marshal() (dAtA []byte, err error) { @@ -1164,7 +1164,7 @@ func (m *LimitedPriorityLevelConfiguration) MarshalToSizedBuffer(dAtA []byte) (i } i-- dAtA[i] = 0x12 - i = encodeVarintGenerated(dAtA, i, uint64(m.AssuredConcurrencyShares)) + i = encodeVarintGenerated(dAtA, i, uint64(m.NominalConcurrencyShares)) i-- dAtA[i] = 0x8 return len(dAtA) - i, nil @@ -1900,7 +1900,7 @@ func (m *LimitedPriorityLevelConfiguration) Size() (n int) { } var l int _ = l - n += 1 + sovGenerated(uint64(m.AssuredConcurrencyShares)) + n += 1 + sovGenerated(uint64(m.NominalConcurrencyShares)) l = m.LimitResponse.Size() n += 1 + l + sovGenerated(uint64(l)) return n @@ -2256,7 +2256,7 @@ func (this *LimitedPriorityLevelConfiguration) String() string { return "nil" } s := strings.Join([]string{`&LimitedPriorityLevelConfiguration{`, - `AssuredConcurrencyShares:` + fmt.Sprintf("%v", this.AssuredConcurrencyShares) + `,`, + `NominalConcurrencyShares:` + fmt.Sprintf("%v", this.NominalConcurrencyShares) + `,`, `LimitResponse:` + strings.Replace(strings.Replace(this.LimitResponse.String(), "LimitResponse", "LimitResponse", 1), `&`, ``, 1) + `,`, `}`, }, "") @@ -3492,9 +3492,9 @@ func (m *LimitedPriorityLevelConfiguration) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AssuredConcurrencyShares", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field NominalConcurrencyShares", wireType) } - m.AssuredConcurrencyShares = 0 + m.NominalConcurrencyShares = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenerated @@ -3504,7 +3504,7 @@ func (m *LimitedPriorityLevelConfiguration) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.AssuredConcurrencyShares |= int32(b&0x7F) << shift + m.NominalConcurrencyShares |= int32(b&0x7F) << shift if b < 0x80 { break } diff --git a/staging/src/k8s.io/api/flowcontrol/v1beta3/generated.proto b/staging/src/k8s.io/api/flowcontrol/v1beta3/generated.proto index 840e2606816..f624deb87ae 100644 --- a/staging/src/k8s.io/api/flowcontrol/v1beta3/generated.proto +++ b/staging/src/k8s.io/api/flowcontrol/v1beta3/generated.proto @@ -158,23 +158,23 @@ message LimitResponse { // - How are requests for this priority level limited? // - What should be done with requests that exceed the limit? message LimitedPriorityLevelConfiguration { - // `assuredConcurrencyShares` (ACS) configures the execution - // limit, which is a limit on the number of requests of this - // priority level that may be exeucting at a given time. ACS must - // be a positive number. The server's concurrency limit (SCL) is - // divided among the concurrency-controlled priority levels in - // proportion to their assured concurrency shares. This produces - // the assured concurrency value (ACV) --- the number of requests - // that may be executing at a time --- for each such priority - // level: + // `nominalConcurrencyShares` (NCS) contributes to the computation of the + // NominalConcurrencyLimit (NominalCL) of this level. + // This is the number of execution seats available at this priority level. + // This is used both for requests dispatched from this priority level + // as well as requests dispatched from other priority levels + // borrowing seats from this level. + // The server's concurrency limit (ServerCL) is divided among the + // Limited priority levels in proportion to their NCS values: // - // ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) ) + // NominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) + // sum_ncs = sum[limited priority level k] NCS(k) // - // bigger numbers of ACS mean more reserved concurrent requests (at the - // expense of every other PL). + // Bigger numbers mean a larger nominal concurrency limit, + // at the expense of every other Limited priority level. // This field has a default value of 30. // +optional - optional int32 assuredConcurrencyShares = 1; + optional int32 nominalConcurrencyShares = 1; // `limitResponse` indicates what to do with requests that can not be executed right now optional LimitResponse limitResponse = 2; diff --git a/staging/src/k8s.io/api/flowcontrol/v1beta3/types.go b/staging/src/k8s.io/api/flowcontrol/v1beta3/types.go index 96e597133d4..289849fbf72 100644 --- a/staging/src/k8s.io/api/flowcontrol/v1beta3/types.go +++ b/staging/src/k8s.io/api/flowcontrol/v1beta3/types.go @@ -452,23 +452,23 @@ const ( // - How are requests for this priority level limited? // - What should be done with requests that exceed the limit? type LimitedPriorityLevelConfiguration struct { - // `assuredConcurrencyShares` (ACS) configures the execution - // limit, which is a limit on the number of requests of this - // priority level that may be exeucting at a given time. ACS must - // be a positive number. The server's concurrency limit (SCL) is - // divided among the concurrency-controlled priority levels in - // proportion to their assured concurrency shares. This produces - // the assured concurrency value (ACV) --- the number of requests - // that may be executing at a time --- for each such priority - // level: + // `nominalConcurrencyShares` (NCS) contributes to the computation of the + // NominalConcurrencyLimit (NominalCL) of this level. + // This is the number of execution seats available at this priority level. + // This is used both for requests dispatched from this priority level + // as well as requests dispatched from other priority levels + // borrowing seats from this level. + // The server's concurrency limit (ServerCL) is divided among the + // Limited priority levels in proportion to their NCS values: // - // ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) ) + // NominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) + // sum_ncs = sum[limited priority level k] NCS(k) // - // bigger numbers of ACS mean more reserved concurrent requests (at the - // expense of every other PL). + // Bigger numbers mean a larger nominal concurrency limit, + // at the expense of every other Limited priority level. // This field has a default value of 30. // +optional - AssuredConcurrencyShares int32 `json:"assuredConcurrencyShares" protobuf:"varint,1,opt,name=assuredConcurrencyShares"` + NominalConcurrencyShares int32 `json:"nominalConcurrencyShares" protobuf:"varint,1,opt,name=nominalConcurrencyShares"` // `limitResponse` indicates what to do with requests that can not be executed right now LimitResponse LimitResponse `json:"limitResponse,omitempty" protobuf:"bytes,2,opt,name=limitResponse"` diff --git a/staging/src/k8s.io/api/flowcontrol/v1beta3/types_swagger_doc_generated.go b/staging/src/k8s.io/api/flowcontrol/v1beta3/types_swagger_doc_generated.go index 69d257c89bb..e4586cf6928 100644 --- a/staging/src/k8s.io/api/flowcontrol/v1beta3/types_swagger_doc_generated.go +++ b/staging/src/k8s.io/api/flowcontrol/v1beta3/types_swagger_doc_generated.go @@ -112,7 +112,7 @@ func (LimitResponse) SwaggerDoc() map[string]string { var map_LimitedPriorityLevelConfiguration = map[string]string{ "": "LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. It addresses two issues:\n - How are requests for this priority level limited?\n - What should be done with requests that exceed the limit?", - "assuredConcurrencyShares": "`assuredConcurrencyShares` (ACS) configures the execution limit, which is a limit on the number of requests of this priority level that may be exeucting at a given time. ACS must be a positive number. The server's concurrency limit (SCL) is divided among the concurrency-controlled priority levels in proportion to their assured concurrency shares. This produces the assured concurrency value (ACV) ", + "nominalConcurrencyShares": "`nominalConcurrencyShares` (NCS) contributes to the computation of the NominalConcurrencyLimit (NominalCL) of this level. This is the number of execution seats available at this priority level. This is used both for requests dispatched from this priority level as well as requests dispatched from other priority levels borrowing seats from this level. The server's concurrency limit (ServerCL) is divided among the Limited priority levels in proportion to their NCS values:\n\nNominalCL(i) = ceil( ServerCL * NCS(i) / sum_ncs ) sum_ncs = sum[limited priority level k] NCS(k)\n\nBigger numbers mean a larger nominal concurrency limit, at the expense of every other Limited priority level. This field has a default value of 30.", "limitResponse": "`limitResponse` indicates what to do with requests that can not be executed right now", } diff --git a/staging/src/k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap/default.go b/staging/src/k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap/default.go index 61d5ba3c782..b12f4c27479 100644 --- a/staging/src/k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap/default.go +++ b/staging/src/k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap/default.go @@ -95,7 +95,7 @@ var ( flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 5, + NominalConcurrencyShares: 5, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeReject, }, @@ -167,7 +167,7 @@ var ( flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 30, + NominalConcurrencyShares: 30, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -183,7 +183,7 @@ var ( flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 40, + NominalConcurrencyShares: 40, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -200,7 +200,7 @@ var ( flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 10, + NominalConcurrencyShares: 10, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -217,7 +217,7 @@ var ( flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 40, + NominalConcurrencyShares: 40, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -234,7 +234,7 @@ var ( flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 100, + NominalConcurrencyShares: 100, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ @@ -251,7 +251,7 @@ var ( flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 20, + NominalConcurrencyShares: 20, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ diff --git a/staging/src/k8s.io/apiserver/pkg/server/filters/priority-and-fairness_test.go b/staging/src/k8s.io/apiserver/pkg/server/filters/priority-and-fairness_test.go index 83a4216bb72..b6f0818c78e 100644 --- a/staging/src/k8s.io/apiserver/pkg/server/filters/priority-and-fairness_test.go +++ b/staging/src/k8s.io/apiserver/pkg/server/filters/priority-and-fairness_test.go @@ -1268,7 +1268,7 @@ func newConfiguration(fsName, plName, user string, concurrency int32, queueLengt Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: concurrency, + NominalConcurrencyShares: concurrency, LimitResponse: flowcontrol.LimitResponse{ Type: responseType, Queuing: qcfg, diff --git a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go index ffd2b4006ca..5ce1b95169e 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go +++ b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/apf_controller.go @@ -545,7 +545,7 @@ func (meal *cfgMeal) digestNewPLsLocked(newPLs []*flowcontrol.PriorityLevelConfi state.quiescing = false } if state.pl.Spec.Limited != nil { - meal.shareSum += float64(state.pl.Spec.Limited.AssuredConcurrencyShares) + meal.shareSum += float64(state.pl.Spec.Limited.NominalConcurrencyShares) } meal.haveExemptPL = meal.haveExemptPL || pl.Name == flowcontrol.PriorityLevelConfigurationNameExempt meal.haveCatchAllPL = meal.haveCatchAllPL || pl.Name == flowcontrol.PriorityLevelConfigurationNameCatchAll @@ -648,7 +648,7 @@ func (meal *cfgMeal) processOldPLsLocked() { // priority level continues to get a concurrency // allocation determined by all the share values in the // regular way. - meal.shareSum += float64(plState.pl.Spec.Limited.AssuredConcurrencyShares) + meal.shareSum += float64(plState.pl.Spec.Limited.NominalConcurrencyShares) } meal.haveExemptPL = meal.haveExemptPL || plName == flowcontrol.PriorityLevelConfigurationNameExempt meal.haveCatchAllPL = meal.haveCatchAllPL || plName == flowcontrol.PriorityLevelConfigurationNameCatchAll @@ -669,7 +669,7 @@ func (meal *cfgMeal) finishQueueSetReconfigsLocked() { // The use of math.Ceil here means that the results might sum // to a little more than serverConcurrencyLimit but the // difference will be negligible. - concurrencyLimit := int(math.Ceil(float64(meal.cfgCtlr.serverConcurrencyLimit) * float64(plState.pl.Spec.Limited.AssuredConcurrencyShares) / meal.shareSum)) + concurrencyLimit := int(math.Ceil(float64(meal.cfgCtlr.serverConcurrencyLimit) * float64(plState.pl.Spec.Limited.NominalConcurrencyShares) / meal.shareSum)) metrics.UpdateSharedConcurrencyLimit(plName, concurrencyLimit) meal.maxExecutingRequests += concurrencyLimit var waitLimit int @@ -679,9 +679,9 @@ func (meal *cfgMeal) finishQueueSetReconfigsLocked() { meal.maxWaitingRequests += waitLimit if plState.queues == nil { - klog.V(5).Infof("Introducing queues for priority level %q: config=%s, concurrencyLimit=%d, quiescing=%v (shares=%v, shareSum=%v)", plName, fcfmt.Fmt(plState.pl.Spec), concurrencyLimit, plState.quiescing, plState.pl.Spec.Limited.AssuredConcurrencyShares, meal.shareSum) + klog.V(5).Infof("Introducing queues for priority level %q: config=%s, concurrencyLimit=%d, quiescing=%v (shares=%v, shareSum=%v)", plName, fcfmt.Fmt(plState.pl.Spec), concurrencyLimit, plState.quiescing, plState.pl.Spec.Limited.NominalConcurrencyShares, meal.shareSum) } else { - klog.V(5).Infof("Retaining queues for priority level %q: config=%s, concurrencyLimit=%d, quiescing=%v, numPending=%d (shares=%v, shareSum=%v)", plName, fcfmt.Fmt(plState.pl.Spec), concurrencyLimit, plState.quiescing, plState.numPending, plState.pl.Spec.Limited.AssuredConcurrencyShares, meal.shareSum) + klog.V(5).Infof("Retaining queues for priority level %q: config=%s, concurrencyLimit=%d, quiescing=%v, numPending=%d (shares=%v, shareSum=%v)", plName, fcfmt.Fmt(plState.pl.Spec), concurrencyLimit, plState.quiescing, plState.numPending, plState.pl.Spec.Limited.NominalConcurrencyShares, meal.shareSum) } plState.queues = plState.qsCompleter.Complete(fq.DispatchingConfig{ConcurrencyLimit: concurrencyLimit}) } @@ -781,7 +781,7 @@ func (meal *cfgMeal) imaginePL(proto *flowcontrol.PriorityLevelConfiguration, re execSeatsObs: execSeatsObs, } if proto.Spec.Limited != nil { - meal.shareSum += float64(proto.Spec.Limited.AssuredConcurrencyShares) + meal.shareSum += float64(proto.Spec.Limited.NominalConcurrencyShares) } } diff --git a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/controller_test.go b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/controller_test.go index 7cbfe7e280b..a2601e0dfac 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/controller_test.go +++ b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/controller_test.go @@ -363,7 +363,7 @@ func TestAPFControllerWithGracefulShutdown(t *testing.T) { Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: 10, + NominalConcurrencyShares: 10, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeReject, }, diff --git a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/format/formatting.go b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/format/formatting.go index 1425825ad50..49444237385 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/format/formatting.go +++ b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/format/formatting.go @@ -113,7 +113,7 @@ func FmtPriorityLevelConfigurationSpec(plSpec *flowcontrol.PriorityLevelConfigur func BufferPriorityLevelConfigurationSpec(buf *bytes.Buffer, plSpec *flowcontrol.PriorityLevelConfigurationSpec) { buf.WriteString(fmt.Sprintf("flowcontrolv1beta3.PriorityLevelConfigurationSpec{Type: %#v", plSpec.Type)) if plSpec.Limited != nil { - buf.WriteString(fmt.Sprintf(", Limited: &flowcontrol.LimitedPriorityLevelConfiguration{AssuredConcurrencyShares:%d, LimitResponse:flowcontrol.LimitResponse{Type:%#v", plSpec.Limited.AssuredConcurrencyShares, plSpec.Limited.LimitResponse.Type)) + buf.WriteString(fmt.Sprintf(", Limited: &flowcontrol.LimitedPriorityLevelConfiguration{NominalConcurrencyShares:%d, LimitResponse:flowcontrol.LimitResponse{Type:%#v", plSpec.Limited.NominalConcurrencyShares, plSpec.Limited.LimitResponse.Type)) if plSpec.Limited.LimitResponse.Queuing != nil { buf.WriteString(fmt.Sprintf(", Queuing:&%#+v", *plSpec.Limited.LimitResponse.Queuing)) } diff --git a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/gen_test.go b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/gen_test.go index f6dd2911834..d7a221bf400 100644 --- a/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/gen_test.go +++ b/staging/src/k8s.io/apiserver/pkg/util/flowcontrol/gen_test.go @@ -45,7 +45,7 @@ func genPL(rng *rand.Rand, name string) *flowcontrol.PriorityLevelConfiguration Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: rng.Int31n(100) + 1, + NominalConcurrencyShares: rng.Int31n(100) + 1, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeReject}}}} if rng.Float32() < 0.95 { diff --git a/staging/src/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/limitedprioritylevelconfiguration.go b/staging/src/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/limitedprioritylevelconfiguration.go index e3ffb203cf4..195eda722c0 100644 --- a/staging/src/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/limitedprioritylevelconfiguration.go +++ b/staging/src/k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3/limitedprioritylevelconfiguration.go @@ -21,7 +21,7 @@ package v1beta3 // LimitedPriorityLevelConfigurationApplyConfiguration represents an declarative configuration of the LimitedPriorityLevelConfiguration type for use // with apply. type LimitedPriorityLevelConfigurationApplyConfiguration struct { - AssuredConcurrencyShares *int32 `json:"assuredConcurrencyShares,omitempty"` + NominalConcurrencyShares *int32 `json:"nominalConcurrencyShares,omitempty"` LimitResponse *LimitResponseApplyConfiguration `json:"limitResponse,omitempty"` } @@ -31,11 +31,11 @@ func LimitedPriorityLevelConfiguration() *LimitedPriorityLevelConfigurationApply return &LimitedPriorityLevelConfigurationApplyConfiguration{} } -// WithAssuredConcurrencyShares sets the AssuredConcurrencyShares field in the declarative configuration to the given value +// WithNominalConcurrencyShares sets the NominalConcurrencyShares field in the declarative configuration to the given value // and returns the receiver, so that objects can be built by chaining "With" function invocations. -// If called multiple times, the AssuredConcurrencyShares field is set to the value of the last call. -func (b *LimitedPriorityLevelConfigurationApplyConfiguration) WithAssuredConcurrencyShares(value int32) *LimitedPriorityLevelConfigurationApplyConfiguration { - b.AssuredConcurrencyShares = &value +// If called multiple times, the NominalConcurrencyShares field is set to the value of the last call. +func (b *LimitedPriorityLevelConfigurationApplyConfiguration) WithNominalConcurrencyShares(value int32) *LimitedPriorityLevelConfigurationApplyConfiguration { + b.NominalConcurrencyShares = &value return b } diff --git a/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go b/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go index bece1163356..3f50a41391c 100644 --- a/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go +++ b/staging/src/k8s.io/client-go/applyconfigurations/internal/internal.go @@ -9346,14 +9346,14 @@ var schemaYAML = typed.YAMLObject(`types: - name: io.k8s.api.flowcontrol.v1beta3.LimitedPriorityLevelConfiguration map: fields: - - name: assuredConcurrencyShares - type: - scalar: numeric - default: 0 - name: limitResponse type: namedType: io.k8s.api.flowcontrol.v1beta3.LimitResponse default: {} + - name: nominalConcurrencyShares + type: + scalar: numeric + default: 0 - name: io.k8s.api.flowcontrol.v1beta3.NonResourcePolicyRule map: fields: diff --git a/test/e2e/apimachinery/flowcontrol.go b/test/e2e/apimachinery/flowcontrol.go index 531d16f76f4..64da49b28b0 100644 --- a/test/e2e/apimachinery/flowcontrol.go +++ b/test/e2e/apimachinery/flowcontrol.go @@ -256,7 +256,7 @@ var _ = SIGDescribe("API priority and fairness", func() { // createPriorityLevel creates a priority level with the provided assured // concurrency share. -func createPriorityLevel(f *framework.Framework, priorityLevelName string, assuredConcurrencyShares int32) (*flowcontrol.PriorityLevelConfiguration, func()) { +func createPriorityLevel(f *framework.Framework, priorityLevelName string, nominalConcurrencyShares int32) (*flowcontrol.PriorityLevelConfiguration, func()) { createdPriorityLevel, err := f.ClientSet.FlowcontrolV1beta3().PriorityLevelConfigurations().Create( context.TODO(), &flowcontrol.PriorityLevelConfiguration{ @@ -266,7 +266,7 @@ func createPriorityLevel(f *framework.Framework, priorityLevelName string, assur Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: assuredConcurrencyShares, + NominalConcurrencyShares: nominalConcurrencyShares, LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeReject, }, diff --git a/test/integration/apiserver/apply/reset_fields_test.go b/test/integration/apiserver/apply/reset_fields_test.go index 4b84e01e5e5..8a2010f7ece 100644 --- a/test/integration/apiserver/apply/reset_fields_test.go +++ b/test/integration/apiserver/apply/reset_fields_test.go @@ -130,7 +130,7 @@ var resetFieldsSpecData = map[schema.GroupVersionResource]string{ gvr("flowcontrol.apiserver.k8s.io", "v1alpha1", "prioritylevelconfigurations"): `{"metadata": {"labels":{"a":"c"}}, "spec": {"limited": {"assuredConcurrencyShares": 23}}}`, gvr("flowcontrol.apiserver.k8s.io", "v1beta1", "prioritylevelconfigurations"): `{"metadata": {"labels":{"a":"c"}}, "spec": {"limited": {"assuredConcurrencyShares": 23}}}`, gvr("flowcontrol.apiserver.k8s.io", "v1beta2", "prioritylevelconfigurations"): `{"metadata": {"labels":{"a":"c"}}, "spec": {"limited": {"assuredConcurrencyShares": 23}}}`, - gvr("flowcontrol.apiserver.k8s.io", "v1beta3", "prioritylevelconfigurations"): `{"metadata": {"labels":{"a":"c"}}, "spec": {"limited": {"assuredConcurrencyShares": 23}}}`, + gvr("flowcontrol.apiserver.k8s.io", "v1beta3", "prioritylevelconfigurations"): `{"metadata": {"labels":{"a":"c"}}, "spec": {"limited": {"nominalConcurrencyShares": 23}}}`, gvr("extensions", "v1beta1", "ingresses"): `{"spec": {"backend": {"serviceName": "service2"}}}`, gvr("networking.k8s.io", "v1beta1", "ingresses"): `{"spec": {"backend": {"serviceName": "service2"}}}`, gvr("networking.k8s.io", "v1", "ingresses"): `{"spec": {"defaultBackend": {"service": {"name": "service2"}}}}`, diff --git a/test/integration/apiserver/flowcontrol/concurrency_test.go b/test/integration/apiserver/flowcontrol/concurrency_test.go index f7fe62e6c6b..5d3ae1f3e01 100644 --- a/test/integration/apiserver/flowcontrol/concurrency_test.go +++ b/test/integration/apiserver/flowcontrol/concurrency_test.go @@ -237,7 +237,7 @@ func createPriorityLevelAndBindingFlowSchemaForUser(c clientset.Interface, usern Spec: flowcontrol.PriorityLevelConfigurationSpec{ Type: flowcontrol.PriorityLevelEnablementLimited, Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ - AssuredConcurrencyShares: int32(concurrencyShares), + NominalConcurrencyShares: int32(concurrencyShares), LimitResponse: flowcontrol.LimitResponse{ Type: flowcontrol.LimitResponseTypeQueue, Queuing: &flowcontrol.QueuingConfiguration{ diff --git a/test/integration/etcd/data.go b/test/integration/etcd/data.go index ffe05acffc2..01d37339899 100644 --- a/test/integration/etcd/data.go +++ b/test/integration/etcd/data.go @@ -324,7 +324,7 @@ func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionRes // k8s.io/kubernetes/pkg/apis/flowcontrol/v1beta3 gvr("flowcontrol.apiserver.k8s.io", "v1beta3", "prioritylevelconfigurations"): { - Stub: `{"metadata": {"name": "conf4"}, "spec": {"type": "Limited", "limited": {"assuredConcurrencyShares":3, "limitResponse": {"type": "Reject"}}}}`, + Stub: `{"metadata": {"name": "conf4"}, "spec": {"type": "Limited", "limited": {"nominalConcurrencyShares":3, "limitResponse": {"type": "Reject"}}}}`, ExpectedEtcdPath: "/registry/prioritylevelconfigurations/conf4", ExpectedGVK: gvkP("flowcontrol.apiserver.k8s.io", "v1beta2", "PriorityLevelConfiguration"), },