mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	remove feature gate GA for 1.25
Signed-off-by: cyclinder qifeng.guo@daocloud.io
This commit is contained in:
		@@ -23,22 +23,13 @@ package app
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
 | 
			
		||||
	"k8s.io/klog/v2"
 | 
			
		||||
 | 
			
		||||
	utilfeature "k8s.io/apiserver/pkg/util/feature"
 | 
			
		||||
	"k8s.io/client-go/dynamic"
 | 
			
		||||
	"k8s.io/client-go/scale"
 | 
			
		||||
	"k8s.io/controller-manager/controller"
 | 
			
		||||
	"k8s.io/kubernetes/pkg/controller/disruption"
 | 
			
		||||
	kubefeatures "k8s.io/kubernetes/pkg/features"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
func startDisruptionController(ctx context.Context, controllerContext ControllerContext) (controller.Interface, bool, error) {
 | 
			
		||||
	if !utilfeature.DefaultFeatureGate.Enabled(kubefeatures.PodDisruptionBudget) {
 | 
			
		||||
		klog.InfoS("Refusing to start disruption because the PodDisruptionBudget feature is disabled")
 | 
			
		||||
		return nil, false, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	client := controllerContext.ClientBuilder.ClientOrDie("disruption-controller")
 | 
			
		||||
	config := controllerContext.ClientBuilder.ConfigOrDie("disruption-controller")
 | 
			
		||||
	scaleKindResolver := scale.NewDiscoveryScaleKindResolver(client.Discovery())
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ func SetDefaults_CSIDriver(obj *storagev1.CSIDriver) {
 | 
			
		||||
		obj.Spec.StorageCapacity = new(bool)
 | 
			
		||||
		*(obj.Spec.StorageCapacity) = false
 | 
			
		||||
	}
 | 
			
		||||
	if obj.Spec.FSGroupPolicy == nil && utilfeature.DefaultFeatureGate.Enabled(features.CSIVolumeFSGroupPolicy) {
 | 
			
		||||
	if obj.Spec.FSGroupPolicy == nil {
 | 
			
		||||
		obj.Spec.FSGroupPolicy = new(storagev1.FSGroupPolicy)
 | 
			
		||||
		*obj.Spec.FSGroupPolicy = storagev1.ReadWriteOnceWithFSTypeFSGroupPolicy
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ func SetDefaults_CSIDriver(obj *storagev1beta1.CSIDriver) {
 | 
			
		||||
		obj.Spec.StorageCapacity = new(bool)
 | 
			
		||||
		*(obj.Spec.StorageCapacity) = false
 | 
			
		||||
	}
 | 
			
		||||
	if obj.Spec.FSGroupPolicy == nil && utilfeature.DefaultFeatureGate.Enabled(features.CSIVolumeFSGroupPolicy) {
 | 
			
		||||
	if obj.Spec.FSGroupPolicy == nil {
 | 
			
		||||
		obj.Spec.FSGroupPolicy = new(storagev1beta1.FSGroupPolicy)
 | 
			
		||||
		*obj.Spec.FSGroupPolicy = storagev1beta1.ReadWriteOnceWithFSTypeFSGroupPolicy
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -177,14 +177,6 @@ const (
 | 
			
		||||
	// Enables tracking of available storage capacity that CSI drivers provide.
 | 
			
		||||
	CSIStorageCapacity featuregate.Feature = "CSIStorageCapacity"
 | 
			
		||||
 | 
			
		||||
	// owner: @huffmanca, @dobsonj
 | 
			
		||||
	// alpha: v1.19
 | 
			
		||||
	// beta: v1.20
 | 
			
		||||
	// GA: v1.23
 | 
			
		||||
	//
 | 
			
		||||
	// Determines if a CSI Driver supports applying fsGroup.
 | 
			
		||||
	CSIVolumeFSGroupPolicy featuregate.Feature = "CSIVolumeFSGroupPolicy"
 | 
			
		||||
 | 
			
		||||
	// owner: @fengzixu
 | 
			
		||||
	// alpha: v1.21
 | 
			
		||||
	//
 | 
			
		||||
@@ -198,14 +190,6 @@ const (
 | 
			
		||||
	// Allows clients to request a duration for certificates issued via the Kubernetes CSR API.
 | 
			
		||||
	CSRDuration featuregate.Feature = "CSRDuration"
 | 
			
		||||
 | 
			
		||||
	// owner: @gnufied
 | 
			
		||||
	// alpha: v1.18
 | 
			
		||||
	// beta: v1.20
 | 
			
		||||
	// GA: v1.23
 | 
			
		||||
	// Allows user to configure volume permission change policy for fsGroups when mounting
 | 
			
		||||
	// a volume in a Pod.
 | 
			
		||||
	ConfigurableFSGroupPolicy featuregate.Feature = "ConfigurableFSGroupPolicy"
 | 
			
		||||
 | 
			
		||||
	// owner: @jiahuif
 | 
			
		||||
	// alpha: v1.21
 | 
			
		||||
	// beta:  v1.22
 | 
			
		||||
@@ -616,13 +600,6 @@ const (
 | 
			
		||||
	// Enables controlling pod ranking on replicaset scale-down.
 | 
			
		||||
	PodDeletionCost featuregate.Feature = "PodDeletionCost"
 | 
			
		||||
 | 
			
		||||
	// owner: @mortent
 | 
			
		||||
	// alpha: v1.3
 | 
			
		||||
	// beta:  v1.5
 | 
			
		||||
	//
 | 
			
		||||
	// Enable all logic related to the PodDisruptionBudget API object in policy
 | 
			
		||||
	PodDisruptionBudget featuregate.Feature = "PodDisruptionBudget"
 | 
			
		||||
 | 
			
		||||
	// owner: @egernst
 | 
			
		||||
	// alpha: v1.16
 | 
			
		||||
	// beta: v1.18
 | 
			
		||||
@@ -862,14 +839,10 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
 | 
			
		||||
 | 
			
		||||
	CSIStorageCapacity: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.26
 | 
			
		||||
 | 
			
		||||
	CSIVolumeFSGroupPolicy: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.25
 | 
			
		||||
 | 
			
		||||
	CSIVolumeHealth: {Default: false, PreRelease: featuregate.Alpha},
 | 
			
		||||
 | 
			
		||||
	CSRDuration: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.26
 | 
			
		||||
 | 
			
		||||
	ConfigurableFSGroupPolicy: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.25
 | 
			
		||||
 | 
			
		||||
	ControllerManagerLeaderMigration: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.26
 | 
			
		||||
 | 
			
		||||
	CronJobTimeZone: {Default: false, PreRelease: featuregate.Alpha},
 | 
			
		||||
@@ -986,8 +959,6 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
 | 
			
		||||
 | 
			
		||||
	PodDeletionCost: {Default: true, PreRelease: featuregate.Beta},
 | 
			
		||||
 | 
			
		||||
	PodDisruptionBudget: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.25
 | 
			
		||||
 | 
			
		||||
	PodOverhead: {Default: true, PreRelease: featuregate.GA, LockToDefault: true}, // remove in 1.26
 | 
			
		||||
 | 
			
		||||
	PodSecurity: {Default: true, PreRelease: featuregate.Beta},
 | 
			
		||||
 
 | 
			
		||||
@@ -50,9 +50,6 @@ func (csiDriverStrategy) PrepareForCreate(ctx context.Context, obj runtime.Objec
 | 
			
		||||
	if !utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume) {
 | 
			
		||||
		csiDriver.Spec.VolumeLifecycleModes = nil
 | 
			
		||||
	}
 | 
			
		||||
	if !utilfeature.DefaultFeatureGate.Enabled(features.CSIVolumeFSGroupPolicy) {
 | 
			
		||||
		csiDriver.Spec.FSGroupPolicy = nil
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (csiDriverStrategy) Validate(ctx context.Context, obj runtime.Object) field.ErrorList {
 | 
			
		||||
@@ -85,10 +82,6 @@ func (csiDriverStrategy) PrepareForUpdate(ctx context.Context, obj, old runtime.
 | 
			
		||||
		!utilfeature.DefaultFeatureGate.Enabled(features.CSIInlineVolume) {
 | 
			
		||||
		newCSIDriver.Spec.VolumeLifecycleModes = nil
 | 
			
		||||
	}
 | 
			
		||||
	if oldCSIDriver.Spec.FSGroupPolicy == nil &&
 | 
			
		||||
		!utilfeature.DefaultFeatureGate.Enabled(features.CSIVolumeFSGroupPolicy) {
 | 
			
		||||
		newCSIDriver.Spec.FSGroupPolicy = nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Any changes to the mutable fields increment the generation number.
 | 
			
		||||
	if !apiequality.Semantic.DeepEqual(oldCSIDriver.Spec.TokenRequests, newCSIDriver.Spec.TokenRequests) || !apiequality.Semantic.DeepEqual(oldCSIDriver.Spec.RequiresRepublish, newCSIDriver.Spec.RequiresRepublish) {
 | 
			
		||||
 
 | 
			
		||||
@@ -76,7 +76,7 @@ func New(dpArgs runtime.Object, fh framework.Handle, fts feature.Features) (fram
 | 
			
		||||
		fh:        fh,
 | 
			
		||||
		args:      *args,
 | 
			
		||||
		podLister: fh.SharedInformerFactory().Core().V1().Pods().Lister(),
 | 
			
		||||
		pdbLister: getPDBLister(fh.SharedInformerFactory(), fts.EnablePodDisruptionBudget),
 | 
			
		||||
		pdbLister: getPDBLister(fh.SharedInformerFactory()),
 | 
			
		||||
	}
 | 
			
		||||
	return &pl, nil
 | 
			
		||||
}
 | 
			
		||||
@@ -314,9 +314,6 @@ func filterPodsWithPDBViolation(podInfos []*framework.PodInfo, pdbs []*policy.Po
 | 
			
		||||
	return violatingPodInfos, nonViolatingPodInfos
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func getPDBLister(informerFactory informers.SharedInformerFactory, enablePodDisruptionBudget bool) policylisters.PodDisruptionBudgetLister {
 | 
			
		||||
	if enablePodDisruptionBudget {
 | 
			
		||||
func getPDBLister(informerFactory informers.SharedInformerFactory) policylisters.PodDisruptionBudgetLister {
 | 
			
		||||
	return informerFactory.Policy().V1().PodDisruptionBudgets().Lister()
 | 
			
		||||
}
 | 
			
		||||
	return nil
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -365,7 +365,7 @@ func TestPostFilter(t *testing.T) {
 | 
			
		||||
			p := DefaultPreemption{
 | 
			
		||||
				fh:        f,
 | 
			
		||||
				podLister: informerFactory.Core().V1().Pods().Lister(),
 | 
			
		||||
				pdbLister: getPDBLister(informerFactory, true),
 | 
			
		||||
				pdbLister: getPDBLister(informerFactory),
 | 
			
		||||
				args:      *getDefaultDefaultPreemptionArgs(),
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@@ -1113,7 +1113,7 @@ func TestDryRunPreemption(t *testing.T) {
 | 
			
		||||
			pl := &DefaultPreemption{
 | 
			
		||||
				fh:        fwk,
 | 
			
		||||
				podLister: informerFactory.Core().V1().Pods().Lister(),
 | 
			
		||||
				pdbLister: getPDBLister(informerFactory, true),
 | 
			
		||||
				pdbLister: getPDBLister(informerFactory),
 | 
			
		||||
				args:      *tt.args,
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@@ -1361,7 +1361,7 @@ func TestSelectBestCandidate(t *testing.T) {
 | 
			
		||||
			pl := &DefaultPreemption{
 | 
			
		||||
				fh:        fwk,
 | 
			
		||||
				podLister: informerFactory.Core().V1().Pods().Lister(),
 | 
			
		||||
				pdbLister: getPDBLister(informerFactory, true),
 | 
			
		||||
				pdbLister: getPDBLister(informerFactory),
 | 
			
		||||
				args:      *getDefaultDefaultPreemptionArgs(),
 | 
			
		||||
			}
 | 
			
		||||
			pe := preemption.Evaluator{
 | 
			
		||||
@@ -1698,7 +1698,7 @@ func TestPreempt(t *testing.T) {
 | 
			
		||||
			pl := DefaultPreemption{
 | 
			
		||||
				fh:        fwk,
 | 
			
		||||
				podLister: informerFactory.Core().V1().Pods().Lister(),
 | 
			
		||||
				pdbLister: getPDBLister(informerFactory, true),
 | 
			
		||||
				pdbLister: getPDBLister(informerFactory),
 | 
			
		||||
				args:      *getDefaultDefaultPreemptionArgs(),
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -20,8 +20,6 @@ package feature
 | 
			
		||||
// This struct allows us to break the dependency of the plugins on
 | 
			
		||||
// the internal k8s features pkg.
 | 
			
		||||
type Features struct {
 | 
			
		||||
	EnablePodAffinityNamespaceSelector           bool
 | 
			
		||||
	EnablePodDisruptionBudget                    bool
 | 
			
		||||
	EnableReadWriteOncePod                       bool
 | 
			
		||||
	EnableVolumeCapacityPriority                 bool
 | 
			
		||||
	EnableMinDomainsInPodTopologySpread          bool
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,6 @@ import (
 | 
			
		||||
// through the WithFrameworkOutOfTreeRegistry option.
 | 
			
		||||
func NewInTreeRegistry() runtime.Registry {
 | 
			
		||||
	fts := plfeature.Features{
 | 
			
		||||
		EnablePodDisruptionBudget:                    feature.DefaultFeatureGate.Enabled(features.PodDisruptionBudget),
 | 
			
		||||
		EnableReadWriteOncePod:                       feature.DefaultFeatureGate.Enabled(features.ReadWriteOncePod),
 | 
			
		||||
		EnableVolumeCapacityPriority:                 feature.DefaultFeatureGate.Enabled(features.VolumeCapacityPriority),
 | 
			
		||||
		EnableMinDomainsInPodTopologySpread:          feature.DefaultFeatureGate.Enabled(features.MinDomainsInPodTopologySpread),
 | 
			
		||||
 
 | 
			
		||||
@@ -896,11 +896,6 @@ func (p *csiPlugin) getVolumeLifecycleMode(spec *volume.Spec) (storage.VolumeLif
 | 
			
		||||
// getFSGroupPolicy returns if the CSI driver supports a volume in the given mode.
 | 
			
		||||
// An error indicates that it isn't supported and explains why.
 | 
			
		||||
func (p *csiPlugin) getFSGroupPolicy(driver string) (storage.FSGroupPolicy, error) {
 | 
			
		||||
	if !utilfeature.DefaultFeatureGate.Enabled(features.CSIVolumeFSGroupPolicy) {
 | 
			
		||||
		// feature is disabled, default to ReadWriteOnceWithFSTypeFSGroupPolicy
 | 
			
		||||
		return storage.ReadWriteOnceWithFSTypeFSGroupPolicy, nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Retrieve CSIDriver. It's not an error if that isn't
 | 
			
		||||
	// possible (we don't have the lister if CSIDriverRegistry is
 | 
			
		||||
	// disabled) or the driver isn't found (CSIDriver is
 | 
			
		||||
 
 | 
			
		||||
@@ -163,7 +163,6 @@ func TestPluginGetPluginName(t *testing.T) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func TestPluginGetFSGroupPolicy(t *testing.T) {
 | 
			
		||||
	defer featuregatetesting.SetFeatureGateDuringTest(t, utilfeature.DefaultFeatureGate, features.CSIVolumeFSGroupPolicy, true)()
 | 
			
		||||
	defaultPolicy := storage.ReadWriteOnceWithFSTypeFSGroupPolicy
 | 
			
		||||
	testCases := []struct {
 | 
			
		||||
		name                  string
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user