mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 10:43:56 +00:00
add master address desc into kubeadm join and some validations
Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
This commit is contained in:
parent
d7b6245ab0
commit
3616a04177
@ -55,7 +55,7 @@ func NewCmdJoin(out io.Writer) *cobra.Command {
|
||||
var cfgPath string
|
||||
|
||||
cmd := &cobra.Command{
|
||||
Use: "join",
|
||||
Use: "join <master address>",
|
||||
Short: "Run this on any machine you wish to join an existing cluster",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
j, err := NewJoin(cfgPath, args, &cfg, skipPreFlight)
|
||||
@ -104,11 +104,13 @@ func NewJoin(cfgPath string, args []string, cfg *kubeadmapi.NodeConfiguration, s
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(phase1+) this we are missing args from the help text, there should be a way to tell cobra about it
|
||||
if len(args) == 0 && len(cfg.MasterAddresses) == 0 {
|
||||
return nil, fmt.Errorf("must specify master IP address (see --help)")
|
||||
return nil, fmt.Errorf("must specify master address (see --help)")
|
||||
}
|
||||
cfg.MasterAddresses = append(cfg.MasterAddresses, args...)
|
||||
if len(cfg.MasterAddresses) > 1 {
|
||||
return nil, fmt.Errorf("Must not specify more than one master address (see --help)")
|
||||
}
|
||||
|
||||
if !skipPreFlight {
|
||||
fmt.Println("Running pre-flight checks")
|
||||
|
Loading…
Reference in New Issue
Block a user