Bug 1873310 - 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"
Summary: error: failed to create job: jobs.batch "image-pruner-01" is forbidden: canno...
Keywords:
Status: CLOSED DUPLICATE of bug 1814728
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.4
Hardware: All
OS: All
unspecified
high
Target Milestone: ---
: ---
Assignee: Maciej Szulik
QA Contact: zhou ying
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-27 19:54 UTC by Scott Worthington
Modified: 2020-08-28 09:37 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-08-28 09:37:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

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


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