Bug 1441028 - Can't prune the external image
Summary: Can't prune the external image
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Image Registry
Version: 3.5.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.7.0
Assignee: Michal Minar
QA Contact: ge liu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-04-11 03:17 UTC by zhou ying
Modified: 2017-11-28 21:53 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: Image pruning algorithm used to consider only managed images for pruning. Consequence: Mirrored blobs for not managed images could not be pruned. External images, could not be removed using pruning. Fix: Pruning algorithm evaluates all the images, not just managed. Result: External images and their blobs can now be pruned.
Clone Of:
Environment:
Last Closed: 2017-11-28 21:53:29 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:3188 normal SHIPPED_LIVE Moderate: Red Hat OpenShift Container Platform 3.7 security, bug, and enhancement update 2017-11-29 02:34:54 UTC

Description zhou ying 2017-04-11 03:17:49 UTC
Description of problem:
After mirror the external image into docker-registry, can't prune the image which out of keep-tag-revisions option.

Version-Release number of selected component (if applicable):
openshift v3.5.5.5
kubernetes v1.5.2+43a9be4
etcd 3.1.0

How reproducible:
always

Steps to Reproduce:
1) Use 'oc tag ' to create imagestream with tag 'aaa'
   `oc tag --source=docker docker.io/busybox  myis:aaa`
2) Use 'oc tag ' to create imagestream with tag 'bbb':
   `oc tag --source=docker docker.io/busybox  myis:bbb` 
3) Use 'docker pull' command to pull the images , with the 'mirrorpullthrough' feature , the docker-registry will store the image A;

4) Tag image B with imagestream with tag 'aaa'
   `oc tag --source=docker openshift/hello-openshift myis:aaa`
5) Use 'docker pull' command to pull the images , with the 'mirrorpullthrough' feature , the docker-registry will store the image B;

6) Tag image C with imagestream with tag 'aaa'
    `oc tag --source=docker openshift/deployment-example myis:aaa`
7)Use 'docker pull' command to pull the images , with the 'mirrorpullthrough' feature , the docker-registry will store the image C;

8)use command to prune image:
   `oadm prune images --keep-tag-revisions=1 --keep-younger-than=0m`


Actual results:
8)The step 8 will not prune any images


Expected results:
8)Should prune the image B.



Additional info:

Comment 1 Michal Minar 2017-04-11 09:13:46 UTC
There's an associated github issue: https://github.com/openshift/origin/issues/13700

Let's prune the external images as well.

Comment 2 Michal Minar 2017-04-29 10:43:40 UTC
And here's a fix: https://github.com/openshift/origin/pull/13900

Comment 3 Michal Minar 2017-05-04 13:02:39 UTC
And the fix has been merged. I'm working on documentation now.

Comment 4 zhou ying 2017-05-05 01:38:04 UTC
Confirmed with latest origin, the issue has fixed :
oadm version
oadm v3.6.0-alpha.1+3b56da5-409
kubernetes v1.6.1+5115d708d7

openshift v3.6.0-alpha.1+3b56da5-409
kubernetes v1.6.1+5115d708d7

[root@ip-172-18-5-86 amd64]# oc get is myis -o yaml
apiVersion: v1
.......
status:
  dockerImageRepository: 172.30.10.98:5000/zhouy/myis
  tags:
  - items:
    - created: 2017-05-05T01:30:16Z
      dockerImageReference: openshift/deployment-example@sha256:ea9135488f323060cb18ab3ec06286cd49e4b3a611fce1a6a442651ecf421f99
      generation: 8
      image: sha256:ea9135488f323060cb18ab3ec06286cd49e4b3a611fce1a6a442651ecf421f99
    - created: 2017-05-05T01:29:17Z
      dockerImageReference: openshift/hello-openshift@sha256:bb21f3b2114a740a6c6322c8af0ec648174e6f2c800c8e09ec9f81f8ed209522
      generation: 6
      image: sha256:bb21f3b2114a740a6c6322c8af0ec648174e6f2c800c8e09ec9f81f8ed209522
    - created: 2017-05-05T01:20:49Z
      dockerImageReference: docker.io/busybox@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f
      generation: 2
      image: sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f
    tag: aaa
  - items:
    - created: 2017-05-05T01:25:41Z
      dockerImageReference: docker.io/busybox@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f
      generation: 4
      image: sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f
    tag: bbb
