Skip to content

Commit

Permalink
Merge pull request #6366 from hetznercloud/hcloud-wait-all-actions-1.27
Browse files Browse the repository at this point in the history
[v1.27] fix(hetzner): insufficient nodes when boot fails
  • Loading branch information
k8s-ci-robot authored Dec 11, 2023
2 parents fe7e07d + 19c4942 commit e1b7582
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 @@ -424,12 +424,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 e1b7582

Please sign in to comment.