Skip to content
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

Merged
merged 1 commit into from Aug 30, 2017

Conversation

soltysh
Copy link
Contributor

@soltysh soltysh commented Aug 28, 2017

This PR moves to CronJobs beta entirely, enabling batch/v1beta1 by default.

Related issue: #41039

@erictune @janetkuo ptal

Promote CronJobs to batch/v1beta1.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 28, 2017
@soltysh soltysh mentioned this pull request Aug 28, 2017
3 tasks
@k8s-github-robot k8s-github-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Aug 28, 2017
@soltysh
Copy link
Contributor Author

soltysh commented Aug 28, 2017

@deads2k for approval

go cronjob.NewCronJobController(
clientset.NewForConfigOrDie(cronjobConfig),
// clientset.NewForConfigOrDie(cronjobConfig),
Copy link
Member

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"}] {
Copy link
Member

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?

Copy link
Contributor Author

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.

@@ -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")},
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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"}] &&
Copy link
Contributor

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?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@deads2k
Copy link
Contributor

deads2k commented Aug 28, 2017

@lavalamp you should probably take a look at what's happening with these now. The effects of lacking a hub version are pretty ugly.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 28, 2017
@soltysh
Copy link
Contributor Author

soltysh commented Aug 28, 2017

I've addressed comments.

@janetkuo janetkuo added this to the v1.8 milestone Aug 28, 2017
@@ -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{})
Copy link
Member

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)

Copy link
Contributor Author

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.

Copy link
Contributor

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.

@soltysh
Copy link
Contributor Author

soltysh commented Aug 29, 2017

/test pull-kubernetes-e2e-gce-bazel

@janetkuo
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 29, 2017
@smarterclayton
Copy link
Contributor

Is there an issue in the features repo tracking this?

@janetkuo
Copy link
Member

Is there an issue in the features repo tracking this?

kubernetes/enhancements#19?

@janetkuo
Copy link
Member

/retest

1 similar comment
@janetkuo
Copy link
Member

/retest

@smarterclayton
Copy link
Contributor

smarterclayton commented Aug 29, 2017 via email

@k8s-github-robot
Copy link

[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 /approve no-issue

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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@janetkuo
Copy link
Member

/retest

@janetkuo
Copy link
Member

No associated issue. Update pull-request body to add a reference to an issue, or get approval with /approve no-issue

@soltysh would you add the issue number to the PR body so that it can get approved?

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 30, 2017
@soltysh
Copy link
Contributor Author

soltysh commented Aug 30, 2017

@soltysh would you add the issue number to the PR body so that it can get approved?

Done.

@dims
Copy link
Member

dims commented Aug 30, 2017

/retest

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 50775, 51397, 51168, 51465, 51536)

@shyamjvs
Copy link
Member

This PR is breaking presubmit e2e's due to the group version not being updated at a few places.
#51692

@justinsb
Copy link
Member

If this PR breaks/impacts HA clusters, can we expand the release note to be a little more instructive please? cc @jdumars

@soltysh
Copy link
Contributor Author

soltysh commented Aug 31, 2017

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.

@jdumars
Copy link
Member

jdumars commented Sep 6, 2017

Which SIG should this be assigned to?

@soltysh
Copy link
Contributor Author

soltysh commented Sep 8, 2017

@jdumars I'm currently updating the release notes, I'll ping you for a double check. It's sig-apps

@soltysh soltysh added the sig/apps Categorizes an issue or PR as relevant to SIG Apps. label Sep 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/apps Categorizes an issue or PR as relevant to SIG Apps. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants