Bug 1835004 - keepYoungerThan is expecting one integer instead of one String
Summary: keepYoungerThan is expecting one integer instead of one String
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Image Registry
Version: 4.4
Hardware: All
OS: Linux
unspecified
urgent
Target Milestone: ---
: 4.5.0
Assignee: Oleg Bulatov
QA Contact: Wenjing Zheng
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-12 21:26 UTC by Odilon Sousa
Modified: 2023-10-06 20:00 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: keepYoungerThan is expected to be an integer. It is an integer that defines a minimal image age in nanoseconds. Consequence: It's inconvenient to use nanoseconds to tune the pruner. Fix: Deprecate keepYoungerThan and introduce a new field named keepYoungerThanDuration. Result: keepYoungerThanDuration can be set to "60m" and similar values.
Clone Of:
Environment:
Last Closed: 2020-07-13 17:37:59 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift api pull 645 0 None closed Bug 1835004: Prefer metav1.Duration in API types 2021-01-14 06:39:53 UTC
Github openshift api pull 649 0 None closed Bug 1835004: Add keepYoungerThanDuration and deprecate keepYoungerThan 2021-01-14 06:39:53 UTC
Github openshift cluster-image-registry-operator pull 560 0 None closed Bug 1835004: Use keepYoungerThanDuration 2021-01-14 06:40:33 UTC
Red Hat Product Errata RHBA-2020:2409 0 None None None 2020-07-13 17:38:20 UTC

Description Odilon Sousa 2020-05-12 21:26:08 UTC
Description of problem: 

While trying to set keepYoungerThan, the client returns spec.keepYoungerThan in body must be of type integer: "string"

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

Openshift Container Platform 4.4

How reproducible:

$ cat <<EOF >>image-pruner.yaml
apiVersion: imageregistry.operator.openshift.io/v1
kind: ImagePruner
metadata:
  name: imageprunertest
spec:
  schedule: "*/0 * * * *"
  suspend: false
  keepTagRevisions: 3
  keepYoungerThan: 60m
  startingDeadlineSeconds: 60
  successfulJobsHistoryLimit: 3
  failedJobsHistoryLimit: 3
EOF

$ oc create -f image-pruner.yaml


Actual results:

The ImagePruner "imageprunertest" is invalid: spec.keepYoungerThan: Invalid value: "string": spec.keepYoungerThan in body must be of type integer: "string"

Expected results:

The object to be created without problem

Additional info:

Comment 5 Wenjing Zheng 2020-05-28 02:49:37 UTC
Below error still return when define like "keepYoungerThan: 60m" with 4.5.0-0.nightly-2020-05-27-174108:
# imagepruners.imageregistry.operator.openshift.io "cluster" was not valid:
# * spec.keepYoungerThan: Invalid value: "string": spec.keepYoungerThan in body must be of type integer: "string"

Below setting can be saved:
spec:
  failedJobsHistoryLimit: 3
  keepTagRevisions: 3
  keepYoungerThan: 60
  schedule: ""
  successfulJobsHistoryLimit: 3
  suspend: false

Comment 6 Wenjing Zheng 2020-05-28 02:55:15 UTC
This config change works:
spec:
  failedJobsHistoryLimit: 3
  keepTagRevisions: 3
  keepYoungerThan: 60
  keepYoungerThanDuration: 60m

I will report a doc bug to deprecate "keepYoungerThan".

Comment 7 Wenjing Zheng 2020-05-28 02:59:23 UTC
If keepYoungerThan is deprecated, can we pop up a warning let user know to use keepYoungerThanDuration when user wants to config keepYoungerThan?

Comment 8 Oleg Bulatov 2020-05-28 10:06:47 UTC
Unfortunately we cannot change the type of keepYoungerThan from an integer to string.

We should replace keepYoungerThan with keepYoungerThanDuration in docs. It's better to almost completely remove keepYoungerThan from documentation, we can just mention that this field exists and shouldn't be used.

Comment 9 Wenjing Zheng 2020-05-28 10:13:33 UTC
(In reply to Oleg Bulatov from comment #8)
> Unfortunately we cannot change the type of keepYoungerThan from an integer
> to string.
> 
> We should replace keepYoungerThan with keepYoungerThanDuration in docs. It's
> better to almost completely remove keepYoungerThan from documentation, we
> can just mention that this field exists and shouldn't be used.

OK, get it, thanks! I will add your suggestion to the doc bug: https://bugzilla.redhat.com/show_bug.cgi?id=1840973 . Feel free to change this bug back to ON_QA.

Comment 10 Wenjing Zheng 2020-05-29 08:04:35 UTC
Verified on 4.5.0-0.nightly-2020-05-29-005153.

Comment 11 errata-xmlrpc 2020-07-13 17:37: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, 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:2409


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