mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-21 01:26:28 +00:00
Remove feature gate CustomResourceValidationExpressions.
This commit is contained in:
parent
1904a56e30
commit
67a171a142
@ -265,7 +265,7 @@ fi
|
|||||||
RUN_CCM_CONTROLLERS="${RUN_CCM_CONTROLLERS:-*,-gkenetworkparamset}"
|
RUN_CCM_CONTROLLERS="${RUN_CCM_CONTROLLERS:-*,-gkenetworkparamset}"
|
||||||
|
|
||||||
# List of the set of feature gates recognized by the GCP CCM
|
# 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
|
# Optional: set feature gates
|
||||||
# shellcheck disable=SC2034 # Variables sourced in other scripts.
|
# shellcheck disable=SC2034 # Variables sourced in other scripts.
|
||||||
|
@ -316,7 +316,7 @@ if [[ -n "${NODE_ACCELERATORS}" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# List of the set of feature gates recognized by the GCP CCM
|
# 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.
|
# Optional: Install cluster DNS.
|
||||||
# Set CLUSTER_DNS_CORE_DNS to 'false' to install kube-dns instead of CoreDNS.
|
# Set CLUSTER_DNS_CORE_DNS to 'false' to install kube-dns instead of CoreDNS.
|
||||||
|
@ -1236,8 +1236,6 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
|
|
||||||
genericfeatures.ConsistentListFromCache: {Default: true, PreRelease: featuregate.Beta},
|
genericfeatures.ConsistentListFromCache: {Default: true, PreRelease: featuregate.Beta},
|
||||||
|
|
||||||
genericfeatures.CustomResourceValidationExpressions: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.31
|
|
||||||
|
|
||||||
genericfeatures.EfficientWatchResumption: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
genericfeatures.EfficientWatchResumption: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
||||||
|
|
||||||
genericfeatures.KMSv1: {Default: false, PreRelease: featuregate.Deprecated},
|
genericfeatures.KMSv1: {Default: false, PreRelease: featuregate.Deprecated},
|
||||||
|
@ -144,7 +144,6 @@ type JSONSchemaProps struct {
|
|||||||
XMapType *string
|
XMapType *string
|
||||||
|
|
||||||
// x-kubernetes-validations -kubernetes-validations describes a list of validation rules written in the CEL expression language.
|
// 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
|
// +patchMergeKey=rule
|
||||||
// +patchStrategy=merge
|
// +patchStrategy=merge
|
||||||
// +listType=map
|
// +listType=map
|
||||||
|
@ -189,7 +189,6 @@ type JSONSchemaProps struct {
|
|||||||
XMapType *string `json:"x-kubernetes-map-type,omitempty" protobuf:"bytes,43,opt,name=xKubernetesMapType"`
|
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.
|
// 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
|
// +patchMergeKey=rule
|
||||||
// +patchStrategy=merge
|
// +patchStrategy=merge
|
||||||
// +listType=map
|
// +listType=map
|
||||||
|
@ -189,7 +189,6 @@ type JSONSchemaProps struct {
|
|||||||
XMapType *string `json:"x-kubernetes-map-type,omitempty" protobuf:"bytes,43,opt,name=xKubernetesMapType"`
|
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.
|
// 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
|
// +patchMergeKey=rule
|
||||||
// +patchStrategy=merge
|
// +patchStrategy=merge
|
||||||
// +listType=map
|
// +listType=map
|
||||||
|
@ -44,7 +44,6 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||||
celconfig "k8s.io/apiserver/pkg/apis/cel"
|
celconfig "k8s.io/apiserver/pkg/apis/cel"
|
||||||
"k8s.io/apiserver/pkg/cel/common"
|
"k8s.io/apiserver/pkg/cel/common"
|
||||||
"k8s.io/apiserver/pkg/features"
|
|
||||||
"k8s.io/apiserver/pkg/registry/generic"
|
"k8s.io/apiserver/pkg/registry/generic"
|
||||||
apiserverstorage "k8s.io/apiserver/pkg/storage"
|
apiserverstorage "k8s.io/apiserver/pkg/storage"
|
||||||
"k8s.io/apiserver/pkg/storage/names"
|
"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 {
|
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
|
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{
|
strategy := customResourceStrategy{
|
||||||
ObjectTyper: typer,
|
ObjectTyper: typer,
|
||||||
|
@ -105,15 +105,6 @@ const (
|
|||||||
// Enables expression validation in Admission Control
|
// Enables expression validation in Admission Control
|
||||||
ValidatingAdmissionPolicy featuregate.Feature = "ValidatingAdmissionPolicy"
|
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
|
// alpha: v1.20
|
||||||
// beta: v1.21
|
// beta: v1.21
|
||||||
// GA: v1.24
|
// GA: v1.24
|
||||||
@ -362,8 +353,6 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
|
|||||||
|
|
||||||
ValidatingAdmissionPolicy: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.32
|
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},
|
EfficientWatchResumption: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
|
||||||
|
|
||||||
KMSv1: {Default: false, PreRelease: featuregate.Deprecated},
|
KMSv1: {Default: false, PreRelease: featuregate.Deprecated},
|
||||||
|
@ -30,12 +30,8 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apimachinery/pkg/util/json"
|
"k8s.io/apimachinery/pkg/util/json"
|
||||||
genericfeatures "k8s.io/apiserver/pkg/features"
|
|
||||||
"k8s.io/apiserver/pkg/storage/names"
|
"k8s.io/apiserver/pkg/storage/names"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
|
||||||
"k8s.io/client-go/dynamic"
|
"k8s.io/client-go/dynamic"
|
||||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
|
||||||
|
|
||||||
apiservertesting "k8s.io/kubernetes/cmd/kube-apiserver/app/testing"
|
apiservertesting "k8s.io/kubernetes/cmd/kube-apiserver/app/testing"
|
||||||
"k8s.io/kubernetes/test/integration/framework"
|
"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
|
// TestCustomResourceValidators tests x-kubernetes-validations compile and validate as expected when the feature gate
|
||||||
// is enabled.
|
// is enabled.
|
||||||
func TestCustomResourceValidators(t *testing.T) {
|
func TestCustomResourceValidators(t *testing.T) {
|
||||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.CustomResourceValidationExpressions, true)
|
|
||||||
|
|
||||||
server, err := apiservertesting.StartTestServer(t, apiservertesting.NewDefaultTestServerOptions(), nil, framework.SharedEtcd())
|
server, err := apiservertesting.StartTestServer(t, apiservertesting.NewDefaultTestServerOptions(), nil, framework.SharedEtcd())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -426,8 +420,6 @@ func TestCustomResourceValidators(t *testing.T) {
|
|||||||
// TestCustomResourceValidatorsWithBlockingErrors tests x-kubernetes-validations is skipped when
|
// TestCustomResourceValidatorsWithBlockingErrors tests x-kubernetes-validations is skipped when
|
||||||
// blocking errors occurred.
|
// blocking errors occurred.
|
||||||
func TestCustomResourceValidatorsWithBlockingErrors(t *testing.T) {
|
func TestCustomResourceValidatorsWithBlockingErrors(t *testing.T) {
|
||||||
featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, genericfeatures.CustomResourceValidationExpressions, true)
|
|
||||||
|
|
||||||
server, err := apiservertesting.StartTestServer(t, apiservertesting.NewDefaultTestServerOptions(), nil, framework.SharedEtcd())
|
server, err := apiservertesting.StartTestServer(t, apiservertesting.NewDefaultTestServerOptions(), nil, framework.SharedEtcd())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
|
Loading…
Reference in New Issue
Block a user