Description of problem: seems that creating a cronjob from a template fails not matching the right apiversion: 1) kubectl api-versions | grep batch batch/v1 batch/v1beta1 2) cat cronjob.yaml kind: Template apiVersion: "template.openshift.io/v1" metadata: creationTimestamp: null name: test-cronjob objects: - apiVersion: batch/v1beta1 kind: CronJob metadata: name: cronjobtest spec: concurrencyPolicy: Allow failedJobsHistoryLimit: 7 jobTemplate: metadata: creationTimestamp: null spec: template: metadata: creationTimestamp: null spec: containers: - command: - /bin/bash - -c - pwd image: test imagePullPolicy: Always name: job-publier terminationMessagePath: /dev/termination-log terminationMessagePolicy: File dnsPolicy: ClusterFirst restartPolicy: OnFailure schedulerName: default-scheduler securityContext: {} terminationGracePeriodSeconds: 30 schedule: 00 09 * * 1 successfulJobsHistoryLimit: 7 suspend: false 3) oc new-app --file=./cronjob.yaml --> Deploying template "mytest/test-cronjob" for "./cronjob.yaml" to project mytest --> Creating resources ... error: no kind "CronJob" is registered for version "batch/v1" in scheme "k8s.io/kubernetes/pkg/api/legacyscheme/scheme.go:29" --> Failed Version-Release number of selected component (if applicable): oc version oc v3.11.135 kubernetes v1.11.0+d4cacc0 features: Basic-Auth GSSAPI Kerberos SPNEGO Server https://openshift.internal.newparente.lab.pnq2.cee.redhat.com:443 openshift v3.11.135 kubernetes v1.11.0+d4cacc0 Additional info: The workaround is: oc process -f cronjob.yaml -o yaml | oc apply -f - or define only a cronjob resource and: oc apply -f ./cronjob.yaml
This part of oc belongs to devexp, sending it that way. This looks to work fine with oc 4.x