mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	kubeadm: override node registration options from command line
'kubeadm init' silently ignores --node-name and --cri-socket command line options if --config option is specified. Implemented setting 'name' and 'criSocket' options from the command line even if --config command line option is used.
This commit is contained in:
		@@ -399,7 +399,7 @@ func ValidateMixedArguments(flag *pflag.FlagSet) error {
 | 
			
		||||
 | 
			
		||||
	mixedInvalidFlags := []string{}
 | 
			
		||||
	flag.Visit(func(f *pflag.Flag) {
 | 
			
		||||
		if f.Name == "config" || f.Name == "ignore-preflight-errors" || strings.HasPrefix(f.Name, "skip-") || f.Name == "dry-run" || f.Name == "kubeconfig" || f.Name == "v" || f.Name == "rootfs" || f.Name == "print-join-command" {
 | 
			
		||||
		if f.Name == "config" || f.Name == "ignore-preflight-errors" || strings.HasPrefix(f.Name, "skip-") || f.Name == "dry-run" || f.Name == "kubeconfig" || f.Name == "v" || f.Name == "rootfs" || f.Name == "print-join-command" || f.Name == "node-name" || f.Name == "cri-socket" {
 | 
			
		||||
			// "--skip-*" flags or other whitelisted flags can be set with --config
 | 
			
		||||
			return
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -305,6 +305,15 @@ func newInitData(cmd *cobra.Command, options *initOptions, out io.Writer) (initD
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return initData{}, err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// override node name and CRI socket from the command line options
 | 
			
		||||
	if options.externalcfg.NodeRegistration.Name != "" {
 | 
			
		||||
		cfg.NodeRegistration.Name = options.externalcfg.NodeRegistration.Name
 | 
			
		||||
	}
 | 
			
		||||
	if options.externalcfg.NodeRegistration.CRISocket != kubeadmapiv1beta1.DefaultCRISocket {
 | 
			
		||||
		cfg.NodeRegistration.CRISocket = options.externalcfg.NodeRegistration.CRISocket
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if err := configutil.VerifyAPIServerBindAddress(cfg.LocalAPIEndpoint.AdvertiseAddress); err != nil {
 | 
			
		||||
		return initData{}, err
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user