Skip to content

Commit

Permalink
feat: break early if installation object has fatal error (#622)
Browse files Browse the repository at this point in the history
break early if installation object has fatal error
  • Loading branch information
laverya authored May 17, 2024
1 parent 965a58b commit ccea8de
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion pkg/kubeutils/kubeutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,21 @@ func WaitForInstallation(ctx context.Context, cli client.Client, writer *spinner
}
lasterr = fmt.Errorf("installation state is %q (%q)", lastInstall.Status.State, lastInstall.Status.Reason)

if lastInstall.Status.State == embeddedclusterv1beta1.InstallationStateFailed {
return false, fmt.Errorf("installation failed: %s", lastInstall.Status.Reason)
}

if lastInstall.Status.State == embeddedclusterv1beta1.InstallationStateHelmChartUpdateFailure {
return false, fmt.Errorf("helm chart installation failed: %s", lastInstall.Status.Reason)
}

return false, nil
},
); err != nil {
return fmt.Errorf("timed out waiting for the installation to finish: %v", lasterr)
if wait.Interrupted(err) {
return fmt.Errorf("timed out waiting for the installation to finish: %v", lasterr)
}
return fmt.Errorf("error waiting for installation: %v", err)
}
return nil
}
Expand Down

0 comments on commit ccea8de

Please sign in to comment.