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

Unable to update cronjob image using kubectl set image #57393

Closed
okke-formsma opened this issue Dec 19, 2017 · 9 comments
Closed

Unable to update cronjob image using kubectl set image #57393

okke-formsma opened this issue Dec 19, 2017 · 9 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. sig/cli Categorizes an issue or PR as relevant to SIG CLI.

Comments

@okke-formsma
Copy link

okke-formsma commented Dec 19, 2017

/kind feature

What happened:
I would like to use a newer version of my image in a cronjob, but I can't update the cronjob template using 'kubectl set'

What you expected to happen:
I would expect to issue a command like the following, but it's not possible to update a cronjob template.

kubectl set image cronjob python=python:3.5

How to reproduce it (as minimally and precisely as possible):
create a cronjob and try to update the image that is pulled for each job.

Environment:

  • Kubernetes version (use kubectl version):
    Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.5", GitCommit:"cce11c6a185279d037023e02ac5249e14daa22bf", GitTreeState:"clean", BuildDate:"2017-12-07T16:16:03Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"windows/amd64"}
    Server Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.4", GitCommit:"9befc2b8928a9426501d3bf62f72849d5cbcd5a3", GitTreeState:"clean", BuildDate:"2017-11-20T05:17:43Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}

  • Cloud provider or hardware configuration:
    azure

  • Install tools:
    acs-engine

@k8s-ci-robot k8s-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 19, 2017
@k8s-github-robot k8s-github-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Dec 19, 2017
@okke-formsma
Copy link
Author

okke-formsma commented Dec 19, 2017

I have found the following way to update the image;

kubectl patch -f definition.yaml --type=json -p='[{"op":"replace", "path": "/spec/jobTemplate/spec/template/spec/containers/0/image", "value":"python:3.5"}]'

Still it would be nice to use the same tool (kubectl set image) for both deployments and cronjobs.

@dims
Copy link
Member

dims commented Dec 19, 2017

/sig cli

@k8s-ci-robot k8s-ci-robot added the sig/cli Categorizes an issue or PR as relevant to SIG CLI. label Dec 19, 2017
@k8s-github-robot k8s-github-robot removed the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Dec 19, 2017
@xingzhou
Copy link
Contributor

yeap, the UpdatePodSpecForObject method does not handle cronjob situation. In addition, CronJob does not contain a direct Pod template spec, instead, it contains JobTemplate which contains the pod spec. I will try to give a fix on this then.

@webbrandon
Copy link

👍

@liggitt
Copy link
Member

liggitt commented Jan 6, 2018

Fixed in #57742

@liggitt liggitt closed this as completed Jan 6, 2018
@richtera
Copy link

Which version will contain the new kubectl set image support for cronjobs? Is this just a command line patch or also system images?

@calebmcelroy
Copy link

@richtera, it's in v1.10. Seem to be just a command line patch.

This worked for me:
kubectl set image cronjob/cronjobmetadataname python=python:3.5

I know this is an older thread but hopefully it helps someone else!

@richtera
Copy link

@calebmcelroy oh cool. Thanks I'll be able to fix my scripts and simplify things

@yashsaini77
Copy link

@richtera, it's in v1.10. Seem to be just a command line patch.

This worked for me:
kubectl set image cronjob/cronjobmetadataname python=python:3.5

I know this is an older thread but hopefully it helps someone else!

what is exactly the cronjobmetadataname here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. sig/cli Categorizes an issue or PR as relevant to SIG CLI.
Projects
None yet
Development

No branches or pull requests

10 participants