mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	remove general avaliable feature-gate ZeroLimitedNominalConcurrencyShares
This commit is contained in:
		@@ -76,12 +76,7 @@ var supportedLimitResponseType = sets.NewString(
 | 
				
			|||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// PriorityLevelValidationOptions holds the validation options for a priority level object
 | 
					// PriorityLevelValidationOptions holds the validation options for a priority level object
 | 
				
			||||||
type PriorityLevelValidationOptions struct {
 | 
					type PriorityLevelValidationOptions struct{}
 | 
				
			||||||
	// AllowZeroLimitedNominalConcurrencyShares, if true, indicates that we allow
 | 
					 | 
				
			||||||
	// a zero value for the 'nominalConcurrencyShares' field of the 'limited'
 | 
					 | 
				
			||||||
	// section of a priority level.
 | 
					 | 
				
			||||||
	AllowZeroLimitedNominalConcurrencyShares bool
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
// ValidateFlowSchema validates the content of flow-schema
 | 
					// ValidateFlowSchema validates the content of flow-schema
 | 
				
			||||||
func ValidateFlowSchema(fs *flowcontrol.FlowSchema) field.ErrorList {
 | 
					func ValidateFlowSchema(fs *flowcontrol.FlowSchema) field.ErrorList {
 | 
				
			||||||
@@ -429,14 +424,8 @@ func ValidatePriorityLevelConfigurationSpec(spec *flowcontrol.PriorityLevelConfi
 | 
				
			|||||||
// ValidateLimitedPriorityLevelConfiguration validates the configuration for an execution-limited priority level
 | 
					// ValidateLimitedPriorityLevelConfiguration validates the configuration for an execution-limited priority level
 | 
				
			||||||
func ValidateLimitedPriorityLevelConfiguration(lplc *flowcontrol.LimitedPriorityLevelConfiguration, requestGV schema.GroupVersion, fldPath *field.Path, opts PriorityLevelValidationOptions) field.ErrorList {
 | 
					func ValidateLimitedPriorityLevelConfiguration(lplc *flowcontrol.LimitedPriorityLevelConfiguration, requestGV schema.GroupVersion, fldPath *field.Path, opts PriorityLevelValidationOptions) field.ErrorList {
 | 
				
			||||||
	var allErrs field.ErrorList
 | 
						var allErrs field.ErrorList
 | 
				
			||||||
	if opts.AllowZeroLimitedNominalConcurrencyShares {
 | 
						if lplc.NominalConcurrencyShares < 0 {
 | 
				
			||||||
		if lplc.NominalConcurrencyShares < 0 {
 | 
							allErrs = append(allErrs, field.Invalid(fldPath.Child(getVersionedFieldNameForConcurrencyShares(requestGV)), lplc.NominalConcurrencyShares, "must be a non-negative integer"))
 | 
				
			||||||
			allErrs = append(allErrs, field.Invalid(fldPath.Child(getVersionedFieldNameForConcurrencyShares(requestGV)), lplc.NominalConcurrencyShares, "must be a non-negative integer"))
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		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"))...)
 | 
						allErrs = append(allErrs, ValidateLimitResponse(lplc.LimitResponse, fldPath.Child("limitResponse"))...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -24,8 +24,6 @@ import (
 | 
				
			|||||||
	"github.com/google/go-cmp/cmp"
 | 
						"github.com/google/go-cmp/cmp"
 | 
				
			||||||
	"github.com/stretchr/testify/assert"
 | 
						"github.com/stretchr/testify/assert"
 | 
				
			||||||
	flowcontrolv1 "k8s.io/api/flowcontrol/v1"
 | 
						flowcontrolv1 "k8s.io/api/flowcontrol/v1"
 | 
				
			||||||
	flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
 | 
					 | 
				
			||||||
	flowcontrolv1beta2 "k8s.io/api/flowcontrol/v1beta2"
 | 
					 | 
				
			||||||
	flowcontrolv1beta3 "k8s.io/api/flowcontrol/v1beta3"
 | 
						flowcontrolv1beta3 "k8s.io/api/flowcontrol/v1beta3"
 | 
				
			||||||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
						metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
				
			||||||
	"k8s.io/apimachinery/pkg/runtime/schema"
 | 
						"k8s.io/apimachinery/pkg/runtime/schema"
 | 
				
			||||||
@@ -1304,65 +1302,32 @@ func TestValidateLimitedPriorityLevelConfiguration(t *testing.T) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	tests := []struct {
 | 
						tests := []struct {
 | 
				
			||||||
		requestVersion    schema.GroupVersion
 | 
							requestVersion    schema.GroupVersion
 | 
				
			||||||
		allowZero         bool
 | 
					 | 
				
			||||||
		concurrencyShares int32
 | 
							concurrencyShares int32
 | 
				
			||||||
		errExpected       field.ErrorList
 | 
							errExpected       field.ErrorList
 | 
				
			||||||
	}{{
 | 
						}{{
 | 
				
			||||||
		requestVersion:    flowcontrolv1beta1.SchemeGroupVersion,
 | 
					 | 
				
			||||||
		concurrencyShares: 0,
 | 
					 | 
				
			||||||
		errExpected:       errExpectedFn("assuredConcurrencyShares", 0, "must be positive"),
 | 
					 | 
				
			||||||
	}, {
 | 
					 | 
				
			||||||
		requestVersion:    flowcontrolv1beta2.SchemeGroupVersion,
 | 
					 | 
				
			||||||
		concurrencyShares: 0,
 | 
					 | 
				
			||||||
		errExpected:       errExpectedFn("assuredConcurrencyShares", 0, "must be positive"),
 | 
					 | 
				
			||||||
	}, {
 | 
					 | 
				
			||||||
		requestVersion:    flowcontrolv1beta3.SchemeGroupVersion,
 | 
							requestVersion:    flowcontrolv1beta3.SchemeGroupVersion,
 | 
				
			||||||
		concurrencyShares: 0,
 | 
							concurrencyShares: 0,
 | 
				
			||||||
		errExpected:       errExpectedFn("nominalConcurrencyShares", 0, "must be positive"),
 | 
					 | 
				
			||||||
	}, {
 | 
					 | 
				
			||||||
		requestVersion:    flowcontrolv1.SchemeGroupVersion,
 | 
					 | 
				
			||||||
		concurrencyShares: 0,
 | 
					 | 
				
			||||||
		errExpected:       errExpectedFn("nominalConcurrencyShares", 0, "must be positive"),
 | 
					 | 
				
			||||||
	}, {
 | 
					 | 
				
			||||||
		requestVersion:    flowcontrolv1beta3.SchemeGroupVersion,
 | 
					 | 
				
			||||||
		concurrencyShares: 100,
 | 
					 | 
				
			||||||
		errExpected:       nil,
 | 
					 | 
				
			||||||
	}, {
 | 
					 | 
				
			||||||
		requestVersion:    flowcontrolv1beta3.SchemeGroupVersion,
 | 
					 | 
				
			||||||
		allowZero:         true,
 | 
					 | 
				
			||||||
		concurrencyShares: 0,
 | 
					 | 
				
			||||||
		errExpected:       nil,
 | 
							errExpected:       nil,
 | 
				
			||||||
	}, {
 | 
						}, {
 | 
				
			||||||
		requestVersion:    flowcontrolv1beta3.SchemeGroupVersion,
 | 
							requestVersion:    flowcontrolv1beta3.SchemeGroupVersion,
 | 
				
			||||||
		allowZero:         true,
 | 
					 | 
				
			||||||
		concurrencyShares: -1,
 | 
							concurrencyShares: -1,
 | 
				
			||||||
		errExpected:       errExpectedFn("nominalConcurrencyShares", -1, "must be a non-negative integer"),
 | 
							errExpected:       errExpectedFn("nominalConcurrencyShares", -1, "must be a non-negative integer"),
 | 
				
			||||||
	}, {
 | 
						}, {
 | 
				
			||||||
		requestVersion:    flowcontrolv1beta3.SchemeGroupVersion,
 | 
							requestVersion:    flowcontrolv1beta3.SchemeGroupVersion,
 | 
				
			||||||
		allowZero:         true,
 | 
					 | 
				
			||||||
		concurrencyShares: 1,
 | 
							concurrencyShares: 1,
 | 
				
			||||||
		errExpected:       nil,
 | 
							errExpected:       nil,
 | 
				
			||||||
	}, {
 | 
						}, {
 | 
				
			||||||
		requestVersion:    flowcontrolv1.SchemeGroupVersion,
 | 
							requestVersion:    flowcontrolv1.SchemeGroupVersion,
 | 
				
			||||||
		allowZero:         true,
 | 
					 | 
				
			||||||
		concurrencyShares: 0,
 | 
							concurrencyShares: 0,
 | 
				
			||||||
		errExpected:       nil,
 | 
							errExpected:       nil,
 | 
				
			||||||
	}, {
 | 
						}, {
 | 
				
			||||||
		requestVersion:    flowcontrolv1.SchemeGroupVersion,
 | 
							requestVersion:    flowcontrolv1.SchemeGroupVersion,
 | 
				
			||||||
		allowZero:         true,
 | 
					 | 
				
			||||||
		concurrencyShares: -1,
 | 
							concurrencyShares: -1,
 | 
				
			||||||
		errExpected:       errExpectedFn("nominalConcurrencyShares", -1, "must be a non-negative integer"),
 | 
							errExpected:       errExpectedFn("nominalConcurrencyShares", -1, "must be a non-negative integer"),
 | 
				
			||||||
	}, {
 | 
						}, {
 | 
				
			||||||
		requestVersion:    flowcontrolv1.SchemeGroupVersion,
 | 
							requestVersion:    flowcontrolv1.SchemeGroupVersion,
 | 
				
			||||||
		allowZero:         true,
 | 
					 | 
				
			||||||
		concurrencyShares: 1,
 | 
							concurrencyShares: 1,
 | 
				
			||||||
		errExpected:       nil,
 | 
							errExpected:       nil,
 | 
				
			||||||
	}, {
 | 
					 | 
				
			||||||
		// 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", 0, "must be positive"),
 | 
					 | 
				
			||||||
	}}
 | 
						}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for _, test := range tests {
 | 
						for _, test := range tests {
 | 
				
			||||||
@@ -1375,7 +1340,7 @@ func TestValidateLimitedPriorityLevelConfiguration(t *testing.T) {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			specPath := field.NewPath("spec").Child("limited")
 | 
								specPath := field.NewPath("spec").Child("limited")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			errGot := ValidateLimitedPriorityLevelConfiguration(configuration, test.requestVersion, specPath, PriorityLevelValidationOptions{AllowZeroLimitedNominalConcurrencyShares: test.allowZero})
 | 
								errGot := ValidateLimitedPriorityLevelConfiguration(configuration, test.requestVersion, specPath, PriorityLevelValidationOptions{})
 | 
				
			||||||
			if !cmp.Equal(test.errExpected, errGot) {
 | 
								if !cmp.Equal(test.errExpected, errGot) {
 | 
				
			||||||
				t.Errorf("Expected error: %v, diff: %s", test.errExpected, cmp.Diff(test.errExpected, errGot))
 | 
									t.Errorf("Expected error: %v, diff: %s", test.errExpected, cmp.Diff(test.errExpected, errGot))
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -334,11 +334,6 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
 | 
				
			|||||||
		{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta},
 | 
							{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta},
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	genericfeatures.ZeroLimitedNominalConcurrencyShares: {
 | 
					 | 
				
			||||||
		{Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Beta},
 | 
					 | 
				
			||||||
		{Version: version.MustParse("1.30"), Default: true, PreRelease: featuregate.GA, LockToDefault: true},
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	GracefulNodeShutdown: {
 | 
						GracefulNodeShutdown: {
 | 
				
			||||||
		{Version: version.MustParse("1.20"), Default: false, PreRelease: featuregate.Alpha},
 | 
							{Version: version.MustParse("1.20"), Default: false, PreRelease: featuregate.Alpha},
 | 
				
			||||||
		{Version: version.MustParse("1.21"), Default: true, PreRelease: featuregate.Beta},
 | 
							{Version: version.MustParse("1.21"), Default: true, PreRelease: featuregate.Beta},
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -94,14 +94,7 @@ func (priorityLevelConfigurationStrategy) Validate(ctx context.Context, obj runt
 | 
				
			|||||||
	// That means we should not allow 0 values to be introduced, either
 | 
						// That means we should not allow 0 values to be introduced, either
 | 
				
			||||||
	// via v1 or v1beta3(with the roundtrip annotation) until we know
 | 
						// via v1 or v1beta3(with the roundtrip annotation) until we know
 | 
				
			||||||
	// all servers are at 1.29+ and will honor the zero value correctly.
 | 
						// all servers are at 1.29+ and will honor the zero value correctly.
 | 
				
			||||||
	//
 | 
						opts := validation.PriorityLevelValidationOptions{}
 | 
				
			||||||
	// TODO(121510): 1.29: don't allow a zero value, either via v1 or
 | 
					 | 
				
			||||||
	//  v1beta3 (with the roundtrip annotation) for the
 | 
					 | 
				
			||||||
	//  'nominalConcurrencyShares' field of 'limited' for CREATE operation.
 | 
					 | 
				
			||||||
	//  1:30: lift this restriction, allow zero value via v1 or v1beta3
 | 
					 | 
				
			||||||
	opts := validation.PriorityLevelValidationOptions{
 | 
					 | 
				
			||||||
		AllowZeroLimitedNominalConcurrencyShares: true,
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return validation.ValidatePriorityLevelConfiguration(obj.(*flowcontrol.PriorityLevelConfiguration), getRequestGroupVersion(ctx), opts)
 | 
						return validation.ValidatePriorityLevelConfiguration(obj.(*flowcontrol.PriorityLevelConfiguration), getRequestGroupVersion(ctx), opts)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -134,15 +127,7 @@ func (priorityLevelConfigurationStrategy) ValidateUpdate(ctx context.Context, ob
 | 
				
			|||||||
	// That means we should not allow 0 values to be introduced, either
 | 
						// That means we should not allow 0 values to be introduced, either
 | 
				
			||||||
	// via v1 or v1beta3(with the roundtrip annotation) until we know
 | 
						// via v1 or v1beta3(with the roundtrip annotation) until we know
 | 
				
			||||||
	// all servers are at 1.29+ and will honor the zero value correctly.
 | 
						// all servers are at 1.29+ and will honor the zero value correctly.
 | 
				
			||||||
	//
 | 
						opts := validation.PriorityLevelValidationOptions{}
 | 
				
			||||||
	// TODO(121510): 1.29: only allow a zero value, either via v1 or
 | 
					 | 
				
			||||||
	//  v1beta3 (with the roundtrip annotation) for the
 | 
					 | 
				
			||||||
	//  'nominalConcurrencyShares' field of 'limited' for UPDATE operation,
 | 
					 | 
				
			||||||
	//  only if the existing object already contains a zero value.
 | 
					 | 
				
			||||||
	//  1:30: lift this restriction, allow zero value via v1 or v1beta3
 | 
					 | 
				
			||||||
	opts := validation.PriorityLevelValidationOptions{
 | 
					 | 
				
			||||||
		AllowZeroLimitedNominalConcurrencyShares: true,
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	return validation.ValidatePriorityLevelConfiguration(newPL, getRequestGroupVersion(ctx), opts)
 | 
						return validation.ValidatePriorityLevelConfiguration(newPL, getRequestGroupVersion(ctx), opts)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -226,13 +226,6 @@ const (
 | 
				
			|||||||
	//
 | 
						//
 | 
				
			||||||
	// Allow the API server to serve consistent lists from cache
 | 
						// Allow the API server to serve consistent lists from cache
 | 
				
			||||||
	ConsistentListFromCache featuregate.Feature = "ConsistentListFromCache"
 | 
						ConsistentListFromCache featuregate.Feature = "ConsistentListFromCache"
 | 
				
			||||||
 | 
					 | 
				
			||||||
	// owner: @tkashem
 | 
					 | 
				
			||||||
	//
 | 
					 | 
				
			||||||
	// Allow Priority & Fairness in the API server to use a zero value for
 | 
					 | 
				
			||||||
	// the 'nominalConcurrencyShares' field of the 'limited' section of a
 | 
					 | 
				
			||||||
	// priority level.
 | 
					 | 
				
			||||||
	ZeroLimitedNominalConcurrencyShares featuregate.Feature = "ZeroLimitedNominalConcurrencyShares"
 | 
					 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
@@ -398,11 +391,6 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
 | 
				
			|||||||
		{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha},
 | 
							{Version: version.MustParse("1.27"), Default: false, PreRelease: featuregate.Alpha},
 | 
				
			||||||
		{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta},
 | 
							{Version: version.MustParse("1.32"), Default: true, PreRelease: featuregate.Beta},
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
 | 
					 | 
				
			||||||
	ZeroLimitedNominalConcurrencyShares: {
 | 
					 | 
				
			||||||
		{Version: version.MustParse("1.29"), Default: false, PreRelease: featuregate.Beta},
 | 
					 | 
				
			||||||
		{Version: version.MustParse("1.30"), Default: true, PreRelease: featuregate.GA, LockToDefault: true},
 | 
					 | 
				
			||||||
	},
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// defaultKubernetesFeatureGates consists of legacy unversioned Kubernetes-specific feature keys.
 | 
					// defaultKubernetesFeatureGates consists of legacy unversioned Kubernetes-specific feature keys.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1350,13 +1350,3 @@
 | 
				
			|||||||
    lockToDefault: false
 | 
					    lockToDefault: false
 | 
				
			||||||
    preRelease: Beta
 | 
					    preRelease: Beta
 | 
				
			||||||
    version: "1.20"
 | 
					    version: "1.20"
 | 
				
			||||||
- name: ZeroLimitedNominalConcurrencyShares
 | 
					 | 
				
			||||||
  versionedSpecs:
 | 
					 | 
				
			||||||
  - default: false
 | 
					 | 
				
			||||||
    lockToDefault: false
 | 
					 | 
				
			||||||
    preRelease: Beta
 | 
					 | 
				
			||||||
    version: "1.29"
 | 
					 | 
				
			||||||
  - default: true
 | 
					 | 
				
			||||||
    lockToDefault: true
 | 
					 | 
				
			||||||
    preRelease: GA
 | 
					 | 
				
			||||||
    version: "1.30"
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user