@@ -165,7 +165,7 @@ func runStart(cmd *cobra.Command, _ []string) {
165
165
go download .CleanUpOlderPreloads ()
166
166
167
167
// Avoid blocking execution on optional HTTP fetches
168
- go notify .MaybePrintUpdateTextFromGithub ()
168
+ go notify .MaybePrintUpdateTextFromGithub (commandOptions () )
169
169
170
170
displayEnviron (os .Environ ())
171
171
if viper .GetBool (force ) {
@@ -300,6 +300,8 @@ func runStart(cmd *cobra.Command, _ []string) {
300
300
}
301
301
302
302
func provisionWithDriver (cmd * cobra.Command , ds registry.DriverState , existing * config.ClusterConfig ) (node.Starter , error ) {
303
+ options := commandOptions ()
304
+
303
305
driverName := ds .Name
304
306
klog .Infof ("selected driver: %s" , driverName )
305
307
validateDriver (ds , existing )
@@ -348,7 +350,7 @@ func provisionWithDriver(cmd *cobra.Command, ds registry.DriverState, existing *
348
350
klog .Infof ("cluster config:\n %+v" , cc )
349
351
350
352
if firewall .IsBootpdBlocked (cc ) {
351
- if err := firewall .UnblockBootpd (); err != nil {
353
+ if err := firewall .UnblockBootpd (options ); err != nil {
352
354
klog .Warningf ("failed unblocking bootpd from firewall: %v" , err )
353
355
}
354
356
}
@@ -385,7 +387,7 @@ func provisionWithDriver(cmd *cobra.Command, ds registry.DriverState, existing *
385
387
ssh .SetDefaultClient (ssh .External )
386
388
}
387
389
388
- mRunner , preExists , mAPI , host , err := node .Provision (& cc , & n , viper . GetBool ( deleteOnFailure ) )
390
+ mRunner , preExists , mAPI , host , err := node .Provision (& cc , & n , options )
389
391
if err != nil {
390
392
return node.Starter {}, err
391
393
}
@@ -471,8 +473,10 @@ func imageMatchesBinaryVersion(imageVersion, binaryVersion string) bool {
471
473
}
472
474
473
475
func startWithDriver (cmd * cobra.Command , starter node.Starter , existing * config.ClusterConfig ) (* kubeconfig.Settings , error ) {
476
+ options := commandOptions ()
477
+
474
478
// start primary control-plane node
475
- configInfo , err := node .Start (starter )
479
+ configInfo , err := node .Start (starter , options )
476
480
if err != nil {
477
481
configInfo , err = maybeDeleteAndRetry (cmd , * starter .Cfg , * starter .Node , starter .ExistingAddons , err )
478
482
if err != nil {
@@ -515,7 +519,7 @@ func startWithDriver(cmd *cobra.Command, starter node.Starter, existing *config.
515
519
}
516
520
517
521
out .Ln ("" ) // extra newline for clarity on the command line
518
- if err := node .Add (starter .Cfg , n , viper . GetBool ( deleteOnFailure ) ); err != nil {
522
+ if err := node .Add (starter .Cfg , n , options ); err != nil {
519
523
return nil , errors .Wrap (err , "adding node" )
520
524
}
521
525
}
@@ -648,8 +652,13 @@ func maybeDeleteAndRetry(cmd *cobra.Command, existing config.ClusterConfig, n co
648
652
// Re-generate the cluster config, just in case the failure was related to an old config format
649
653
cc := updateExistingConfigFromFlags (cmd , & existing )
650
654
var configInfo * kubeconfig.Settings
655
+
656
+ options := commandOptions ()
657
+ provisionOptions := commandOptions ()
658
+ provisionOptions .DeleteOnFailure = false
659
+
651
660
for _ , n := range cc .Nodes {
652
- r , p , m , h , err := node .Provision (& cc , & n , false )
661
+ r , p , m , h , err := node .Provision (& cc , & n , provisionOptions )
653
662
s := node.Starter {
654
663
Runner : r ,
655
664
PreExists : p ,
@@ -664,7 +673,7 @@ func maybeDeleteAndRetry(cmd *cobra.Command, existing config.ClusterConfig, n co
664
673
return nil , err
665
674
}
666
675
667
- k , err := node .Start (s )
676
+ k , err := node .Start (s , options )
668
677
if n .ControlPlane {
669
678
configInfo = k
670
679
}
@@ -706,13 +715,16 @@ func kubectlVersion(path string) (string, error) {
706
715
707
716
// returns (current_driver, suggested_drivers, "true, if the driver is set by command line arg or in the config file")
708
717
func selectDriver (existing * config.ClusterConfig ) (registry.DriverState , []registry.DriverState , bool ) {
718
+ options := commandOptions ()
719
+
709
720
// Technically unrelated, but important to perform before detection
710
721
driver .SetLibvirtURI (viper .GetString (kvmQemuURI ))
711
722
register .Reg .SetStep (register .SelectingDriver )
723
+
712
724
// By default, the driver is whatever we used last time
713
725
if existing != nil {
714
726
old := hostDriver (existing )
715
- ds := driver .Status (old )
727
+ ds := driver .Status (old , options )
716
728
out .Step (style .Sparkle , `Using the {{.driver}} driver based on existing profile` , out.V {"driver" : ds .String ()})
717
729
return ds , nil , true
718
730
}
@@ -729,7 +741,7 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis
729
741
`
730
742
out .WarningT (warning , out.V {"driver" : d , "vmd" : vmd })
731
743
}
732
- ds := driver .Status (d )
744
+ ds := driver .Status (d , options )
733
745
if ds .Name == "" {
734
746
exit .Message (reason .DrvUnsupportedOS , "The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}" , out.V {"driver" : d , "os" : runtime .GOOS , "arch" : runtime .GOARCH })
735
747
}
@@ -739,15 +751,15 @@ func selectDriver(existing *config.ClusterConfig) (registry.DriverState, []regis
739
751
740
752
// Fallback to old driver parameter
741
753
if d := viper .GetString ("vm-driver" ); d != "" {
742
- ds := driver .Status (viper .GetString ("vm-driver" ))
754
+ ds := driver .Status (viper .GetString ("vm-driver" ), options )
743
755
if ds .Name == "" {
744
756
exit .Message (reason .DrvUnsupportedOS , "The driver '{{.driver}}' is not supported on {{.os}}/{{.arch}}" , out.V {"driver" : d , "os" : runtime .GOOS , "arch" : runtime .GOARCH })
745
757
}
746
758
out .Step (style .Sparkle , `Using the {{.driver}} driver based on user configuration` , out.V {"driver" : ds .String ()})
747
759
return ds , nil , true
748
760
}
749
761
750
- choices := driver .Choices (viper .GetBool ("vm" ))
762
+ choices := driver .Choices (viper .GetBool ("vm" ), options )
751
763
pick , alts , rejects := driver .Suggest (choices )
752
764
if pick .Name == "" {
753
765
out .Step (style .ThumbsDown , "Unable to pick a default driver. Here is what was considered, in preference order:" )
0 commit comments