Skip to content

Commit 25cb8fb

Browse files
committed
SeedImage: manage updates of builder Pod under deletion
If the Pod get scheduled to be deleted but the status is not updated before the Pod reconcile loop, we may end up updating the status to SeedImageReady to true as we found the Pod still running. This commit adds a check if the Pod is marked for deletion: if so, let's wait. Signed-off-by: Francesco Giudici <[email protected]>
1 parent e909417 commit 25cb8fb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

controllers/seedimage_controller.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,17 @@ func (r *SeedImageReconciler) updateStatusFromPod(ctx context.Context, seedImg *
351351

352352
logger := ctrl.LoggerFrom(ctx)
353353

354+
if !foundPod.DeletionTimestamp.IsZero() {
355+
logger.V(5).Info("Wait the builder Pod to terminate")
356+
meta.SetStatusCondition(&seedImg.Status.Conditions, metav1.Condition{
357+
Type: elementalv1.SeedImageConditionReady,
358+
Status: metav1.ConditionFalse,
359+
Reason: elementalv1.SeedImageBuildNotStartedReason,
360+
Message: "wait old builder Pod termination",
361+
})
362+
return nil
363+
}
364+
354365
// no need to reconcile
355366
if meta.IsStatusConditionTrue(seedImg.Status.Conditions, elementalv1.SeedImageConditionReady) &&
356367
foundPod.Status.Phase != corev1.PodSucceeded {

0 commit comments

Comments
 (0)