Bug 1834643 - `oc create cronjob` help show incorrect example
Summary: `oc create cronjob` help show incorrect example
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.5
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: 4.6.0
Assignee: Maciej Szulik
QA Contact: RamaKasturi
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-12 06:39 UTC by zhou ying
Modified: 2020-10-27 15:59 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-27 15:58:59 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4196 0 None None None 2020-10-27 15:59:20 UTC

Description zhou ying 2020-05-12 06:39:07 UTC
Description of problem:
`oc create cronjob` help show incorrect example 

Version-Release number of selected component (if applicable):
[root@localhost ~]# oc version 
Client Version: 4.5.0-202005072157-f415627
Server Version: 4.5.0-0.nightly-2020-05-10-180138
Kubernetes Version: v1.18.0-rc.1

How reproducible:
always

Steps to Reproduce:
1. Use `oc create cronjob -h` to check the help infomation
2. Follow the help to use commmand: 
   `oc create cronjob my-job --image=busybox`
3. Follow the help to use command:
   `oc create cronjob my-job --image=busybox -- date`


Actual results:
1. show:
[root@localhost ~]# oc create cronjob -h
Create a cronjob with the specified name.

Aliases:
cronjob, cj

Usage:
  oc create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...] [flags]

Examples:
  # Create a cronjob
  oc create cronjob my-job --image=busybox
  
  # Create a cronjob with command
  oc create cronjob my-job --image=busybox -- date


2. Failed with error: --schedule must be specified
3. failed with error: --schedule must be specified

Expected results:
1. Show correct example.

Additional info:

Comment 1 Maciej Szulik 2020-05-12 08:38:00 UTC
I've opened https://github.com/kubernetes/kubernetes/pull/91013 and we'll get the fix in the next release.

Comment 2 Maciej Szulik 2020-05-20 08:29:30 UTC
Upstream PRs merged.

Comment 3 Maciej Szulik 2020-06-18 10:10:14 UTC
This is waiting for k8s bump.

Comment 4 Maciej Szulik 2020-07-09 11:03:56 UTC
Waiting for next k8s bump.

Comment 5 Maciej Szulik 2020-08-21 12:04:33 UTC
K8s was bumped in https://github.com/openshift/oc/pull/491

Comment 8 RamaKasturi 2020-08-24 07:09:56 UTC
Verified with the version below and i do see right examples in "oc create cronjob -h"

[ramakasturinarra@dhcp35-60 ~]$ oc version -o yaml
clientVersion:
  buildDate: "2020-08-21T02:37:08Z"
  compiler: gc
  gitCommit: ea0d54068621ec0f95973068729f739f3dacfef7
  gitTreeState: clean
  gitVersion: 4.6.0-202008210209.p0-ea0d540
  goVersion: go1.14.4
  major: ""
  minor: ""
  platform: linux/amd64
openshiftVersion: 4.6.0-0.nightly-2020-08-23-214712
serverVersion:
  buildDate: "2020-08-20T16:46:57Z"
  compiler: gc
  gitCommit: 3e083ac29409923906267ebcc5f8e0aa13072c72
  gitTreeState: dirty
  gitVersion: v1.19.0-rc.2+3e083ac-dirty
  goVersion: go1.14.4
  major: "1"
  minor: 19+
  platform: linux/amd64



[ramakasturinarra@dhcp35-60 ~]$ oc create cronjob -h
Create a cronjob with the specified name.

Aliases:
cronjob, cj

Usage:
  oc create cronjob NAME --image=image --schedule='0/5 * * * ?' -- [COMMAND] [args...] [flags]

Examples:
  # Create a cronjob
  oc create cronjob my-job --image=busybox --schedule="*/1 * * * *"
  
  # Create a cronjob with command
  oc create cronjob my-job --image=busybox --schedule="*/1 * * * *" -- date

Options:
      --allow-missing-template-keys=true: If true, ignore any errors in templates when a field or map key is missing in
the template. Only applies to golang and jsonpath output formats.
      --dry-run='none': Must be "none", "server", or "client". If client strategy, only print the object that would be
sent, without sending it. If server strategy, submit server-side request without persisting the resource.
      --field-manager='kubectl-create': Name of the manager used to track field ownership.
      --image='': Image name to run.
  -o, --output='': Output format. One of:
json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file.
      --restart='': job's restart policy. supported values: OnFailure, Never
      --save-config=false: If true, the configuration of current object will be saved in its annotation. Otherwise, the
annotation will be unchanged. This flag is useful when you want to perform kubectl apply on this object in the future.
      --schedule='': A schedule in the Cron format the job should be run with.
      --template='': Template string or path to template file to use when -o=go-template, -o=go-template-file. The
template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].
      --validate=false: If true, use a schema to validate the input before sending it

Use "oc options" for a list of global command-line options (applies to all commands).

Also running the above examples work fine.

[ramakasturinarra@dhcp35-60 ~]$ oc create cronjob my-job --image=busybox --schedule="*/1 * * * *"
cronjob.batch/my-job created

[ramakasturinarra@dhcp35-60 ~]$ oc create cronjob my-job1 --image=busybox --schedule="*/1 * * * *" -- date
cronjob.batch/my-job1 created

[ramakasturinarra@dhcp35-60 ~]$ oc get cronjob
NAME      SCHEDULE      SUSPEND   ACTIVE   LAST SCHEDULE   AGE
my-job    */1 * * * *   False     0        <none>          20s
my-job1   */1 * * * *   False     0        <none>          6s

Based on the above moving it to verified state.

Comment 10 errata-xmlrpc 2020-10-27 15:58:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.6 GA Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4196


Note You need to log in before you can comment on or make changes to this bug.