mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-15 23:03:40 +00:00
Merge pull request #36040 from bruceauyeung/add-master-address-desc-into-kubeadm-join-and-some-validations
Automatic merge from submit-queue add master address into kubeadm join help message and some validations **What this PR does / why we need it**: 1, add master address into kubeadm join help message. looks like : >Usage: > kubeadm join <master address> [flags] 2, when user provides more than one master address, return an error. 3, since `kubeadm join` not only support ip addresses but also host names or domain names, so i delete the word `ip` from error message `must specify master ip address (see --help)` Signed-off-by: bruceauyeung <ouyang.qinhua@zte.com.cn>
This commit is contained in:
commit
9761442b19
@ -55,7 +55,7 @@ func NewCmdJoin(out io.Writer) *cobra.Command {
|
|||||||
var cfgPath string
|
var cfgPath string
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "join",
|
Use: "join <master address>",
|
||||||
Short: "Run this on any machine you wish to join an existing cluster",
|
Short: "Run this on any machine you wish to join an existing cluster",
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
j, err := NewJoin(cfgPath, args, &cfg, skipPreFlight)
|
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 {
|
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...)
|
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 {
|
if !skipPreFlight {
|
||||||
fmt.Println("Running pre-flight checks")
|
fmt.Println("Running pre-flight checks")
|
||||||
|
Loading…
Reference in New Issue
Block a user