Bugzilla will be upgraded to version 5.0. The upgrade date is tentatively scheduled for 2 December 2018, pending final testing and feedback.
Bug 1555003 - [3.7] Image pruning fails when DC 'image' field is blank
[3.7] Image pruning fails when DC 'image' field is blank
Status: CLOSED ERRATA
Product: OpenShift Container Platform
Classification: Red Hat
Component: Image (Show other bugs)
3.7.1
Unspecified Unspecified
unspecified Severity unspecified
: ---
: 3.7.z
Assigned To: Alexey Gladkov
Dongbo Yan
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2018-03-13 14:57 EDT by Stefanie Forrester
Modified: 2018-05-17 23:55 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2018-05-17 23:54:45 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:1576 None None None 2018-05-17 23:55 EDT

  None (edit)
Description Stefanie Forrester 2018-03-13 14:57:56 EDT
Description of problem:

The pruning command fails when a DeployConfig contains an empty string in the 'image:' field. For example:

----
[root@online-int-master-05114 ~]# oc get dc nodejs-mongo-persistent -n dakinitest20180313 -o yaml |grep image:
        image: ' '
----

The error can be seen by running the image pruner. It's causing our pruning cron job to fail, which means there are images that are not getting cleaned up on a regular interval like they should.

----
[root@online-int-master-05114 ~]# oc adm prune images --keep-younger-than 12h --keep-tag-revisions 5 --token $TOKEN --confirm --loglevel 4

<snip>

Failed to build graph!

The following objects have invalid references:

  DeploymentConfig[dakinitest20180313/nodejs-mongo-persistent]: invalid docker image reference " ": invalid reference format

Either fix the references or delete the objects to make the pruner proceed.
----


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

atomic-openshift-3.7.23-1.git.5.83efd71.el7.x86_64

How reproducible:
Every time

Steps to Reproduce:
1. Create an app using template nodejs-mongo-persistent (I think any other type of app would work too, as long as there's a DeployConfig).
2. Check the 'image:' line inside the DeployConfig. Make sure it's blank (image: ' ').
3. Run the pruner: oc adm prune images --keep-younger-than 12h --keep-tag-revisions 5 --token $TOKEN --confirm --loglevel 4

Actual results:

Pruning fails due to the 'image' field being blank.

Expected results:

Ideally pruning would skip the invalid DC's and move onto the other ones, so we can still benefit from cleaning up the rest of the images.

Additional info:
Comment 1 Maciej Szulik 2018-03-19 08:04:33 EDT

*** This bug has been marked as a duplicate of bug 1518817 ***
Comment 2 Ben Parees 2018-03-19 09:39:47 EDT
This isn't exactly a dupe of 1518817. we need to tolerate the empty string image field values because it's a common pattern.

But I believe Alexey already implemented a fix for this, perhaps it was not backported to 3.7 though?
Comment 3 Alexey Gladkov 2018-03-19 10:08:45 EDT
Yes, it is not backported.
Comment 4 Ben Parees 2018-03-19 12:12:04 EDT
Stephanie do you guys need this backported or can you make do until 3.9?
Comment 5 Stefanie Forrester 2018-03-19 12:20:48 EDT
3.9 is fine, thanks.
Comment 14 Dongbo Yan 2018-05-09 03:43:09 EDT
Verified
openshift v3.7.44
kubernetes v1.7.6+a08f5eeb62
etcd 3.2.8

cannot set blank in dc 'image' field now.
# oc create -f dc.yml -n dyan
The DeploymentConfig "nodejs-mongodb-example" is invalid: spec.template.spec.containers[0].image: Required value

it will fill value automatic if dc includes imageChange trigger parameters, or it will prompt error

So cannot reproduce this error when prune images
Comment 15 Dongbo Yan 2018-05-09 05:23:17 EDT
Hi, Ben, Alexey
What do you think about cannot set blank in dc 'image' field
Comment 16 Ben Parees 2018-05-09 08:36:40 EDT
the value needs to be a single space, not empty:  image: " "
Comment 17 Dongbo Yan 2018-05-09 23:04:45 EDT
Thanks Ben, verify again
openshift v3.7.46
kubernetes v1.7.6+a08f5eeb62
etcd 3.2.8

Reproduce steps:
1. Edit dc, set single space as the value in 'image' field, delete imageChange trigger parameters
2.Prune images
# oc adm prune images --keep-younger-than 0 --keep-tag-revisions 0 --token pmOg3zqQL8BvEetZREYEbXVJb1WrMlKAwbS7HSZbC-I  --confirm --loglevel 4

Actual results:
could prune images without error
Comment 20 errata-xmlrpc 2018-05-17 23:54:45 EDT
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-2018:1576

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