[root@ip-172-18-5-86 amd64]# oadm prune images --keep-tag-revisions=1 --keep-younger-than=0m
Dry run enabled - no modifications will be made. Add --confirm to remove images
Deleting references from image streams to images ...
STREAM       IMAGE                                                                     TAGS
zhouy/myis   sha256:bb21f3b2114a740a6c6322c8af0ec648174e6f2c800c8e09ec9f81f8ed209522   aaa

Deleting registry repository layer links ...
REPO         LAYER LINK
zhouy/myis   sha256:52ac0507e0fffc94cc56134026e68f994d693005f05f894f7b2dbce9033125a3
zhouy/myis   sha256:2547625ce3bf125360c758c172dd2a01913c2314411d3425adf66f79bf405755

Deleting registry layer blobs ...
BLOB
sha256:52ac0507e0fffc94cc56134026e68f994d693005f05f894f7b2dbce9033125a3
sha256:2547625ce3bf125360c758c172dd2a01913c2314411d3425adf66f79bf405755

Deleting registry repository manifest data ...
REPO         IMAGE
zhouy/myis   sha256:bb21f3b2114a740a6c6322c8af0ec648174e6f2c800c8e09ec9f81f8ed209522

Deleting images from server ...
IMAGE
sha256:bb21f3b2114a740a6c6322c8af0ec648174e6f2c800c8e09ec9f81f8ed209522




Will verify this when merge to OCP3.6

Comment 5 zhou ying 2017-05-09 10:01:15 UTC
Confirmed with the latest OCP, the issue has fixed:
[root@zhouy testjson]# oadm version
oadm v3.6.71
kubernetes v1.6.1+5115d708d7

openshift v3.6.69
kubernetes v1.6.1+5115d708d7

[root@zhouy testjson]# oadm prune images --keep-tag-revisions=1 --keep-younger-than=0m 
Dry run enabled - no modifications will be made. Add --confirm to remove images
Deleting references from image streams to images ...
STREAM       IMAGE                                                                     TAGS
zhouy/myis   sha256:936a332513e516c5954693b3be9d36919a14bc16fab6e28fa64d119d33ccb358   aaa

Deleting registry repository layer links ...
REPO         LAYER LINK
zhouy/myis   sha256:fd606f36d3fcb891f48f0c5e5cd4d0af104f0613843b8a57de2229bf40e16bb4
zhouy/myis   sha256:1161563e5af46bc2a75e9911d9cba0a3db5aa69d6da13fad975df9daf366cb60

Deleting registry layer blobs ...
BLOB
sha256:fd606f36d3fcb891f48f0c5e5cd4d0af104f0613843b8a57de2229bf40e16bb4
sha256:1161563e5af46bc2a75e9911d9cba0a3db5aa69d6da13fad975df9daf366cb60

Deleting registry repository manifest data ...
REPO         IMAGE
zhouy/myis   sha256:936a332513e516c5954693b3be9d36919a14bc16fab6e28fa64d119d33ccb358

Deleting images from server ...
IMAGE
sha256:936a332513e516c5954693b3be9d36919a14bc16fab6e28fa64d119d33ccb358
[root@zhouy testjson]# oc get is myis -o yaml 
.........
status:
  dockerImageRepository: 172.30.233.142:5000/zhouy/myis
  tags:
  - items:
    - created: 2017-05-09T09:47:00Z
      dockerImageReference: openshift/deployment-example@sha256:ea9135488f323060cb18ab3ec06286cd49e4b3a611fce1a6a442651ecf421f99
      generation: 8
      image: sha256:ea9135488f323060cb18ab3ec06286cd49e4b3a611fce1a6a442651ecf421f99
    - created: 2017-05-09T09:45:42Z
      dockerImageReference: openshift/hello-openshift@sha256:936a332513e516c5954693b3be9d36919a14bc16fab6e28fa64d119d33ccb358
      generation: 6
      image: sha256:936a332513e516c5954693b3be9d36919a14bc16fab6e28fa64d119d33ccb358
    - created: 2017-05-09T09:43:45Z
      dockerImageReference: docker.io/busybox@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f
      generation: 2
      image: sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f
    tag: aaa
  - items:
    - created: 2017-05-09T09:44:37Z
      dockerImageReference: docker.io/busybox@sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f
      generation: 4
      image: sha256:32f093055929dbc23dec4d03e09dfe971f5973a9ca5cf059cbfb644c206aa83f
    tag: bbb

Comment 10 errata-xmlrpc 2017-11-28 21:53:29 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/RHSA-2017:3188


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