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

ScheduledJob kubectl #25816

Merged
merged 5 commits into from Aug 5, 2016
Merged

Conversation

soltysh
Copy link
Contributor

@soltysh soltysh commented May 18, 2016

@erictune the last part (kubectl) of the ScheduledJob, as usual builds on top of previous PRs, so only last 2 commits matter (the kubectl one and storage leftovers).

* Introducing ScheduledJobs as described in [the proposal](https://github.com/kubernetes/kubernetes/blob/master/docs/proposals/scheduledjob.md) as part of `batch/v2alpha1` version (experimental feature).

Analytics

@soltysh soltysh changed the title Scheduledjob kubectl ScheduledJob kubectl May 18, 2016
@soltysh
Copy link
Contributor Author

soltysh commented May 18, 2016

@lavalamp I'm having some problems with initiating storage for scheduledjobs, iow. the batch/v2alpha1 groups, see the following error I'm getting. What am I missing, got some ideas?

I0518 15:38:12.822156   25767 storage_factory.go:217] storing {batch scheduledjobs} in batch/v1, reading as batch/__internal from { {0xc82037b6c0 0xc82037b730} /registry [http://127.0.0.1:4001]    false 50000}
panic: storage codec doesn't seem to match given type: Internal type not encodable: no kind "ScheduledJob" is registered for version "batch/v1"

goroutine 1 [running]:
panic(0x1f0f1a0, 0xc820488a10)
        /usr/lib/golang/src/runtime/panic.go:481 +0x3e6
k8s.io/kubernetes/pkg/storage.NewCacherFromConfig(0x64, 0x7f524108c398, 0xc8201a3400, 0x7f524108c360, 0x41b9228, 0x2b03cc0, 0xc820183400, 0x2b5c730, 0xe, 0xc820570bc0, ...)
        /home/maszulik/workspace/k8s/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/storage/cacher.go:156 +0x817
k8s.io/kubernetes/pkg/storage.NewCacher(0x7f524108c398, 0xc8201a3400, 0x64, 0x7f524108c360, 0x41b9228, 0x7f52410888e0, 0xc820183400, 0x2b5c730, 0xe, 0x7f52410c37b8, ...)
        /home/maszulik/workspace/k8s/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/storage/cacher.go:142 +0x185
k8s.io/kubernetes/pkg/registry/generic/registry.StorageWithCacher(0x7f524108c398, 0xc8201a3400, 0x64, 0x7f52410888e0, 0xc820183400, 0x2b5c730, 0xe, 0x7f52410c37b8, 0xc820570ba0, 0x32911e8, ...)
        /home/maszulik/workspace/k8s/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/registry/generic/registry/storage_factory.go:36 +0x101
k8s.io/kubernetes/pkg/registry/scheduledjob/etcd.NewREST(0x7f524108c398, 0xc8201a3400, 0x3290fa8, 0x1, 0x3290fa8, 0x1)
        /home/maszulik/workspace/k8s/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/registry/scheduledjob/etcd/etcd.go:41 +0x1cc
k8s.io/kubernetes/pkg/master.(*Master).getBatchResources(0xc8203ad930, 0xc820332fa0, 0x2b4dd78, 0x5, 0x2b92c90, 0x8, 0xc82037b260)
        /home/maszulik/workspace/k8s/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/master/master.go:844 +0x733
k8s.io/kubernetes/pkg/master.(*Master).InstallAPIs(0xc8203ad930, 0xc820332fa0)
        /home/maszulik/workspace/k8s/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/master/master.go:331 +0x2751
k8s.io/kubernetes/pkg/master.New(0xc820332fa0, 0x0, 0x0, 0x0)
        /home/maszulik/workspace/k8s/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/pkg/master/master.go:173 +0x189
k8s.io/kubernetes/cmd/kube-apiserver/app.Run(0xc8202c7680, 0x0, 0x0)
        /home/maszulik/workspace/k8s/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/cmd/kube-apiserver/app/server.go:239 +0x2e3c
main.main()
        /home/maszulik/workspace/k8s/src/k8s.io/kubernetes/_output/local/go/src/k8s.io/kubernetes/cmd/kube-apiserver/apiserver.go:50 +0x121

From my debugging it looks like the storagefactory is picking the wrong codec for ScheduledJob, do you have some thoughts where should I register one to be properly picked up?

@k8s-github-robot k8s-github-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/new-api size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 18, 2016
@lavalamp
Copy link
Member

I have a long queue right now so sorry for the cryptic answer-- you need to somehow override the storage version for just the ScheduledJob resource to be v2alpha1 since it doesn't exist in v1. Not sure if the existing flag is going to make that easy or not.

@soltysh
Copy link
Contributor Author

soltysh commented May 19, 2016

@lavalamp thanks, will try to poke around and see what I can come up with.

@soltysh
Copy link
Contributor Author

soltysh commented May 23, 2016

@lavalamp I've noticed there's a SetResourceEncoding which is not used currently but does exactly what you've mentioned. Iow. it allows specifying a storage version for specific resource, it's not exposed, though. Mind having a look and letting me know if it's more or less what you'd expect to look like?

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API kind/new-api size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 23, 2016
@soltysh
Copy link
Contributor Author

soltysh commented May 23, 2016

@erictune @lavalamp with the current state I am able to get & create scheduledjobs using curl, but trying to use kubectl fails everytime with error when creating "scheduledjob.yaml": no kind "ScheduledJob" is registered for version "batch/v1" even when using kubectl get scheduledjobs.v2alpha1.batch which should reach the right endpoint. Any ideas?

@erictune erictune added release-note Denotes a PR that will be considered when it comes time to generate release notes. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed release-note-label-needed labels May 23, 2016
@lavalamp
Copy link
Member

@soltysh What's the file you're creating look like? it needs to have batch/v2alpha1 as the apiVersion?

Also presumably you built an new kubectl?

@soltysh
Copy link
Contributor Author

soltysh commented May 23, 2016

@lavalamp this is the resource I'm trying to create: https://gist.github.com/soltysh/a917d4aac4cbccbff690117c0fc99a6c, but I still hit error: error when creating "scheduledjob.yaml": no kind "ScheduledJob" is registered for version "batch/v1

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 23, 2016
@janetkuo
Copy link
Member

janetkuo commented Aug 2, 2016

just a heads up that #29187 is in now

@soltysh
Copy link
Contributor Author

soltysh commented Aug 2, 2016

just a heads up that #29187 is in now

Yup, seen it. I'm currently updating this one. Should be ready in a few minutes.

@soltysh
Copy link
Contributor Author

soltysh commented Aug 2, 2016

Rebased and addressed all your comments @janetkuo . The only problem I'm struggling with is hack/update-generated-protobuf.sh is failing for me locally, but hopefully that won't be a problem with this PR. ptal

@k8s-github-robot k8s-github-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Aug 2, 2016
@janetkuo
Copy link
Member

janetkuo commented Aug 2, 2016

Code looks good, but the panic: storage codec doesn't seem to match given type: Internal type not encodable: no kind "ScheduledJob" is registered for version "batch/v1" error is back again

@soltysh
Copy link
Contributor Author

soltysh commented Aug 3, 2016

Code looks good, but the panic: storage codec doesn't seem to match given type: Internal type not encodable: no kind "ScheduledJob" is registered for version "batch/v1" error is back again

Of course it does... 😭 I'll try to figure it out later today.

@soltysh
Copy link
Contributor Author

soltysh commented Aug 3, 2016

This is a problem with integration tests that I need to fix to address multiversion tests.

@soltysh
Copy link
Contributor Author

soltysh commented Aug 3, 2016

@janetkuo the problem was that I've added batchapi.v2alpha1.SchemeGroupVersion in DefaultAPIResourceConfigSource but I should not. I've removed it, but I've extended our integration tests with batch/v2alpha1 version.

@soltysh
Copy link
Contributor Author

soltysh commented Aug 3, 2016

There's still one problem, already filled in issue #29998, but I think we'll have to deal with it as a followup. I'd like to move forward with the existing SJ PRs.

@soltysh
Copy link
Contributor Author

soltysh commented Aug 4, 2016

It looks like the rbac is not working as expected against multiversioned batch, I've created #30079 to track this one and I'm removing the last commit (adding batch/v2alpha1 to integration) from this PR.

@soltysh
Copy link
Contributor Author

soltysh commented Aug 4, 2016

@erictune @janetkuo ptal

@k8s-bot
Copy link

k8s-bot commented Aug 4, 2016

GCE e2e build/test passed for commit b5c68a9.

@janetkuo janetkuo added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 4, 2016
@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Aug 5, 2016

GCE e2e build/test passed for commit b5c68a9.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 7921a9c into kubernetes:master Aug 5, 2016
@soltysh soltysh deleted the scheduledjob_kubectl branch August 5, 2016 08:55
k8s-github-robot pushed a commit that referenced this pull request Aug 6, 2016
Automatic merge from submit-queue

Scheduledjob controller

Supersedes #25952; first 7 commits come from #25816

<!--
Checklist for submitting a Pull Request

Please remove this comment block before submitting.

1. Please read our [contributor guidelines](https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md).
2. See our [developer guide](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md).
3. If you want this PR to automatically close an issue when it is merged,
   add `fixes #<issue number>` or `fixes #<issue number>, fixes #<issue number>`
   to close multiple issues (see: https://github.com/blog/1506-closing-issues-via-pull-requests).
4. Follow the instructions for [labeling and writing a release note for this PR](https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes) in the block below.
-->

```release-note
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants