Skip to content

Commit

Permalink
Merge pull request #44 from syseleven/delete_instances_on_shutdown-sw…
Browse files Browse the repository at this point in the history
…itch

Honor runners.autoscaler.delete_instances_on_shutdown
  • Loading branch information
vooon authored Dec 9, 2024
2 parents d79de4d + bfcec33 commit 5f6eeda
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,25 +390,5 @@ func (g *InstanceGroup) ConnectInfo(ctx context.Context, instanceID string) (pro
}

func (g *InstanceGroup) Shutdown(ctx context.Context) error {

// Not necessary, after reboot all old nodes will be deleted anyway.
// But that speedup that process.
instances, err := g.getInstances(ctx)
if err != nil {
return err
}

for _, srv := range instances {
lg := g.log.With("id", srv.ID, "name", srv.Name)

err2 := g.deleteInstance(ctx, srv.ID)
if err2 != nil {
lg.Error("Failed to delete instance", "err", err2)
err = errors.Join(err, err2)
}

lg.Info("Deleted instance on shutdown")
}

return err
return nil
}

0 comments on commit 5f6eeda

Please sign in to comment.