Bug 1555003 - [3.7] Image pruning fails when DC 'image' field is blank
Summary: [3.7] Image pruning fails when DC 'image' field is blank
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: ImageStreams
Version: 3.7.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: 3.7.z
Assignee: Alexey Gladkov
QA Contact: Dongbo Yan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-03-13 18:57 UTC by Stefanie Forrester
Modified: 2021-12-10 15:47 UTC (History)
10 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-05-18 03:54:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:1576 0 None None None 2018-05-18 03:55:23 UTC

Description Stefanie Forrester 2018-03-13 18:57:56 UTC
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 12:04:33 UTC

*** This bug has been marked as a duplicate of bug 1518817 ***

Comment 2 Ben Parees 2018-03-19 13:39:47 UTC
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 14:08:45 UTC
Yes, it is not backported.

Comment 4 Ben Parees 2018-03-19 16:12:04 UTC
Stephanie do you guys need this backported or can you make do until 3.9?

Comment 5 Stefanie Forrester 2018-03-19 16:20:48 UTC
3.9 is fine, thanks.

Comment 14 Dongbo Yan 2018-05-09 07:43:09 UTC
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 09:23:17 UTC
Hi, Ben, Alexey
What do you think about cannot set blank in dc 'image' field

Comment 16 Ben Parees 2018-05-09 12:36:40 UTC
the value needs to be a single space, not empty:  image: " "

Comment 17 Dongbo Yan 2018-05-10 03:04:45 UTC
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-18 03:54:45 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-2018:1576


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