-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Enable batch/v1beta1.CronJobs by default #51465
Conversation
@deads2k for approval |
go cronjob.NewCronJobController( | ||
clientset.NewForConfigOrDie(cronjobConfig), | ||
// clientset.NewForConfigOrDie(cronjobConfig), |
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.
Remove this line
@@ -41,14 +39,13 @@ func startJobController(ctx ControllerContext) (bool, error) { | |||
} | |||
|
|||
func startCronJobController(ctx ControllerContext) (bool, error) { | |||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}] { | |||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}] && | |||
!ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v1beta1", Resource: "cronjobs"}] { |
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.
batch/v1beta1
cronjob clientsets are used in cronjob controller code, so batch/v1beta1
has to be enabled?
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.
Yeah, I initially thought that maybe be possible to work with both, but it's not. I forgot to update it. Will do.
cmd/kube-apiserver/app/server.go
Outdated
@@ -549,8 +548,7 @@ func BuildStorageFactory(s *options.ServerRunOptions) (*serverstorage.DefaultSto | |||
s.Etcd.StorageConfig, s.Etcd.DefaultStorageMediaType, api.Codecs, | |||
serverstorage.NewDefaultResourceEncodingConfig(api.Registry), storageGroupsToEncodingVersion, | |||
// FIXME: this GroupVersionResource override should be configurable | |||
// TODO we need to update this to batch/v1beta1 when it's enabled by default | |||
[]schema.GroupVersionResource{batch.Resource("cronjobs").WithVersion("v2alpha1")}, | |||
[]schema.GroupVersionResource{batch.Resource("cronjobs").WithVersion("v1beta1")}, |
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.
What does this line do?
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 makes sure CronJob is stored with batch/v1beta1. If this is not present current mechanics will try to find codec for CronJob in batch/v1, which will fail. This needs to be fixed, I've spoked with @deads2k about it earlier today, but that won't happen in 1.8 timeframe, I guess.
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.
Does this change default storage version from batch/v2alpha1 to batch/v1beta1?
@@ -41,14 +39,13 @@ func startJobController(ctx ControllerContext) (bool, error) { | |||
} | |||
|
|||
func startCronJobController(ctx ControllerContext) (bool, error) { | |||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}] { | |||
if !ctx.AvailableResources[schema.GroupVersionResource{Group: "batch", Version: "v2alpha1", Resource: "cronjobs"}] && |
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.
Given client-go, it's basically impossible for a controller to tolerate two different API levels. Are you sure this is doing what you expect?
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.
Given client-go, it's basically impossible for a controller to tolerate two different API levels. Are you sure this is doing what you expect?
Yeah, if your controller is only going to work on the beta version (what it looks like), then you should only list the beta version as a gate. Things don't go sideways until you switch to GA.
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.
Yup, I initially thought about working with both APIs, but failed. I forgot to update it.
@lavalamp you should probably take a look at what's happening with these now. The effects of lacking a hub version are pretty ugly. |
I've addressed comments. |
@@ -116,7 +116,7 @@ func (jm *CronJobController) syncAll() { | |||
js := jl.Items | |||
glog.V(4).Infof("Found %d jobs", len(js)) | |||
|
|||
sjl, err := jm.kubeClient.BatchV2alpha1().CronJobs(metav1.NamespaceAll).List(metav1.ListOptions{}) | |||
sjl, err := jm.kubeClient.BatchV1beta1().CronJobs(metav1.NamespaceAll).List(metav1.ListOptions{}) |
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.
Will this break HA clusters during upgrades? Not all masters are updated simultaneously: #51049 (comment)
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 this is slightly different usecase than what you're pointing to. There, the issue is about upgrading from beta1 to beta2, where both are enabled by default. Here, we are migrating from alpha to beta, iow. from non-default to a default enabled API.
If I don't change controller to use the beta (enabled by default) cronjobs will not be working. Because you'll have the beta API available, but controller will rely on non-default API to be turned on.
This will break HA clusters, but only those that explicitly enable the alpha version. I'll defer to @bgrant0607 or @smarterclayton for the decision but imho this should get in.
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 don't support HA alpha upgrading to beta without interruption. So someone on a cluster like that has already broken the glass.
/test pull-kubernetes-e2e-gce-bazel |
/lgtm |
Is there an issue in the features repo tracking this? |
|
/retest |
1 similar comment
/retest |
/approve
…On Tue, Aug 29, 2017 at 6:49 PM, k8s-ci-robot ***@***.***> wrote:
@soltysh <https://github.com/soltysh>: The following test *failed*, say
/retest to rerun them all:
Test name Commit Details Rerun command
pull-kubernetes-e2e-gce-bazel 2de214b
<2de214b>
link
<https://k8s-gubernator.appspot.com/build/kubernetes-jenkins/pr-logs/pull/51465/pull-kubernetes-e2e-gce-bazel/13242/> /test
pull-kubernetes-e2e-gce-bazel
Full PR test history <https://k8s-gubernator.appspot.com/pr/51465>. Your
PR dashboard <https://k8s-gubernator.appspot.com/pr/soltysh>. Please help
us cut down on flakes by linking to
<https://github.com/kubernetes/community/blob/master/contributors/devel/flaky-tests.md#filing-issues-for-flaky-tests>
an open issue
<https://github.com/kubernetes/kubernetes/issues?q=is:issue+is:open> when
you hit one in your PR.
Instructions for interacting with me using PR comments are available here
<https://github.com/kubernetes/community/blob/master/contributors/devel/pull-requests.md>.
If you have questions or suggestions related to my behavior, please file an
issue against the kubernetes/test-infra
<https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:>
repository. I understand the commands that are listed here
<https://github.com/kubernetes/test-infra/blob/master/commands.md>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#51465 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABG_p8b0ttyUzhXkD4PTWnddZiluyxDdks5sdJVlgaJpZM4PEzss>
.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: janetkuo, smarterclayton, soltysh No associated issue. Update pull-request body to add a reference to an issue, or get approval with 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 |
@soltysh would you add the issue number to the PR body so that it can get approved? |
Done. |
/retest |
Automatic merge from submit-queue (batch tested with PRs 50775, 51397, 51168, 51465, 51536) |
This PR is breaking presubmit e2e's due to the group version not being updated at a few places. |
If this PR breaks/impacts HA clusters, can we expand the release note to be a little more instructive please? cc @jdumars |
I'll sync with @kubernetes/sig-docs-maintainers about it. |
Which SIG should this be assigned to? |
@jdumars I'm currently updating the release notes, I'll ping you for a double check. It's sig-apps |
This PR moves to CronJobs beta entirely, enabling
batch/v1beta1
by default.Related issue: #41039
@erictune @janetkuo ptal