Bug 1762837

Summary: Image pruning fails if the image registry is removed
Product: OpenShift Container Platform Reporter: Adam Kaplan <adam.kaplan>
Component: ImageStreamsAssignee: Ricardo Maraschini <rmarasch>
Status: CLOSED ERRATA QA Contact: Mike Fiedler <mifiedle>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.1.zCC: aos-bugs, jokerman, mifiedle, rmarasch, wzheng, xiuwang
Target Milestone: ---Keywords: NeedsTestCase
Target Release: 4.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-04 11:14:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1790978    
Bug Blocks:    

Description Adam Kaplan 2019-10-17 15:40:27 UTC
Description of problem:
Image pruning fails if the image registry is removed.
There are cases where the image pruner should be run even if the image registry is removed from the cluster

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


How reproducible: Always


Steps to Reproduce:
1. Update the image registry operator's management state to `Removed`
2. Run the image pruner - `oc adm prune images -prune-registry=false`

Actual results:
Fails to run with error "unable to determine registry: ..."


Expected results:
Image pruner runs, even if registry is not installed on the cluster.


Additional info:
https://github.com/openshift/oc/blob/b6f4792b69cc6cb9d07f8ba88e73831c8a8fc470/pkg/cli/admin/prune/images/images.go#L430-L436

Comment 1 Adam Kaplan 2019-10-17 15:42:03 UTC
Blocks image pruning enhancement for 4.4 - https://github.com/openshift/enhancements/pull/49

Comment 3 Mike Fiedler 2020-01-31 19:58:35 UTC
Verified on 4.4.0-0.nightly-2020-01-31-115654.   Image pruner still runs when registry managedState is set to Removed:

# oc adm prune images --prune-registry=false                                                                                                                                                                         
Dry run enabled - no modifications will be made. Add --confirm to remove images                                                                                                                                                               
Only API objects will be removed.  No modifications to the image registry will be made.                                                                                                                                                       
Updating istags svt-99/cakephp-mysql-example: latest                                                                                                                                                                                          
Updating istags svt-57/cakephp-mysql-example: latest                                                                                                                                                                                          
Updating istags svt-34/cakephp-mysql-example: latest                                                                                                                                                                                          
Updating istags svt-83/cakephp-mysql-example: latest                                                                                                                                                                                          
Updating istags svt-60/cakephp-mysql-example: latest          

<snip>

Deleting image sha256:f56623d2766c4df4050324628ebe8afdce36ce709c9ec9d32b41f6dea0dd1c7f
Deleting image sha256:2544c64180aa7097d98e5b15d6f517526e8bbcaedf51ed8abbbb5318cbf397fd
Deleting image sha256:213b61598dda27836275b0202268eaf1bdbb808b46987b6400b55185a5fea62d
Deleting image sha256:c8df86340451404dfa4ecdd4e7019aaa742b63f1f6d2ab41c0bdc5f5a53263d6
Deleting image sha256:80c53990e909da38963c4f3f4bdbab94bb00d42826869868fc380dae68350d7d
Deleted 132 objects.

Comment 5 errata-xmlrpc 2020-05-04 11:14:34 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:0581