Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1873310

Summary: error: failed to create job: jobs.batch "image-pruner-01" is forbidden: cannot set blockOwnerDeletion in this case because cannot find RESTMapping for APIVersion apps/v1 Kind CronJob: no matches for kind "CronJob" in version "apps/v1"
Product: OpenShift Container Platform Reporter: Scott Worthington <scott.worthington>
Component: ocAssignee: Maciej Szulik <maszulik>
Status: CLOSED DUPLICATE QA Contact: zhou ying <yinzhou>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.4CC: aos-bugs, jokerman, mfojtik
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-08-28 09:37:07 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 Scott Worthington 2020-08-27 19:54:02 UTC
Description of problem:

$ oc create job --from=cronjob/image-pruner image-pruner-01
error: failed to create job: jobs.batch "image-pruner-01" is forbidden: cannot set blockOwnerDeletion in this case because cannot find RESTMapping for APIVersion apps/v1 Kind CronJob: no matches for kind "CronJob" in version "apps/v1"


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

oc 4.4.19 client


How reproducible:
Always


Steps to Reproduce:
1. Install latest oc client for 4.4.19

$ oc version
Client Version: 4.4.19
Server Version: 4.4.9
Kubernetes Version: v1.17.1+912792b

2. Enable cluster image pruner (or use any existing CronJob)

3. Attempt to create the job from cronjob

$ oc create job --from=cronjob/image-pruner image-pruner-01
error: failed to create job: jobs.batch "image-pruner-01" is forbidden: cannot set blockOwnerDeletion in this case because cannot find RESTMapping for APIVersion apps/v1 Kind CronJob: no matches for kind "CronJob" in version "apps/v1"

4. Download and install the 4.5.7 oc client

5. Run 'oc version'

$ oc version
Client Version: 4.5.7
Server Version: 4.4.9
Kubernetes Version: v1.17.1+912792b

6. Try to create the Job from a CronJob

$ oc create job --from=cronjob/image-pruner new-image-pruner
job.batch/new-image-pruner created


Actual results:

error: failed to create job: jobs.batch "image-pruner-01" is forbidden: cannot set blockOwnerDeletion in this case because cannot find RESTMapping for APIVersion apps/v1 Kind CronJob: no matches for kind "CronJob" in version "apps/v1"


Expected results:

job.batch/new-image-pruner created


Additional info:

https://docs.openshift.com/container-platform/4.4/logging/config/cluster-logging-curator.html#cluster-logging-curator-troubleshoot_cluster-logging-curator