Merge pull request #126136 from cici37/removeFG
Remove feature gate CustomResourceValidationExpressions
This commit is contained in:
		
							
								
								
									
										2
									
								
								api/openapi-spec/swagger.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								api/openapi-spec/swagger.json
									
									
									
										generated
									
									
									
								
							| @@ -17553,7 +17553,7 @@ | ||||
|           "type": "boolean" | ||||
|         }, | ||||
|         "x-kubernetes-validations": { | ||||
|           "description": "x-kubernetes-validations describes a list of validation rules written in the CEL expression language. This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled.", | ||||
|           "description": "x-kubernetes-validations describes a list of validation rules written in the CEL expression language.", | ||||
|           "items": { | ||||
|             "$ref": "#/definitions/io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.ValidationRule" | ||||
|           }, | ||||
|   | ||||
| @@ -713,7 +713,7 @@ | ||||
|             "type": "boolean" | ||||
|           }, | ||||
|           "x-kubernetes-validations": { | ||||
|             "description": "x-kubernetes-validations describes a list of validation rules written in the CEL expression language. This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled.", | ||||
|             "description": "x-kubernetes-validations describes a list of validation rules written in the CEL expression language.", | ||||
|             "items": { | ||||
|               "allOf": [ | ||||
|                 { | ||||
|   | ||||
| @@ -265,7 +265,7 @@ fi | ||||
| RUN_CCM_CONTROLLERS="${RUN_CCM_CONTROLLERS:-*,-gkenetworkparamset}" | ||||
|  | ||||
| # List of the set of feature gates recognized by the GCP CCM | ||||
| export CCM_FEATURE_GATES="APIPriorityAndFairness,APIResponseCompression,APIServerIdentity,APIServerTracing,AllAlpha,AllBeta,CustomResourceValidationExpressions,KMSv2,OpenAPIEnums,OpenAPIV3,ServerSideFieldValidation,StorageVersionAPI,StorageVersionHash" | ||||
| export CCM_FEATURE_GATES="APIPriorityAndFairness,APIResponseCompression,APIServerIdentity,APIServerTracing,AllAlpha,AllBeta,KMSv2,OpenAPIEnums,OpenAPIV3,ServerSideFieldValidation,StorageVersionAPI,StorageVersionHash" | ||||
|  | ||||
| # Optional: set feature gates | ||||
| # shellcheck disable=SC2034 # Variables sourced in other scripts. | ||||
|   | ||||
| @@ -316,7 +316,7 @@ if [[ -n "${NODE_ACCELERATORS}" ]]; then | ||||
| fi | ||||
|  | ||||
| # List of the set of feature gates recognized by the GCP CCM | ||||
| export CCM_FEATURE_GATES="APIPriorityAndFairness,APIResponseCompression,APIServerIdentity,APIServerTracing,AllAlpha,AllBeta,CustomResourceValidationExpressions,KMSv2,OpenAPIEnums,OpenAPIV3,ServerSideFieldValidation,StorageVersionAPI,StorageVersionHash" | ||||
| export CCM_FEATURE_GATES="APIPriorityAndFairness,APIResponseCompression,APIServerIdentity,APIServerTracing,AllAlpha,AllBeta,KMSv2,OpenAPIEnums,OpenAPIV3,ServerSideFieldValidation,StorageVersionAPI,StorageVersionHash" | ||||
|  | ||||
| # Optional: Install cluster DNS. | ||||
| # Set CLUSTER_DNS_CORE_DNS to 'false' to install kube-dns instead of CoreDNS. | ||||
|   | ||||
| @@ -1267,8 +1267,6 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS | ||||
|  | ||||
| 	genericfeatures.ConsistentListFromCache: {Default: false, PreRelease: featuregate.Alpha}, | ||||
|  | ||||
| 	genericfeatures.CustomResourceValidationExpressions: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.31 | ||||
|  | ||||
| 	genericfeatures.EfficientWatchResumption: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, | ||||
|  | ||||
| 	genericfeatures.KMSv1: {Default: false, PreRelease: featuregate.Deprecated}, | ||||
|   | ||||
							
								
								
									
										4
									
								
								pkg/generated/openapi/zz_generated.openapi.go
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								pkg/generated/openapi/zz_generated.openapi.go
									
									
									
										generated
									
									
									
								
							| @@ -51670,7 +51670,7 @@ func schema_pkg_apis_apiextensions_v1_JSONSchemaProps(ref common.ReferenceCallba | ||||
| 							}, | ||||
| 						}, | ||||
| 						SchemaProps: spec.SchemaProps{ | ||||
| 							Description: "x-kubernetes-validations describes a list of validation rules written in the CEL expression language. This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled.", | ||||
| 							Description: "x-kubernetes-validations describes a list of validation rules written in the CEL expression language.", | ||||
| 							Type:        []string{"array"}, | ||||
| 							Items: &spec.SchemaOrArray{ | ||||
| 								Schema: &spec.Schema{ | ||||
| @@ -53225,7 +53225,7 @@ func schema_pkg_apis_apiextensions_v1beta1_JSONSchemaProps(ref common.ReferenceC | ||||
| 							}, | ||||
| 						}, | ||||
| 						SchemaProps: spec.SchemaProps{ | ||||
| 							Description: "x-kubernetes-validations describes a list of validation rules written in the CEL expression language. This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled.", | ||||
| 							Description: "x-kubernetes-validations describes a list of validation rules written in the CEL expression language.", | ||||
| 							Type:        []string{"array"}, | ||||
| 							Items: &spec.SchemaOrArray{ | ||||
| 								Schema: &spec.Schema{ | ||||
|   | ||||
| @@ -144,7 +144,6 @@ type JSONSchemaProps struct { | ||||
| 	XMapType *string | ||||
|  | ||||
| 	// x-kubernetes-validations -kubernetes-validations describes a list of validation rules written in the CEL expression language. | ||||
| 	// This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled. | ||||
| 	// +patchMergeKey=rule | ||||
| 	// +patchStrategy=merge | ||||
| 	// +listType=map | ||||
|   | ||||
| @@ -573,7 +573,6 @@ message JSONSchemaProps { | ||||
|   optional string xKubernetesMapType = 43; | ||||
|  | ||||
|   // x-kubernetes-validations describes a list of validation rules written in the CEL expression language. | ||||
|   // This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled. | ||||
|   // +patchMergeKey=rule | ||||
|   // +patchStrategy=merge | ||||
|   // +listType=map | ||||
|   | ||||
| @@ -189,7 +189,6 @@ type JSONSchemaProps struct { | ||||
| 	XMapType *string `json:"x-kubernetes-map-type,omitempty" protobuf:"bytes,43,opt,name=xKubernetesMapType"` | ||||
|  | ||||
| 	// x-kubernetes-validations describes a list of validation rules written in the CEL expression language. | ||||
| 	// This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled. | ||||
| 	// +patchMergeKey=rule | ||||
| 	// +patchStrategy=merge | ||||
| 	// +listType=map | ||||
|   | ||||
| @@ -634,7 +634,6 @@ message JSONSchemaProps { | ||||
|   optional string xKubernetesMapType = 43; | ||||
|  | ||||
|   // x-kubernetes-validations describes a list of validation rules written in the CEL expression language. | ||||
|   // This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled. | ||||
|   // +patchMergeKey=rule | ||||
|   // +patchStrategy=merge | ||||
|   // +listType=map | ||||
|   | ||||
| @@ -189,7 +189,6 @@ type JSONSchemaProps struct { | ||||
| 	XMapType *string `json:"x-kubernetes-map-type,omitempty" protobuf:"bytes,43,opt,name=xKubernetesMapType"` | ||||
|  | ||||
| 	// x-kubernetes-validations describes a list of validation rules written in the CEL expression language. | ||||
| 	// This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled. | ||||
| 	// +patchMergeKey=rule | ||||
| 	// +patchStrategy=merge | ||||
| 	// +listType=map | ||||
|   | ||||
| @@ -2301,7 +2301,7 @@ func schema_pkg_apis_apiextensions_v1_JSONSchemaProps(ref common.ReferenceCallba | ||||
| 							}, | ||||
| 						}, | ||||
| 						SchemaProps: spec.SchemaProps{ | ||||
| 							Description: "x-kubernetes-validations describes a list of validation rules written in the CEL expression language. This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled.", | ||||
| 							Description: "x-kubernetes-validations describes a list of validation rules written in the CEL expression language.", | ||||
| 							Type:        []string{"array"}, | ||||
| 							Items: &spec.SchemaOrArray{ | ||||
| 								Schema: &spec.Schema{ | ||||
| @@ -3856,7 +3856,7 @@ func schema_pkg_apis_apiextensions_v1beta1_JSONSchemaProps(ref common.ReferenceC | ||||
| 							}, | ||||
| 						}, | ||||
| 						SchemaProps: spec.SchemaProps{ | ||||
| 							Description: "x-kubernetes-validations describes a list of validation rules written in the CEL expression language. This field is an alpha-level. Using this field requires the feature gate `CustomResourceValidationExpressions` to be enabled.", | ||||
| 							Description: "x-kubernetes-validations describes a list of validation rules written in the CEL expression language.", | ||||
| 							Type:        []string{"array"}, | ||||
| 							Items: &spec.SchemaOrArray{ | ||||
| 								Schema: &spec.Schema{ | ||||
|   | ||||
| @@ -44,7 +44,6 @@ import ( | ||||
| 	"k8s.io/apimachinery/pkg/util/validation/field" | ||||
| 	celconfig "k8s.io/apiserver/pkg/apis/cel" | ||||
| 	"k8s.io/apiserver/pkg/cel/common" | ||||
| 	"k8s.io/apiserver/pkg/features" | ||||
| 	"k8s.io/apiserver/pkg/registry/generic" | ||||
| 	apiserverstorage "k8s.io/apiserver/pkg/storage" | ||||
| 	"k8s.io/apiserver/pkg/storage/names" | ||||
| @@ -76,9 +75,7 @@ type selectableField struct { | ||||
|  | ||||
| func NewStrategy(typer runtime.ObjectTyper, namespaceScoped bool, kind schema.GroupVersionKind, schemaValidator, statusSchemaValidator validation.SchemaValidator, structuralSchema *structuralschema.Structural, status *apiextensions.CustomResourceSubresourceStatus, scale *apiextensions.CustomResourceSubresourceScale, selectableFields []v1.SelectableField) customResourceStrategy { | ||||
| 	var celValidator *cel.Validator | ||||
| 	if utilfeature.DefaultFeatureGate.Enabled(features.CustomResourceValidationExpressions) { | ||||
| 		celValidator = cel.NewValidator(structuralSchema, true, celconfig.PerCallLimit) // CEL programs are compiled and cached here | ||||
| 	} | ||||
| 	celValidator = cel.NewValidator(structuralSchema, true, celconfig.PerCallLimit) // CEL programs are compiled and cached here | ||||
|  | ||||
| 	strategy := customResourceStrategy{ | ||||
| 		ObjectTyper:     typer, | ||||
|   | ||||
| @@ -112,15 +112,6 @@ const ( | ||||
| 	// Enables expression validation in Admission Control | ||||
| 	ValidatingAdmissionPolicy featuregate.Feature = "ValidatingAdmissionPolicy" | ||||
|  | ||||
| 	// owner: @cici37 | ||||
| 	// kep: https://kep.k8s.io/2876 | ||||
| 	// alpha: v1.23 | ||||
| 	// beta: v1.25 | ||||
| 	// stable: v1.29 | ||||
| 	// | ||||
| 	// Enables expression validation for Custom Resource | ||||
| 	CustomResourceValidationExpressions featuregate.Feature = "CustomResourceValidationExpressions" | ||||
|  | ||||
| 	// alpha: v1.20 | ||||
| 	// beta: v1.21 | ||||
| 	// GA: v1.24 | ||||
| @@ -369,8 +360,6 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS | ||||
|  | ||||
| 	ValidatingAdmissionPolicy: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.32 | ||||
|  | ||||
| 	CustomResourceValidationExpressions: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.31 | ||||
|  | ||||
| 	EfficientWatchResumption: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, | ||||
|  | ||||
| 	KMSv1: {Default: false, PreRelease: featuregate.Deprecated}, | ||||
|   | ||||
| @@ -30,12 +30,8 @@ import ( | ||||
| 	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||||
| 	"k8s.io/apimachinery/pkg/runtime/schema" | ||||
| 	"k8s.io/apimachinery/pkg/util/json" | ||||
| 	genericfeatures "k8s.io/apiserver/pkg/features" | ||||
| 	"k8s.io/apiserver/pkg/storage/names" | ||||
| 	utilfeature "k8s.io/apiserver/pkg/util/feature" | ||||
| 	"k8s.io/client-go/dynamic" | ||||
| 	featuregatetesting "k8s.io/component-base/featuregate/testing" | ||||
|  | ||||
| 	apiservertesting "k8s.io/kubernetes/cmd/kube-apiserver/app/testing" | ||||
| 	"k8s.io/kubernetes/test/integration/framework" | ||||
| ) | ||||
| @@ -43,8 +39,6 @@ import ( | ||||
| // TestCustomResourceValidators tests x-kubernetes-validations compile and validate as expected when the feature gate | ||||
| // is enabled. | ||||
| func TestCustomResourceValidators(t *testing.T) { | ||||
| 	featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.CustomResourceValidationExpressions, true) | ||||
|  | ||||
| 	server, err := apiservertesting.StartTestServer(t, apiservertesting.NewDefaultTestServerOptions(), nil, framework.SharedEtcd()) | ||||
| 	if err != nil { | ||||
| 		t.Fatal(err) | ||||
| @@ -426,8 +420,6 @@ func TestCustomResourceValidators(t *testing.T) { | ||||
| // TestCustomResourceValidatorsWithBlockingErrors tests x-kubernetes-validations is skipped when | ||||
| // blocking errors occurred. | ||||
| func TestCustomResourceValidatorsWithBlockingErrors(t *testing.T) { | ||||
| 	featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.CustomResourceValidationExpressions, true) | ||||
|  | ||||
| 	server, err := apiservertesting.StartTestServer(t, apiservertesting.NewDefaultTestServerOptions(), nil, framework.SharedEtcd()) | ||||
| 	if err != nil { | ||||
| 		t.Fatal(err) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Kubernetes Prow Robot
					Kubernetes Prow Robot