-
Notifications
You must be signed in to change notification settings - Fork 38.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update deprecated interface and fix bug not return when list pod failed in cronjob_controller.go #51519
Conversation
Hi @hzxuzhonghu. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit, do you think you could write a test case covering this part?
@@ -263,9 +264,8 @@ func syncOne(sj *batchv2alpha1.CronJob, js []batchv1.Job, now time.Time, jc jobC | |||
glog.V(4).Infof("No unmet start times for %s", nameForLog) | |||
return | |||
} | |||
if len(times) > 1 { | |||
glog.V(4).Infof("Multiple unmet start times for %s so only starting last one", nameForLog) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this back, we want to log only when more than one time was left behind.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I looked one as zero. I will change back.
@soltysh yes, I will add cases cover this |
@soltysh done. But I do not know why put fakePodControl in injection.go, which only useful for test. I think it's better to move to cronjob_controller_test.go. What do you think? |
/ok-to-test |
This lgtm, @soltysh would you take another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done、
@@ -376,6 +377,7 @@ func deleteJob(sj *batchv2alpha1.CronJob, job *batchv1.Job, jc jobControlInterfa | |||
podList, err := pc.ListPods(job.Namespace, options) | |||
if err != nil { | |||
recorder.Eventf(sj, v1.EventTypeWarning, "FailedList", "List job-pods: %v", err) | |||
return false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think here is a bug if list failed, but job is deleted. May result in pod leak.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thx!
@@ -263,9 +264,8 @@ func syncOne(sj *batchv2alpha1.CronJob, js []batchv1.Job, now time.Time, jc jobC | |||
glog.V(4).Infof("No unmet start times for %s", nameForLog) | |||
return | |||
} | |||
if len(times) > 1 { | |||
glog.V(4).Infof("Multiple unmet start times for %s so only starting last one", nameForLog) | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I looked one as zero. I will change back.
kindly ping @soltysh test case covered, would you please review? |
/test pull-kubernetes-e2e-kops-aws |
/lgtm |
/approve no-issue |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu, soltysh Associated issue requirement bypassed by: soltysh The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/retest |
/test pull-kubernetes-e2e-kops-aws |
/retest |
/retest Review the full test history for this PR. |
/test all [submit-queue is verifying that this PR is safe to merge] |
@hzxuzhonghu: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Automatic merge from submit-queue |
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 ```
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: