Skip to content

Commit

Permalink
feat: imagePullJob support Tolerations
Browse files Browse the repository at this point in the history
Signed-off-by: zerunhu <452829874@qq.com>
  • Loading branch information
zerunhu committed Sep 24, 2024
1 parent 6065065 commit 57b48cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/controller/imagepulljob/imagepulljob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 238 in pkg/controller/imagepulljob/imagepulljob_controller.go

View check run for this annotation

Codecov / codecov/patch

pkg/controller/imagepulljob/imagepulljob_controller.go#L236-L238

Added lines #L236 - L238 were not covered by tests
}
//}

// If resourceVersion expectations have not satisfied yet, just skip this reconcile
for _, nodeImage := range nodeImages {
Expand Down
7 changes: 7 additions & 0 deletions pkg/features/kruise_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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},

Expand Down Expand Up @@ -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))
//}
}

0 comments on commit 57b48cf

Please sign in to comment.