Merge pull request #51519 from hzxuzhonghu/cronjob
Automatic merge from submit-queue update deprecated interface and fix bug not return when list pod failed in cronjob_controller.go **What this PR does / why we need it**: remove some unused redundant code, and fix bug: when list pod failed, job still deleted but pod may still exist in func `deleteJob` **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
@@ -216,11 +216,11 @@ type realPodControl struct {
|
||||
var _ podControlInterface = &realPodControl{}
|
||||
|
||||
func (r realPodControl) ListPods(namespace string, opts metav1.ListOptions) (*v1.PodList, error) {
|
||||
return r.KubeClient.Core().Pods(namespace).List(opts)
|
||||
return r.KubeClient.CoreV1().Pods(namespace).List(opts)
|
||||
}
|
||||
|
||||
func (r realPodControl) DeletePod(namespace string, name string) error {
|
||||
return r.KubeClient.Core().Pods(namespace).Delete(name, nil)
|
||||
return r.KubeClient.CoreV1().Pods(namespace).Delete(name, nil)
|
||||
}
|
||||
|
||||
type fakePodControl struct {
|
||||
@@ -235,6 +235,9 @@ var _ podControlInterface = &fakePodControl{}
|
||||
func (f *fakePodControl) ListPods(namespace string, opts metav1.ListOptions) (*v1.PodList, error) {
|
||||
f.Lock()
|
||||
defer f.Unlock()
|
||||
if f.Err != nil {
|
||||
return nil, f.Err
|
||||
}
|
||||
return &v1.PodList{Items: f.Pods}, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user