mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-04 04:08:16 +00:00 
			
		
		
		
	kubeadm upgrade: fix dry run of backing up kubelet config file
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
This commit is contained in:
		@@ -78,9 +78,13 @@ func runKubeletConfigPhase() func(c workflow.RunData) error {
 | 
			
		||||
		}
 | 
			
		||||
		src := filepath.Join(kubeletDir, constants.KubeletConfigurationFileName)
 | 
			
		||||
		dest := filepath.Join(backupDir, constants.KubeletConfigurationFileName)
 | 
			
		||||
		fmt.Printf("[upgrade] backing up kubelet config file to %s\n", dest)
 | 
			
		||||
		if err := os.Rename(src, dest); err != nil {
 | 
			
		||||
			return errors.Wrap(err, "error backing up the kubelet config file")
 | 
			
		||||
		if !dryRun {
 | 
			
		||||
			fmt.Printf("[upgrade] Backing up kubelet config file to %s\n", dest)
 | 
			
		||||
			if err := os.Rename(src, dest); err != nil {
 | 
			
		||||
				return errors.Wrap(err, "error backing up the kubelet config file")
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			fmt.Printf("[dryrun] Would back up kubelet config file to %s\n", dest)
 | 
			
		||||
		}
 | 
			
		||||
		// Store the kubelet component configuration.
 | 
			
		||||
		if err = kubeletphase.WriteConfigToDisk(&cfg.ClusterConfiguration, kubeletDir, data.PatchesDir(), data.OutputWriter()); err != nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user