-
Notifications
You must be signed in to change notification settings - Fork 39k
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
Add cronjob controller v2 #93370
Add cronjob controller v2 #93370
Conversation
Hi @alaypatel07. 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 Once the patch is verified, the new status will be reflected by the 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. |
/assign @soltysh |
8ac7628
to
a9606ea
Compare
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.
Some early feedback
staging/src/k8s.io/kube-controller-manager/features/kube_controller_manager_features.go
Outdated
Show resolved
Hide resolved
/assign @cheftako |
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 did a first pass, I'll look into this more when I'm back from my PTO.
if features.DefaultMutableFeatureGate.Enabled(features.CronjobController2) { | ||
cj2c, err := cronjob.NewController2(ctx.InformerFactory.Batch().V1().Jobs(), | ||
ctx.InformerFactory.Batch().V1beta1().CronJobs(), | ||
ctx.ClientBuilder.ClientOrDie("cronjob-controller"), |
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.
nit: cronjob-controllerv2 to make it explicit in the metrics.
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.
+1, modified
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.
For other readers, we went with the same name, so that we can re-use the SA for this controller.
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.
For other readers, we went with the same name, so that we can re-use the SA for this controller.
Please create a new SA and tie the existing rolebinding to it so we can figure out what is being used. This can be a followup (still in 1.120) to avoid making this PR larger.
return nil, nil | ||
default: | ||
// multiple unmet start times, start the last one. | ||
klog.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.
This won't work as you wish to, since getRecentUnmetScheduleTimes2
returns error when 100+ missed times. You need to react differently or change that function.
staging/src/k8s.io/kube-controller-manager/features/kube_controller_manager_features.go
Outdated
Show resolved
Hide resolved
recorder.Eventf(cj, v1.EventTypeWarning, "UnparseableSchedule", "unparseable schedule: %s : %s", cj.Spec.Schedule, err) | ||
return nil, nil | ||
} | ||
times, err := getRecentUnmetScheduleTimes2(*cj, now, sched) |
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.
Reading through this more, I don't think we need the separate method for this calculation.
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.
addressed this, PTAL, thanks
} | ||
times, err := getRecentUnmetScheduleTimes2(*cj, now, sched) | ||
switch { | ||
case err != nil && len(times) == 0: |
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.
All the error situations in getRecentUnmetScheduleTimes2
are returning error and an empty array, so all errors will pick this condition and not the others. You need to change this switch.
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.
yes, but with getRecentUnmetScheduleTimes2 the only place error is not nil is when too many missed start time occurs, so functionally, I am thinking this should give us desired output
2e936e7
to
c6e0314
Compare
971d9c7
to
e74eea6
Compare
/retitle [WIP]: Add cronjob controller v2 |
/retest |
7f669ff
to
38bb535
Compare
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.
/lgtm
/test pull-kubernetes-e2e-gce-alpha-features |
/test pull-kubernetes-e2e-gce-ubuntu-containerd |
/lgtm |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alaypatel07, deads2k, liggitt, soltysh The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
seems to be unrelated to the PR |
/test pull-kubernetes-e2e-gce-ubuntu-containerd |
/retest |
// CronJobControllerV2 controls whether the controller manager starts old cronjob | ||
// controller or new one which is implemented with informers and delaying queue | ||
// | ||
// This feature is deprecated, and will be removed in v1.22. |
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.
???
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.
We'll fix that in follow-ups 😉
Why the v2 cronjob controller can get the fix? It still includes the 100 missed start times limit 'feature' from the v1 controller. |
@b0b0haha ff you look carefully through kubernetes/pkg/controller/cronjob/utils.go Lines 93 to 113 in 92a1d0f
|
What type of PR is this?
/kind feature
What this PR does / why we need it:
We need the new controller because it is built using informers instead of polling. This re-work will help with the scale and performance issue of the old controller.
Special notes for your reviewer:
/assign @soltysh @wojtek-t
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: