Bug 1653518

Summary: Can't set samplesRegistry in openshift-samples samplesresource
Product: OpenShift Container Platform Reporter: XiuJuan Wang <xiuwang>
Component: ImageStreamsAssignee: Gabe Montero <gmontero>
Status: CLOSED ERRATA QA Contact: XiuJuan Wang <xiuwang>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.1.0CC: aos-bugs, gmontero, jokerman, mmccomas, wzheng
Target Milestone: ---   
Target Release: 4.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-04 10:41:04 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 XiuJuan Wang 2018-11-27 03:33:00 UTC
Description of problem:
samplesRegistry: $value field would disappear after a while when set in samplesresource. Then samplesresource still chooses default registry registry.dev.io for rhel installtype.

Version-Release number of selected component (if applicable):
brewregistry.stage.redhat.io/openshift/ose-cluster-samples-operator:latest (v4.0.0-0.66.0)

How reproducible:
always

Steps to Reproduce:
1.Delete initialed centos imagestreams and templates.
Edit the samplesresource to modify `managementState: Removed`
2.Make sure imagestreams and templates have been removed
3.Change installtype to rhel and set samplesRegistry
  installType: rhel
  logging:
    level: 0
    vmodule: ""
  managementState: Managed
  samplesRegistry: registry.dev.redhat.io
4.Check later

Actual results:

4.samplesRegistry disappeared after a while. And Registry uses registry.redhat.io

Expected results:
Should set samplesRegistry successfully

Additional info:

Comment 1 Gabe Montero 2018-11-27 20:17:10 UTC
figured it out ... the json tag in the api spec was wrong

when the fix is available, you have to be sure and use `samplesRegistry` ... where  it is `samples` and not `sample` ... in the yaml

Comment 3 XiuJuan Wang 2018-11-28 09:05:40 UTC
After set 'samplesRegistry: registry.redhat.io', would prompt an error "error processing content : ImageStream.image.openshift.io "apicast-gateway" is invalid: spec.dockerImageRepository: Invalid value: "registry.redhat.io/": invalid reference format"


time="2018-11-28T08:39:40Z" level=info msg="management state set to managed"
time="2018-11-28T08:39:40Z" level=info msg="ConfigMap for SamplesResource &v1.ConfigMap{TypeMeta:v1.TypeMeta{Kind:\"\", APIVersion:\"\"}, ObjectMeta:v1.ObjectMeta{Name:\"openshift-samples\", GenerateName:\"\", Namespace:\"openshift-cluster-samples-operator\", SelfLink:\"/api/v1/namespaces/openshift-cluster-samples-operator/configmaps/openshift-samples\", UID:\"975e2d47-f2e7-11e8-8d23-0e61da16e428\", ResourceVersion:\"10385\", Generation:0, CreationTimestamp:v1.Time{Time:time.Time{wall:0x0, ext:63678990512, loc:(*time.Location)(0x1a93f20)}}, DeletionTimestamp:(*v1.Time)(nil), DeletionGracePeriodSeconds:(*int64)(nil), Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference(nil), Initializers:(*v1.Initializers)(nil), Finalizers:[]string(nil), ClusterName:\"\"}, Data:map[string]string(nil), BinaryData:map[string][]uint8(nil)} found during operator startup"
time="2018-11-28T08:39:40Z" level=info msg="watch event sso72-mysql-persistent not part of operators inventory"
time="2018-11-28T08:39:40Z" level=info msg="Spec is valid because this operator has not processed a config yet"
time="2018-11-28T08:39:40Z" level=info msg="processing subdir 3scale from dir /opt/openshift/operator/ocp-x86_64"
time="2018-11-28T08:39:40Z" level=info msg="processing subdir imagestreams from dir /opt/openshift/operator/ocp-x86_64/3scale"
time="2018-11-28T08:39:40Z" level=info msg="processing file apicast-gateway.json from dir /opt/openshift/operator/ocp-x86_64/3scale/imagestreams"
time="2018-11-28T08:39:40Z" level=info msg="imagestream create error: ImageStream.image.openshift.io \"apicast-gateway\" is invalid: spec.dockerImageRepository: Invalid value: \"registry.redhat.io/\": invalid reference format"
time="2018-11-28T08:39:40Z" level=info msg="error processing content : ImageStream.image.openshift.io \"apicast-gateway\" is invalid: spec.dockerImageRepository: Invalid value: \"registry.redhat.io/\": invalid reference format"
time="2018-11-28T08:39:43Z" level=error msg="error syncing key (openshift-samples): ImageStream.image.openshift.io \"apicast-gateway\" is invalid: spec.dockerImageRepository: Invalid value: \"registry.redhat.io/\": invalid reference format"
time="2018-11-28T08:39:43Z" level=info msg="management state set to managed"


# oc rsh -n openshift-cluster-samples-operator cluster-samples-operator-6cbfcb5f68-d64wk 
sh-4.2$ cd  /opt/openshift/operator/ocp-x86_64/
3scale amq	 dancer    datavirt	   django  eap	   fis	  java	   mariadb  mysql  nodejs  php	       processserver  rails  rhdm   ruby  webserver
cakephp  datagrid  decisionserver  dotnet  eap-cd  httpd  jenkins  mongodb  nginx  perl    postgresql  python	      redis  rhpam  sso

sh-4.2$ cat  3scale/imagestreams/apicast-gateway.json 
http://pastebin.test.redhat.com/674857

And registry.redhat.io/3scale-amp22/apicast-gateway:$tag exist truely.

Comment 4 Gabe Montero 2018-11-28 17:14:53 UTC
For comment #3 this is another but I uncovered yesterday with applying the samplesRegistry incorrectly to ImageStreamTag and ImageStreamImage.  I have a commit ready for that but we have not merged it yet, as we are trying to get some other fixes merged first.  

I have opened https://bugzilla.redhat.com/show_bug.cgi?id=1654402 for this.  You'll need this fix minimally to try the rhel scneario.

However, you should be able to verify the fact that the sampleRegistry setting is not lost after making additional changes to the samples resource.  So moving this but to QA for that verification.

Comment 5 XiuJuan Wang 2018-11-29 02:13:57 UTC
Could set samplesRegistry field in the samplesresource  with ose-cluster-samples-operator:latest (v4.0.0-0.74.0)

Comment 8 errata-xmlrpc 2019-06-04 10:41:04 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-2019:0758