Bug 1569824

Summary: "oc export" failed with error: no kind "CronJob" is registered for version "batch/v1"
Product: OpenShift Container Platform Reporter: Daein Park <dapark>
Component: ocAssignee: Juan Vallejo <jvallejo>
Status: CLOSED DEFERRED QA Contact: Xingxing Xia <xxia>
Severity: low Docs Contact:
Priority: unspecified    
Version: 3.7.0CC: aos-bugs, dapark, jokerman, maszulik, mmccomas
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-25 01:41:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Daein Park 2018-04-20 03:20:55 UTC
Description of problem:

When "oc export" run for backup the project included "CronJob" resources, the command failed with 'error: no kind "CronJob" is registered for version "batch/v1"' messages on the v3.7.42 OCP.


I experienced this problem on the two patterns.
 1. OCP Upgrade from v3.7.23 to v3.7.42.
 2. Using oc-3.7.42-linux.tar.gz on v3.7.23 OCP.


Version-Release number of selected component (if applicable):

* OCP verion:
  oc v3.7.42
  kubernetes v1.7.6+a08f5eeb62
  features: Basic-Auth GSSAPI Kerberos SPNEGO

  Server https://master.ocp37.exmple.com:8443
  openshift v3.7.42
  kubernetes v1.7.6+a08f5eeb62


* OpenShift v3.7 Linux Client:
  oc-3.7.42-linux.tar.gz

  Last modified: 2018-04-05 SHA-256 Checksum: f838b914bfc9ad7b1566200bc13ad1e5b51f10a5cbe94ee01ec7b9008afd5a71


How reproducible:

I explains the steps using v3.7.42 client here, but you can reproduce on any OCP v3.7.42 and it can reproduce regardless of when the cronjob create at.


1. create the project for test.
# oc new-project oc-export-failed

2. create an CronJob resouce in the created namespace.
# oc create -f - <<EOF
apiVersion: batch/v2alpha1
kind: CronJob
metadata:
  name: testcrontjobs
spec:
  schedule: "*/10 * * * *"  
  jobTemplate:             
    spec:
      template:
        metadata:
          labels:          
            parent: "cronjobpi"
        spec:
          containers:
          - name: pi
            image: perl
            command: ["perl",  "-Mbignum=bpi", "-wle", "print bpi(2000)"]
          restartPolicy: OnFailure
EOF

3. download v3.7.42 client
 from https://access.redhat.com/downloads/content/290

4. run "oc export" using v3.7.42 client
# tar -zxvf oc-3.7.42-linux.tar.gz

# ./oc export cronjob -n oc-export-failed
error: no kind "CronJob" is registered for version "batch/v1"



Steps to Reproduce:
1.
2.
3.

Actual results:

  failed with 'error: no kind "CronJob" is registered for version "batch/v1"' message.


Expected results:

  export the cronjob resource definitions successfully using "oc export" command.

Additional info:

  workaournd is using v3.7.23 client tool.

Comment 1 Xingxing Xia 2018-04-20 03:34:09 UTC
The env in https://bugzilla.redhat.com/show_bug.cgi?id=1552325#c10 also reproduces this bug. (`oc export job` works, though)

Comment 7 Daein Park 2018-04-25 01:41:05 UTC
I checked the "CronJob" is techpreview status[0] as of v3.7 and I close this buz.

And I also verified this issues was clear at v3.9 and the cronjob is not techpreview from v3.9.

[0] CronJobs [https://docs.openshift.com/container-platform/3.7/dev_guide/cron_jobs.html]

Comment 8 Maciej Szulik 2018-04-25 08:32:28 UTC
> And I also verified this issues was clear at v3.9 and the cronjob is not techpreview from v3.9.

Cron Jobs are STILL techpreview feature we did not drop that. It's a bug in the docs, I've notified the docs team already.