@@ -200,7 +200,7 @@ func runStart(cmd *cobra.Command, args []string) {
200
200
}
201
201
}
202
202
203
- kubeconfig , err := startWithDriver (starter , existing )
203
+ kubeconfig , err := startWithDriver (cmd , starter , existing )
204
204
if err != nil {
205
205
node .MaybeExitWithAdvice (err )
206
206
exit .WithError ("failed to start node" , err )
@@ -279,10 +279,10 @@ func provisionWithDriver(cmd *cobra.Command, ds registry.DriverState, existing *
279
279
}, nil
280
280
}
281
281
282
- func startWithDriver (starter node.Starter , existing * config.ClusterConfig ) (* kubeconfig.Settings , error ) {
282
+ func startWithDriver (cmd * cobra. Command , starter node.Starter , existing * config.ClusterConfig ) (* kubeconfig.Settings , error ) {
283
283
kubeconfig , err := node .Start (starter , true )
284
284
if err != nil {
285
- kubeconfig , err = maybeDeleteAndRetry (* starter .Cfg , * starter .Node , starter .ExistingAddons , err )
285
+ kubeconfig , err = maybeDeleteAndRetry (cmd , * starter .Cfg , * starter .Node , starter .ExistingAddons , err )
286
286
if err != nil {
287
287
return nil , err
288
288
}
@@ -411,20 +411,22 @@ func showKubectlInfo(kcs *kubeconfig.Settings, k8sVersion string, machineName st
411
411
return nil
412
412
}
413
413
414
- func maybeDeleteAndRetry (cc config.ClusterConfig , n config.Node , existingAddons map [string ]bool , originalErr error ) (* kubeconfig.Settings , error ) {
414
+ func maybeDeleteAndRetry (cmd * cobra. Command , existing config.ClusterConfig , n config.Node , existingAddons map [string ]bool , originalErr error ) (* kubeconfig.Settings , error ) {
415
415
if viper .GetBool (deleteOnFailure ) {
416
416
out .WarningT ("Node {{.name}} failed to start, deleting and trying again." , out.V {"name" : n .Name })
417
417
// Start failed, delete the cluster and try again
418
- profile , err := config .LoadProfile (cc .Name )
418
+ profile , err := config .LoadProfile (existing .Name )
419
419
if err != nil {
420
- out .ErrT (out .Meh , `"{{.name}}" profile does not exist, trying anyways.` , out.V {"name" : cc .Name })
420
+ out .ErrT (out .Meh , `"{{.name}}" profile does not exist, trying anyways.` , out.V {"name" : existing .Name })
421
421
}
422
422
423
423
err = deleteProfile (profile )
424
424
if err != nil {
425
- out .WarningT ("Failed to delete cluster {{.name}}, proceeding with retry anyway." , out.V {"name" : cc .Name })
425
+ out .WarningT ("Failed to delete cluster {{.name}}, proceeding with retry anyway." , out.V {"name" : existing .Name })
426
426
}
427
427
428
+ // Re-generate the cluster config, just in case the failure was related to an old config format
429
+ cc := updateExistingConfigFromFlags (cmd , & existing )
428
430
var kubeconfig * kubeconfig.Settings
429
431
for _ , n := range cc .Nodes {
430
432
r , p , m , h , err := node .Provision (& cc , & n , n .ControlPlane , false )
0 commit comments