Description of problem: Want to delete imagestreamimage reference within the imagestream without deleting the whole tag. oc describe is Name: php Created: 6 days ago Labels: <none> Annotations: openshift.io/image.dockerRepositoryCheck=2016-09-26T15:13:35Z Docker Pull Spec: 172.30.31.70:5000/default/php Tag Spec Created PullSpec Image 5.6 php:5.6 About a minute ago php@sha256:0a80a0ae5d2993... <same> 6 days ago php@sha256:4780a083d4c44d... <same> . . . =========================================== GOAL: delete the image from "6 days ago", php@sha256:4780a083d4c44d... └──> oc get imagestreamimages php@sha256:47 NAME DOCKER REF UPDATED IMAGENAME php@4780a08 php@sha256:4780a083d4c44da7db6bb6a850c81d05eb1fdb953deb05dbc6a80b0d7a901851 292 years ago sha256:4780a083d4c44da7db6bb6a850c81d05eb1fdb953deb05dbc6a80b0d7a901851 └──> oc get imagestreamimages php@4780a08 NAME DOCKER REF UPDATED IMAGENAME php@4780a08 php@sha256:4780a083d4c44da7db6bb6a850c81d05eb1fdb953deb05dbc6a80b0d7a901851 292 years ago sha256:4780a083d4c44da7db6bb6a850c81d05eb1fdb953deb05dbc6a80b0d7a901851 (both references work) └──> oc delete imagestreamimages php@sha256:4780a083d4c44da7db6bb6a850c81d05eb1fdb953deb05dbc6a80b0d7a901851 Error from server: the server does not allow this method on the requested resource Deleting imagestreamimage does not work, but: └──> oc delete image sha256:4780a083d4c44da7db6bb6a850c81d05eb1fdb953deb05dbc6a80b0d7a901851 image "sha256:4780a083d4c44da7db6bb6a850c81d05eb1fdb953deb05dbc6a80b0d7a901851" deleted Does. Additionally, after doing so, we can no longer get the imagestreamimage: └──> oc get imagestreamimages php@4780a08 Error from server: images "sha256:4780a083d4c44da7db6bb6a850c81d05eb1fdb953deb05dbc6a80b0d7a901851" not found Yet, the imagestreamimage still shows up in the imagestream: └──> oc describe is Name: php . . . Tag Spec Created PullSpec Image 5.6 <pushed> 7 minutes ago php@sha256:0a80a0ae5d2993... <same> 6 days ago php@sha256:4780a083d4c44d... <same> Version-Release number of selected component (if applicable): OSE 3.2.0 How reproducible: Reproduced reliably Additional info: Possibly an RFE if this was intended behavior to begin with
As marked by mfojtik, this is RFE, since only ImageStream is an actual image and we store all the information about ImageStreamImages and ImageStreamTags inside it. That means the two latter are virtual objects (iow. not stored in etcd). To fix the current state pruning images should help, since it checks if the connections are still valid and updates them accordingly.
This will be addressed by https://github.com/openshift/origin/pull/16821
to be clear, with the above PR it will still be necessary to 1) oc delete the image 2) run oc adm prune to clean up the references. (that is, deleting the image alone will not immediately remove the reference to the image from the imagestreamtag) But that is an improvement over the current behavior in which pruning will not remove the reference.
The PR has been merged.
Verified # oc version oc v3.7.0-0.189.0 kubernetes v1.7.6+a08f5eeb62 features: Basic-Auth GSSAPI Kerberos SPNEGO Server https:8443 openshift v3.7.0-0.189.0 kubernetes v1.7.6+a08f5eeb62 Reference 3 images to one imagestreamTag, delete 2 images # oc delete image sha256:6a448ad9ac44348523cd13fef635ed1ac220a7a0f95b2a5f200f2b42a910d1d6 sha256:c2e5ffc909fc598628caebe56571849cbcbeea6c99f885a9870cb8c5967d5111 prune image from imagestreamTag # oadm prune images --keep-tag-revisions=1 --keep-younger-than=0 --certificate-authority=ca.crt --registry-url=docker-registry-default.com --confirm Only one image references to imagestreamTag
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