Skip to content

Commit

Permalink
log waiting on block
Browse files Browse the repository at this point in the history
  • Loading branch information
nojnhuh committed Jul 10, 2023
1 parent 8f173a1 commit 14cc458
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/clusterctl/client/cluster/mover.go
Original file line number Diff line number Diff line change
Expand Up @@ -634,16 +634,22 @@ func waitReadyForMove(proxy Proxy, nodes []*node, dryRun bool, backoff wait.Back
},
}
key := client.ObjectKeyFromObject(obj)
log := log.WithValues("apiVersion", obj.GroupVersionKind(), "resource", klog.KObj(obj))

blockLogged := false
if err := retryWithExponentialBackoff(backoff, func() error {
if err := c.Get(ctx, key, obj); err != nil {
return errors.Wrapf(err, "error getting %s %s", obj.GroupVersionKind(), key)
}

if _, exists := obj.GetAnnotations()[clusterctlv1.BlockMoveAnnotation]; exists {
if !blockLogged {
log.Info("Move blocked by %s annotation, waiting for it to be removed")
blockLogged = true
}
return errors.Errorf("resource is not ready to move: %s %s", obj.GroupVersionKind(), key)
}
log.V(5).Info("Resource is ready to move", "apiVersion", obj.GroupVersionKind(), "resource", klog.KObj(obj))
log.V(5).Info("Resource is ready to move")
return nil
}); err != nil {
return err
Expand Down

0 comments on commit 14cc458

Please sign in to comment.