Skip to content

Commit

Permalink
fix: lost event during image rolling update (#8424)
Browse files Browse the repository at this point in the history
  • Loading branch information
free6om authored Nov 7, 2024
1 parent d8b3f9f commit 0da21a0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/controller/instanceset/reconciler_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package instanceset

import (
"fmt"
"time"

apps "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -120,6 +121,7 @@ func (r *updateReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubebuilder
updatedPods := 0
priorities := ComposeRolePriorityMap(its.Spec.Roles)
isBlocked := false
needRetry := false
sortObjects(oldPodList, priorities, false)
for _, pod := range oldPodList {
if updatingPods >= updateCount || updatingPods >= unavailable {
Expand All @@ -135,6 +137,8 @@ func (r *updateReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubebuilder
}
if !isContainersAvailable(pod, its.Spec.MinReadySeconds) {
tree.Logger.Info(fmt.Sprintf("InstanceSet %s/%s blocks on update as some the container(s) of pod %s are not started at least for %d seconds", its.Namespace, its.Name, pod.Name, its.Spec.MinReadySeconds))
// as no further event triggers the next reconciliation, we need a retry
needRetry = true
break
}
if !isHealthy(pod) {
Expand Down Expand Up @@ -187,6 +191,9 @@ func (r *updateReconciler) Reconcile(tree *kubebuilderx.ObjectTree) (kubebuilder
if !isBlocked {
meta.RemoveStatusCondition(&its.Status.Conditions, string(workloads.InstanceUpdateRestricted))
}
if needRetry {
return kubebuilderx.RetryAfter(2 * time.Second), nil
}
return kubebuilderx.Continue, nil
}

Expand Down

0 comments on commit 0da21a0

Please sign in to comment.