kubernetes / kubectl

Issue tracker and mirror of kubectl code
Apache License 2.0
2.83k stars 913 forks source link

Use oc create job --from=cronjob/foo -- bar #1578

Closed jackovsky8 closed 6 months ago

jackovsky8 commented 6 months ago

What would you like to be added: When you run the command: kubectl create job --from=cronjob/mycronjob -- bar You receive the following error: error: cannot specify --from and command

It would be useful to modify the command for the job here.

Why is this needed: This would be a very handy feature. E.g. you have a cron job with a lot of options, config maps, secrets, PVCs etc, and you want to run this underlying command with another parameter.

It could be used for all kinds of purposes, like maybe to activate a debug log in the underlying tool, or to run tests or the cron job only covers 90 percent of the usage and the rest is done manually.

The only option to achieve this now, is to get the job template with another tool, modify it and create a job with the modified config.

But I don't think it's such a rare requirement.

k8s-ci-robot commented 6 months ago

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/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.
mpuckett159 commented 6 months ago

/close This is a duplicate of https://github.com/kubernetes/kubectl/issues/1206 which was closed. To expand on the response there we do not intend to expand the functionality of imperative commands in kubectl, create being one such command. The recommended path forward is to duplicate the yaml for the existing job, and use kubectl apply to create the new job.

k8s-ci-robot commented 6 months ago

@mpuckett159: Closing this issue.

In response to [this](https://github.com/kubernetes/kubectl/issues/1578#issuecomment-2024109740): >/close >This is a duplicate of https://github.com/kubernetes/kubectl/issues/1206 which was closed. To expand on the response there we do not intend to expand the functionality of imperative commands in kubectl, create being one such command. The recommended path forward is to duplicate the yaml for the existing job, and use kubectl apply to create the new job. Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/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.