Skip to content

Commit 5f7ac82

Browse files
committed
fix: errors.As
Signed-off-by: sivchari <shibuuuu5@gmail.com>
1 parent 11dd6c7 commit 5f7ac82

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cmd/clusterctl/client/repository/repository_github.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var (
6161
retryableOperationTimeout = 1 * time.Minute
6262
)
6363

64-
var rateLimitError github.RateLimitError
64+
var rateLimitError *github.RateLimitError
6565

6666
// gitHubRepository provides support for providers hosted on GitHub.
6767
//
@@ -505,7 +505,7 @@ func (g *gitHubRepository) handleGithubErr(err error, message string, args ...in
505505
return errors.New("rate limit for github api has been reached. Please wait one hour or get a personal API token and assign it to the GITHUB_TOKEN environment variable")
506506
}
507507

508-
var errorResponse github.ErrorResponse
508+
var errorResponse *github.ErrorResponse
509509
if errors.As(err, &errorResponse) {
510510
ghErr := err.(*github.ErrorResponse)
511511
if ghErr.Response.StatusCode == http.StatusNotFound {

internal/controllers/machine/machine_controller_noderef.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ func (r *Reconciler) reconcileNode(ctx context.Context, s *scope) (ctrl.Result,
7474
node, err := r.getNode(ctx, remoteClient, *machine.Spec.ProviderID)
7575
if err != nil {
7676
if errors.Is(err, ErrNodeNotFound) {
77+
if !s.machine.DeletionTimestamp.IsZero() {
78+
// Tolerate node not found when the machine is being deleted.
79+
return ctrl.Result{}, nil
80+
}
7781
// While a NodeRef is set in the status, failing to get that node means the node is deleted.
7882
// If Status.NodeRef is not set before, node still can be in the provisioning state.
7983
if machine.Status.NodeRef != nil {

0 commit comments

Comments
 (0)