@@ -157,7 +157,7 @@ func NewCmdJoin(out io.Writer, joinOptions *joinOptions) *cobra.Command {
157
157
joinRunner := workflow .NewRunner ()
158
158
159
159
cmd := & cobra.Command {
160
- Use : "join" ,
160
+ Use : "join [api-server-endpoint] " ,
161
161
Short : "Run this on any machine you wish to join an existing cluster" ,
162
162
Long : joinLongDescription ,
163
163
Run : func (cmd * cobra.Command , args []string ) {
@@ -336,7 +336,7 @@ func newJoinData(cmd *cobra.Command, args []string, opt *joinOptions, out io.Wri
336
336
opt .externalcfg .Discovery .BootstrapToken = nil
337
337
} else {
338
338
if len (opt .cfgPath ) == 0 && len (args ) > 1 {
339
- klog .Warningf ("[join ] WARNING: More than one API server endpoint supplied on command line %v. Using the first one." , args )
339
+ klog .Warningf ("[preflight ] WARNING: More than one API server endpoint supplied on command line %v. Using the first one." , args )
340
340
}
341
341
opt .externalcfg .Discovery .BootstrapToken .APIServerEndpoint = args [0 ]
342
342
}
@@ -352,7 +352,7 @@ func newJoinData(cmd *cobra.Command, args []string, opt *joinOptions, out io.Wri
352
352
var tlsBootstrapCfg * clientcmdapi.Config
353
353
if _ , err := os .Stat (adminKubeConfigPath ); err == nil && opt .controlPlane {
354
354
// use the admin.conf as tlsBootstrapCfg, that is the kubeconfig file used for reading the kubeadm-config during discovery
355
- klog .V (1 ).Infof ("[join ] found %s. Use it for skipping discovery" , adminKubeConfigPath )
355
+ klog .V (1 ).Infof ("[preflight ] found %s. Use it for skipping discovery" , adminKubeConfigPath )
356
356
tlsBootstrapCfg , err = clientcmd .LoadFromFile (adminKubeConfigPath )
357
357
if err != nil {
358
358
return nil , errors .Wrapf (err , "Error loading %s" , adminKubeConfigPath )
@@ -371,19 +371,19 @@ func newJoinData(cmd *cobra.Command, args []string, opt *joinOptions, out io.Wri
371
371
// Either use the config file if specified, or convert public kubeadm API to the internal JoinConfiguration
372
372
// and validates JoinConfiguration
373
373
if opt .externalcfg .NodeRegistration .Name == "" {
374
- klog .V (1 ).Infoln ("[join ] found NodeName empty; using OS hostname as NodeName" )
374
+ klog .V (1 ).Infoln ("[preflight ] found NodeName empty; using OS hostname as NodeName" )
375
375
}
376
376
377
377
if opt .externalcfg .ControlPlane != nil && opt .externalcfg .ControlPlane .LocalAPIEndpoint .AdvertiseAddress == "" {
378
- klog .V (1 ).Infoln ("[join ] found advertiseAddress empty; using default interface's IP address as advertiseAddress" )
378
+ klog .V (1 ).Infoln ("[preflight ] found advertiseAddress empty; using default interface's IP address as advertiseAddress" )
379
379
}
380
380
381
381
// in case the command doesn't have flags for discovery, makes the join cfg validation pass checks on discovery
382
382
if cmd .Flags ().Lookup (options .FileDiscovery ) == nil {
383
383
if _ , err := os .Stat (adminKubeConfigPath ); os .IsNotExist (err ) {
384
384
return nil , errors .Errorf ("File %s does not exists. Please use 'kubeadm join phase control-plane-prepare' subcommands to generate it." , adminKubeConfigPath )
385
385
}
386
- klog .V (1 ).Infof ("[join ] found discovery flags missing for this command. using FileDiscovery: %s" , adminKubeConfigPath )
386
+ klog .V (1 ).Infof ("[preflight ] found discovery flags missing for this command. using FileDiscovery: %s" , adminKubeConfigPath )
387
387
opt .externalcfg .Discovery .File = & kubeadmapiv1beta1.FileDiscovery {KubeConfigPath : adminKubeConfigPath }
388
388
opt .externalcfg .Discovery .BootstrapToken = nil //NB. this could be removed when we get better control on args (e.g. phases without discovery should have NoArgs )
389
389
}
@@ -431,7 +431,7 @@ func (j *joinData) TLSBootstrapCfg() (*clientcmdapi.Config, error) {
431
431
if j .tlsBootstrapCfg != nil {
432
432
return j .tlsBootstrapCfg , nil
433
433
}
434
- klog .V (1 ).Infoln ("[join ] Discovering cluster-info" )
434
+ klog .V (1 ).Infoln ("[preflight ] Discovering cluster-info" )
435
435
tlsBootstrapCfg , err := discovery .For (j .cfg )
436
436
j .tlsBootstrapCfg = tlsBootstrapCfg
437
437
return tlsBootstrapCfg , err
@@ -445,7 +445,7 @@ func (j *joinData) InitCfg() (*kubeadmapi.InitConfiguration, error) {
445
445
if _ , err := j .TLSBootstrapCfg (); err != nil {
446
446
return nil , err
447
447
}
448
- klog .V (1 ).Infoln ("[join ] Fetching init configuration" )
448
+ klog .V (1 ).Infoln ("[preflight ] Fetching init configuration" )
449
449
initCfg , err := fetchInitConfigurationFromJoinConfiguration (j .cfg , j .tlsBootstrapCfg )
450
450
j .initCfg = initCfg
451
451
return initCfg , err
@@ -459,7 +459,7 @@ func (j *joinData) ClientSet() (*clientset.Clientset, error) {
459
459
path := kubeadmconstants .GetAdminKubeConfigPath ()
460
460
client , err := kubeconfigutil .ClientSetFromFile (path )
461
461
if err != nil {
462
- return nil , errors .Wrap (err , "[join ] couldn't create Kubernetes client" )
462
+ return nil , errors .Wrap (err , "[preflight ] couldn't create Kubernetes client" )
463
463
}
464
464
j .clientSet = client
465
465
return client , nil
@@ -478,7 +478,7 @@ func (j *joinData) OutputWriter() io.Writer {
478
478
// fetchInitConfigurationFromJoinConfiguration retrieves the init configuration from a join configuration, performing the discovery
479
479
func fetchInitConfigurationFromJoinConfiguration (cfg * kubeadmapi.JoinConfiguration , tlsBootstrapCfg * clientcmdapi.Config ) (* kubeadmapi.InitConfiguration , error ) {
480
480
// Retrieves the kubeadm configuration
481
- klog .V (1 ).Infoln ("[join ] Retrieving KubeConfig objects" )
481
+ klog .V (1 ).Infoln ("[preflight ] Retrieving KubeConfig objects" )
482
482
initConfiguration , err := fetchInitConfiguration (tlsBootstrapCfg )
483
483
if err != nil {
484
484
return nil , err
@@ -509,7 +509,7 @@ func fetchInitConfiguration(tlsBootstrapCfg *clientcmdapi.Config) (*kubeadmapi.I
509
509
}
510
510
511
511
// Fetches the init configuration
512
- initConfiguration , err := configutil .FetchInitConfigurationFromCluster (tlsClient , os .Stdout , "join " , true )
512
+ initConfiguration , err := configutil .FetchInitConfigurationFromCluster (tlsClient , os .Stdout , "preflight " , true )
513
513
if err != nil {
514
514
return nil , errors .Wrap (err , "unable to fetch the kubeadm-config ConfigMap" )
515
515
}
0 commit comments