in pkg/cloudprovider/cloudprovider.go [194:215]
func (c *CloudProvider) waitUntilLaunched(ctx context.Context, nodeClaim *karpv1.NodeClaim) {
freshClaim := &karpv1.NodeClaim{}
for {
err := c.kubeClient.Get(ctx, types.NamespacedName{Namespace: nodeClaim.Namespace, Name: nodeClaim.Name}, freshClaim)
if err != nil {
if client.IgnoreNotFound(err) == nil {
return
}
log.FromContext(ctx).Error(err, "failed getting nodeclaim to wait until launched")
}
if cond := freshClaim.StatusConditions().Get(karpv1.ConditionTypeLaunched); !cond.IsUnknown() {
return
}
select {
case <-time.After(500 * time.Millisecond):
case <-ctx.Done():
return // context was canceled
}
}
}