From a191630d726e07bce194b71ca8a29a8d33bd3bd4 Mon Sep 17 00:00:00 2001 From: HanMengnan <1448189829@qq.com> Date: Sun, 23 Jul 2023 12:46:26 +0800 Subject: [PATCH] Fix: add new feature gate PreDownloadImageForSidecarSet Signed-off-by: Hanmengnan <1448189829@qq.com> --- pkg/controller/sidecarset/sidecarset_controller.go | 3 ++- pkg/features/kruise_features.go | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/controller/sidecarset/sidecarset_controller.go b/pkg/controller/sidecarset/sidecarset_controller.go index 737d77c801..9e7f52f48b 100644 --- a/pkg/controller/sidecarset/sidecarset_controller.go +++ b/pkg/controller/sidecarset/sidecarset_controller.go @@ -65,7 +65,8 @@ func Add(mgr manager.Manager) error { } if !utildiscovery.DiscoverGVK(appsv1alpha1.SchemeGroupVersion.WithKind("ImagePullJob")) || !utilfeature.DefaultFeatureGate.Enabled(features.KruiseDaemon) || - !utilfeature.DefaultFeatureGate.Enabled(features.PreDownloadImageForInPlaceUpdate) { + !utilfeature.DefaultFeatureGate.Enabled(features.PreDownloadImageForInPlaceUpdate) || + !utilfeature.DefaultFeatureGate.Enabled(features.PreDownloadImageForSidecarsetSetUpdate) { isPreDownloadDisabled = true } return add(mgr, newReconciler(mgr)) diff --git a/pkg/features/kruise_features.go b/pkg/features/kruise_features.go index 3edbd36358..59a0a9f347 100644 --- a/pkg/features/kruise_features.go +++ b/pkg/features/kruise_features.go @@ -105,6 +105,10 @@ const ( // PreparingUpdateAsUpdate enable CloneSet/Advanced StatefulSet controller to regard preparing-update Pod // as updated when calculating update/current revision during scaling. PreparingUpdateAsUpdate featuregate.Feature = "PreparingUpdateAsUpdate" + + // PreDownloadImageForSidecarsetSetUpdate enables sidecarset-controller to create ImagePullJobs to + // pre-download images for update. + PreDownloadImageForSidecarsetSetUpdate featuregate.Feature = "PreDownloadImageForSidecarsetSetUpdate" ) var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{ @@ -129,6 +133,7 @@ var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{ PreDownloadImageForDaemonSetUpdate: {Default: false, PreRelease: featuregate.Alpha}, CloneSetEventHandlerOptimization: {Default: false, PreRelease: featuregate.Alpha}, PreparingUpdateAsUpdate: {Default: false, PreRelease: featuregate.Alpha}, + PreDownloadImageForSidecarsetSetUpdate: {Default: false, PreRelease: featuregate.Alpha}, } func init() { @@ -164,5 +169,6 @@ func SetDefaultFeatureGates() { _ = utilfeature.DefaultMutableFeatureGate.Set(fmt.Sprintf("%s=false", PreDownloadImageForDaemonSetUpdate)) _ = utilfeature.DefaultMutableFeatureGate.Set(fmt.Sprintf("%s=false", PodProbeMarkerGate)) _ = utilfeature.DefaultMutableFeatureGate.Set(fmt.Sprintf("%s=false", SidecarTerminator)) + _ = utilfeature.DefaultMutableFeatureGate.Set(fmt.Sprintf("%s=false", PreDownloadImageForSidecarsetSetUpdate)) } }