Bug 1613979

Summary: oc replace imagestream causes errors with syncing with the imagestream_controller.
Product: OpenShift Container Platform Reporter: Ryan Howe <rhowe>
Component: ImageStreamsAssignee: Ben Parees <bparees>
Status: CLOSED ERRATA QA Contact: XiuJuan Wang <xiuwang>
Severity: high Docs Contact:
Priority: high    
Version: 3.9.0CC: aos-bugs, bparees, cshereme, dapark, jokerman, maszulik, mmccomas, scott.c.worthington, xiuwang
Target Milestone: ---   
Target Release: 3.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: Improper handling of empty imagestream updates. Consequence: Previously updates to an imagestream that did not result in a change in tags resulted in a request to the image import api that included no content to be imported, which is invalid and lead to errors in the controller. Fix: Updates to the imagestream that result in no new/updated tags that need to be imported will not result in an import api call. Result: No invalid request is sent to the import api and no errors occur in the controller.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-11 07:24:08 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:

Description Ryan Howe 2018-08-08 17:02:11 UTC
Description of problem:

When running `oc replace` on imagestreams we get error: 
  

magestream_controller.go:127] Error syncing image stream "openshift/jenkins": ImageStreamImport "jenkins" is invalid: spec.images: Invalid value: "null": you must specify at least one image or a repository import

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

How reproducible:
100%

Steps to Reproduce:
1. Installer will create the imagestreams, or it can be done manually. 
oc create -f  /usr/share/ansible/openshift-ansible/roles/openshift_examples/files/examples/v3.9/image-streams/image-streams-rhel7.json -n openshift


2. oc replace -f  /usr/share/ansible/openshift-ansible/roles/openshift_examples/files/examples/v3.9/image-streams/image-streams-rhel7.json -n openshift



Actual results:

# journalctl -u atomic-openshift-master-controllers | grep imagestream_controller

Error logs on all replaced imagestreams:

 imagestream_controller.go:127] Error syncing image stream "openshift/jenkins": ImageStreamImport "jenkins" is invalid: spec.images: Invalid value: "null": you must specify at least one image or a repository import


Expected results:

For the replace to work and the controller to not error trying to import these. 


Additional info:

Error message is generated here:
https://github.com/openshift/origin/blob/master/pkg/image/controller/imagestream_controller.go#L133


Workaround to replace these involves deleting and adding back to update based on the latest examples. 

# oc create -f  /usr/share/ansible/openshift-ansible/roles/openshift_examples/files/examples/v3.9/image-streams/image-streams-rhel7.json -n openshift

# oc delete -f  /usr/share/ansible/openshift-ansible/roles/openshift_examples/files/examples/v3.9/image-streams/image-streams-rhel7.json -n openshift


The automated installer only runs `oc create` so we never hit this issue unless one run `oc replace`

Comment 1 Scott Worthington 2018-08-08 20:00:19 UTC
> Workaround to replace these involves deleting and adding back to update
> based on the latest examples. 
> 
> # oc create -f 
> /usr/share/ansible/openshift-ansible/roles/openshift_examples/files/examples/
> v3.9/image-streams/image-streams-rhel7.json -n openshift
> 
> # oc delete -f 
> /usr/share/ansible/openshift-ansible/roles/openshift_examples/files/examples/
> v3.9/image-streams/image-streams-rhel7.json -n openshift

> 
> The automated installer only runs `oc create` so we never hit this issue
> unless one run `oc replace`

Exchanging the order:

# oc delete -f 
/usr/share/ansible/openshift-ansible/roles/openshift_examples/files/examples/v3.9/image-streams/image-streams-rhel7.json -n openshift

# oc create -f 
/usr/share/ansible/openshift-ansible/roles/openshift_examples/files/examples/v3.9/image-streams/image-streams-rhel7.json -n openshift

Comment 2 Maciej Szulik 2018-08-13 10:08:25 UTC
I've checked the `oc replace` part, and this is not causing any problems. The images before and after `oc replace` are identical, so it's definitely a problem in the controller logic, which creates empty ImageStreamImports, which are then consumed by the controller which complains. I think we can safely ignore empty ISI.

Comment 3 Ben Parees 2018-08-13 17:45:22 UTC
https://github.com/openshift/origin/pull/20623

Comment 5 XiuJuan Wang 2018-08-23 08:55:35 UTC
Can't reproduce this bug with ocp v3.11.0-0.20.0

Comment 7 errata-xmlrpc 2018-10-11 07:24:08 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:2652