From 57b48cfd52fd7d7511cf782ddfb3b84abc2a4296 Mon Sep 17 00:00:00 2001 From: zerunhu <452829874@qq.com> Date: Tue, 24 Sep 2024 12:06:10 +0800 Subject: [PATCH] feat: imagePullJob support Tolerations Signed-off-by: zerunhu <452829874@qq.com> --- pkg/controller/imagepulljob/imagepulljob_controller.go | 2 ++ pkg/features/kruise_features.go | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/pkg/controller/imagepulljob/imagepulljob_controller.go b/pkg/controller/imagepulljob/imagepulljob_controller.go index e2a7add5ab..40b774d721 100644 --- a/pkg/controller/imagepulljob/imagepulljob_controller.go +++ b/pkg/controller/imagepulljob/imagepulljob_controller.go @@ -232,10 +232,12 @@ func (r *ReconcileImagePullJob) Reconcile(_ context.Context, request reconcile.R if err != nil { return reconcile.Result{}, fmt.Errorf("failed to get NodeImages: %v", err) } + //if utilfeature.DefaultFeatureGate.Enabled(features.ImagePullJobTolerationGate) { nodeImages, err = utilimagejob.TolerationNodeImages(r.Client, nodeImages, job) if err != nil { return reconcile.Result{}, fmt.Errorf("failed to get NodeImages for Toleration: %v", err) } + //} // If resourceVersion expectations have not satisfied yet, just skip this reconcile for _, nodeImage := range nodeImages { diff --git a/pkg/features/kruise_features.go b/pkg/features/kruise_features.go index 78eab56276..36f66df3c8 100644 --- a/pkg/features/kruise_features.go +++ b/pkg/features/kruise_features.go @@ -108,6 +108,9 @@ const ( // ImagePullJobGate enable imagepulljob-controller execute ImagePullJob. ImagePullJobGate featuregate.Feature = "ImagePullJobGate" + // ImagePullJobTolerationGate enable ImagePullJob support Tolerations. + ImagePullJobTolerationGate featuregate.Feature = "ImagePullJobTolerationGate" + // ResourceDistributionGate enable resourcedistribution-controller execute ResourceDistribution. ResourceDistributionGate featuregate.Feature = "ResourceDistributionGate" @@ -157,6 +160,7 @@ var defaultFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{ CloneSetEventHandlerOptimization: {Default: false, PreRelease: featuregate.Alpha}, PreparingUpdateAsUpdate: {Default: false, PreRelease: featuregate.Alpha}, ImagePullJobGate: {Default: false, PreRelease: featuregate.Alpha}, + ImagePullJobTolerationGate: {Default: false, PreRelease: featuregate.Alpha}, ResourceDistributionGate: {Default: false, PreRelease: featuregate.Alpha}, DeletionProtectionForCRDCascadingGate: {Default: false, PreRelease: featuregate.Alpha}, @@ -210,4 +214,7 @@ func SetDefaultFeatureGates() { if !utilfeature.DefaultFeatureGate.Enabled(ResourcesDeletionProtection) { _ = utilfeature.DefaultMutableFeatureGate.Set(fmt.Sprintf("%s=false", DeletionProtectionForCRDCascadingGate)) } + //if utilfeature.DefaultFeatureGate.Enabled(ImagePullJobTolerationGate) { + // _ = utilfeature.DefaultMutableFeatureGate.Set(fmt.Sprintf("%s=true", ImagePullJobTolerationGate)) + //} }