Skip to content

Commit

Permalink
Merge pull request #6364 from hetznercloud/hcloud-wait-all-actions
Browse files Browse the repository at this point in the history
fix(hetzner): insufficient nodes when boot fails
  • Loading branch information
k8s-ci-robot authored Dec 11, 2023
2 parents 844e61c + 0a46895 commit b4586f9
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cluster-autoscaler/cloudprovider/hetzner/hetzner_node_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,18 @@ func createServer(n *hetznerNodeGroup) error {
return fmt.Errorf("could not create server type %s in region %s: %v", n.instanceType, n.region, err)
}

action := serverCreateResult.Action
server := serverCreateResult.Server
err = waitForServerAction(n.manager, server.Name, action)
if err != nil {
_ = n.manager.deleteServer(server)
return fmt.Errorf("failed to start server %s error: %v", server.Name, err)

actions := []*hcloud.Action{serverCreateResult.Action}
actions = append(actions, serverCreateResult.NextActions...)

// Delete the server if any action (most importantly create_server & start_server) fails
for _, action := range actions {
err = waitForServerAction(n.manager, server.Name, action)
if err != nil {
_ = n.manager.deleteServer(server)
return fmt.Errorf("failed to start server %s error: %v", server.Name, err)
}
}

return nil
Expand Down

0 comments on commit b4586f9

Please sign in to comment.