From 7939040a057c10f1b6e03d008ea9c5489a98ac85 Mon Sep 17 00:00:00 2001 From: Wenbo Zhang Date: Fri, 23 Feb 2024 14:28:32 +0800 Subject: [PATCH] add pdb support feature gate Signed-off-by: Wenbo Zhang --- Makefile | 2 +- config/license-lint.yaml | 4 ++++ pkg/features/volcano_features.go | 12 ++++++++---- pkg/scheduler/cache/cache.go | 8 ++++++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index e6f63d3a9a..f36f56cd6f 100644 --- a/Makefile +++ b/Makefile @@ -213,7 +213,7 @@ mod-download-go: .PHONY: mirror-licenses mirror-licenses: mod-download-go; \ - go install istio.io/tools/cmd/license-lint@latest; \ + go install istio.io/tools/cmd/license-lint@1.19.7; \ cd licenses; \ rm -rf `ls ./ | grep -v LICENSE`; \ cd -; \ diff --git a/config/license-lint.yaml b/config/license-lint.yaml index dc303a6707..dceb28a4f0 100644 --- a/config/license-lint.yaml +++ b/config/license-lint.yaml @@ -66,3 +66,7 @@ allowlisted_modules: - github.com/google/cadvisor # Apache-2.0: k8s.io/kubernetes@v1.27.2/logo/LICENSE - k8s.io/kubernetes +# BSD: github.com/gogo/protobuf@v1.3.2/LICENSE +- github.com/gogo/protobuf +# MIT: sigs.k8s.io/yaml@v1.3.0/LICENSE +- sigs.k8s.io/yaml diff --git a/pkg/features/volcano_features.go b/pkg/features/volcano_features.go index 57055f21ec..b4db328b42 100644 --- a/pkg/features/volcano_features.go +++ b/pkg/features/volcano_features.go @@ -29,6 +29,9 @@ const ( // VolcanoJobSupport can identify and schedule volcano job. VolcanoJobSupport featuregate.Feature = "VolcanoJobSupport" + // PodDisruptionBudgetsSupport can cache and support PodDisruptionBudgets + PodDisruptionBudgetsSupport featuregate.Feature = "PodDisruptionBudgetsSupport" + // QueueCommandSync supports queue command sync. QueueCommandSync featuregate.Feature = "QueueCommandSync" @@ -47,10 +50,11 @@ func init() { } var defaultVolcanoFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{ - WorkLoadSupport: {Default: true, PreRelease: featuregate.Alpha}, - VolcanoJobSupport: {Default: true, PreRelease: featuregate.Alpha}, - QueueCommandSync: {Default: true, PreRelease: featuregate.Alpha}, - PriorityClass: {Default: true, PreRelease: featuregate.Alpha}, + WorkLoadSupport: {Default: true, PreRelease: featuregate.Alpha}, + VolcanoJobSupport: {Default: true, PreRelease: featuregate.Alpha}, + PodDisruptionBudgetsSupport: {Default: true, PreRelease: featuregate.Alpha}, + QueueCommandSync: {Default: true, PreRelease: featuregate.Alpha}, + PriorityClass: {Default: true, PreRelease: featuregate.Alpha}, // CSIStorage is explicitly set to false by default. CSIStorage: {Default: false, PreRelease: featuregate.Alpha}, ResourceTopology: {Default: true, PreRelease: featuregate.Alpha}, diff --git a/pkg/scheduler/cache/cache.go b/pkg/scheduler/cache/cache.go index d150630c52..0b04baf35b 100644 --- a/pkg/scheduler/cache/cache.go +++ b/pkg/scheduler/cache/cache.go @@ -582,10 +582,9 @@ func (sc *SchedulerCache) addEventHandler() { mySchedulerPodName, c := getMultiSchedulerInfo() // explicitly register informers to the factory, otherwise resources listers cannot get anything - // even with no error returned. `PodDisruptionBudgets` informer is used by `Pdb` plugin + // even with no error returned. // `Namespace` informer is used by `InterPodAffinity` plugin, // `SelectorSpread` and `PodTopologySpread` plugins uses the following four so far. - informerFactory.Policy().V1().PodDisruptionBudgets().Informer() informerFactory.Core().V1().Namespaces().Informer() informerFactory.Core().V1().Services().Informer() if utilfeature.DefaultFeatureGate.Enabled(features.WorkLoadSupport) { @@ -594,6 +593,11 @@ func (sc *SchedulerCache) addEventHandler() { informerFactory.Apps().V1().StatefulSets().Informer() } + // `PodDisruptionBudgets` informer is used by `Pdb` plugin + if utilfeature.DefaultFeatureGate.Enabled(features.PodDisruptionBudgetsSupport) { + informerFactory.Policy().V1().PodDisruptionBudgets().Informer() + } + // create informer for node information sc.nodeInformer = informerFactory.Core().V1().Nodes() sc.nodeInformer.Informer().AddEventHandlerWithResyncPeriod(