Skip to content

Commit

Permalink
fix panic cased by sts predownload image (openkruise#1031)
Browse files Browse the repository at this point in the history
Signed-off-by: mingzhou.swx <[email protected]>

Co-authored-by: mingzhou.swx <[email protected]>
Signed-off-by: Liu Zhenwei <[email protected]>
  • Loading branch information
2 people authored and diannaowa committed Sep 14, 2022
1 parent 2aafcaa commit cd0f316
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/controller/statefulset/statefulset_predownload_image.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ func (dss *defaultStatefulSetControl) createImagePullJobsForInPlaceUpdate(sts *a
return nil
}

// ignore if update type is ReCreate
if string(sts.Spec.UpdateStrategy.Type) == string(appsv1beta1.RecreatePodUpdateStrategyType) {
// ignore if update type is OnDelete or pod update policy is ReCreate
if string(sts.Spec.UpdateStrategy.Type) == string(apps.OnDeleteStatefulSetStrategyType) || sts.Spec.UpdateStrategy.RollingUpdate == nil ||
string(sts.Spec.UpdateStrategy.RollingUpdate.PodUpdatePolicy) == string(appsv1beta1.RecreatePodUpdateStrategyType) {
klog.V(4).Infof("Statefulset %s/%s skipped to create ImagePullJob for update type is %s",
sts.Namespace, sts.Name, sts.Spec.UpdateStrategy.Type)
return dss.patchControllerRevisionLabels(updateRevision, appsv1alpha1.ImagePreDownloadIgnoredKey, "true")
Expand Down

0 comments on commit cd0f316

Please sign in to comment.