Merge pull request #63862 from runcom/fix-reset-crictl
Automatic merge from submit-queue (batch tested with PRs 62756, 63862, 61419, 64015, 64063). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. kubeadm: crictl reset commands fixes Signed-off-by: Antonio Murdaca <runcom@redhat.com> **What this PR does / why we need it**: change container stop/rm commands with sandbox stop/rm to properly reset using kubeadm **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes https://github.com/kubernetes/kubeadm/issues/748 **Special notes for your reviewer**: **Release note**: ```release-note Correct the way we reset containers and pods in kubeadm via crictl ```
This commit is contained in:
		@@ -221,14 +221,14 @@ func resetWithCrictl(execer utilsexec.Interface, dockerCheck preflight.Checker,
 | 
				
			|||||||
			if strings.TrimSpace(s) == "" {
 | 
								if strings.TrimSpace(s) == "" {
 | 
				
			||||||
				continue
 | 
									continue
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			params = []string{"-r", criSocketPath, "stop", s}
 | 
								params = []string{"-r", criSocketPath, "stopp", s}
 | 
				
			||||||
			glog.V(1).Infof("[reset] Executing command %s %s", crictlPath, strings.Join(params, " "))
 | 
								glog.V(1).Infof("[reset] Executing command %s %s", crictlPath, strings.Join(params, " "))
 | 
				
			||||||
			if err := execer.Command(crictlPath, params...).Run(); err != nil {
 | 
								if err := execer.Command(crictlPath, params...).Run(); err != nil {
 | 
				
			||||||
				glog.Infof("[reset] failed to stop the running containers using crictl: %v. Trying to use docker instead", err)
 | 
									glog.Infof("[reset] failed to stop the running containers using crictl: %v. Trying to use docker instead", err)
 | 
				
			||||||
				resetWithDocker(execer, dockerCheck)
 | 
									resetWithDocker(execer, dockerCheck)
 | 
				
			||||||
				return
 | 
									return
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			params = []string{"-r", criSocketPath, "rm", s}
 | 
								params = []string{"-r", criSocketPath, "rmp", s}
 | 
				
			||||||
			glog.V(1).Infof("[reset] Executing command %s %s", crictlPath, strings.Join(params, " "))
 | 
								glog.V(1).Infof("[reset] Executing command %s %s", crictlPath, strings.Join(params, " "))
 | 
				
			||||||
			if err := execer.Command(crictlPath, params...).Run(); err != nil {
 | 
								if err := execer.Command(crictlPath, params...).Run(); err != nil {
 | 
				
			||||||
				glog.Infof("[reset] failed to remove the running containers using crictl: %v. Trying to use docker instead", err)
 | 
									glog.Infof("[reset] failed to remove the running containers using crictl: %v. Trying to use docker instead", err)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user