Skip to content

Commit c537a04

Browse files
Count node shift of pod as failure (#22)
Signed-off-by: souravbiswassanto <saurov@appscode.com>
1 parent 1757dcc commit c537a04

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/controllers/apps/sidekick_controller.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,13 @@ func (r *SidekickReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
145145
if expectedHash != actualHash ||
146146
leader.Name != pod.Annotations[keyLeader] ||
147147
leader.Spec.NodeName != pod.Spec.NodeName || (pod.Status.Phase == corev1.PodFailed && sidekick.Spec.RestartPolicy == corev1.RestartPolicyNever) {
148+
if leader.Spec.NodeName != pod.Spec.NodeName && pod.Spec.NodeName != "" {
149+
sidekick.Status.FailureCount[string(pod.GetUID())] = true
150+
}
148151
err := r.deletePod(ctx, &pod)
149152
if err != nil {
150153
return ctrl.Result{}, err
151154
}
152-
153155
sidekick.Status.Leader.Name = ""
154156
sidekick.Status.Pod = ""
155157
sidekick.Status.ObservedGeneration = sidekick.GetGeneration()

0 commit comments

Comments
 (0)