kubeadm: override node registration options from command line

'kubeadm join' silently ignores --node-name and --cri-socket
command line options if --config option is specified.

In some cases it's much easier for users to override these parameters
from the command line instead of updating config, especially for
multi-node automatic deployments where only node name should be changed.

Implemented setting 'name' and 'criSocket' options from the command
line even if --config command line option is used.
pull/58/head
Ed Bartosh 2018-11-20 16:20:11 +02:00
parent 50e02fd0cc
commit 012e46320b
1 changed files with 9 additions and 0 deletions

View File

@ -307,6 +307,15 @@ func NewJoin(cfgPath string, defaultcfg *kubeadmapiv1beta1.JoinConfiguration, ig
if err != nil {
return nil, err
}
// override node name and CRI socket from the command line options
if defaultcfg.NodeRegistration.Name != "" {
internalCfg.NodeRegistration.Name = defaultcfg.NodeRegistration.Name
}
if defaultcfg.NodeRegistration.CRISocket != kubeadmapiv1beta1.DefaultCRISocket {
internalCfg.NodeRegistration.CRISocket = defaultcfg.NodeRegistration.CRISocket
}
if defaultcfg.ControlPlane != nil {
if err := configutil.VerifyAPIServerBindAddress(internalCfg.ControlPlane.LocalAPIEndpoint.AdvertiseAddress); err != nil {
return nil, err