mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +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)
 | 
							src := filepath.Join(kubeletDir, constants.KubeletConfigurationFileName)
 | 
				
			||||||
		dest := filepath.Join(backupDir, constants.KubeletConfigurationFileName)
 | 
							dest := filepath.Join(backupDir, constants.KubeletConfigurationFileName)
 | 
				
			||||||
		fmt.Printf("[upgrade] backing up kubelet config file to %s\n", dest)
 | 
							if !dryRun {
 | 
				
			||||||
		if err := os.Rename(src, dest); err != nil {
 | 
								fmt.Printf("[upgrade] Backing up kubelet config file to %s\n", dest)
 | 
				
			||||||
			return errors.Wrap(err, "error backing up the kubelet config file")
 | 
								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.
 | 
							// Store the kubelet component configuration.
 | 
				
			||||||
		if err = kubeletphase.WriteConfigToDisk(&cfg.ClusterConfiguration, kubeletDir, data.PatchesDir(), data.OutputWriter()); err != nil {
 | 
							if err = kubeletphase.WriteConfigToDisk(&cfg.ClusterConfiguration, kubeletDir, data.PatchesDir(), data.OutputWriter()); err != nil {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user