Bug 1822253

Summary: 'oc adm catalog mirror' generate a field.name in imagecontentsourcepolicy that can be invalid
Product: OpenShift Container Platform Reporter: Baptiste Mille-Mathias <baptiste.millemathias>
Component: OLMAssignee: Evan Cordell <ecordell>
OLM sub component: OLM QA Contact: Jian Zhang <jiazha>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: low CC: aos-bugs, jokerman, mfojtik
Version: 4.4   
Target Milestone: ---   
Target Release: 4.5.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-07-13 17:26:16 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 Baptiste Mille-Mathias 2020-04-08 15:08:47 UTC
Description of problem:

When you create the mirror of the artifacts of the catalog, the content of the field meta.name of the manifest file is based on the path of the source registry, including / which are invalid.


Version-Release number of selected component (if applicable):
[bmillemathias@fedoravm olm-restricted]$ oc version
Client Version: 4.4.0-rc.6
Server Version: 4.3.1
Kubernetes Version: v1.16.2


How reproducible:
100%

Steps to Reproduce:
1. oc adm catalog mirror registry:5000/bmillemathias/olm/redhat-operators:v202004071506 registry:5000/bmillemathias/olm/redhat-operators-build

Actual results:
file imagecontentsourcepolicy.yaml
---
kind: ImageContentSourcePolicy
metadata:
  name: olm/redhat-operators # name is invalid because of / character
...       ^^^

Expected results:
file imagecontentsourcepolicy.yaml
---
kind: ImageContentSourcePolicy
metadata:
  name: olm-redhat-operators
...       

Additional info:

Comment 1 Evan Cordell 2020-04-15 00:44:22 UTC
This was fixed as a side effect of https://github.com/openshift/oc/pull/384

Comment 4 Jian Zhang 2020-04-15 14:02:41 UTC
1, Get the oc client that contains the fixed PR.
[jzhang@dhcp-140-36 ~]$ ./oc version -o yaml
clientVersion:
  buildDate: "2020-04-14T13:10:25Z"
  compiler: gc
  gitCommit: 53a16c59e5a7e4657f6eb098b46a3cc8d593fa7e
  gitTreeState: dirty
  gitVersion: openshift-clients-4.5.0-202004141216
  goVersion: go1.13.4
  major: ""
  minor: ""
  platform: linux/amd64
releaseClientVersion: 4.5.0-0.nightly-2020-04-15-072621
serverVersion:
  buildDate: "2019-05-02T11:52:09Z"
  compiler: gc
  gitCommit: d4cacc0
  gitTreeState: clean
  gitVersion: v1.11.0+d4cacc0
  goVersion: go1.10.8
  major: "1"
  minor: 11+
  platform: linux/amd64

2, Create a CatalogSource image.
[jzhang@dhcp-140-36 ~]$ ./oc adm catalog build --appregistry-org=redhat-operators-art --auth-token="xxx" --to localhost:5000/olm/jiazha/art:v4
...

3, Mirror it.
[jzhang@dhcp-140-36 ~]$ ./oc adm catalog mirror localhost:5000/olm/jiazha/art:v4 localhost:5000/olm/jiazha/art-bug
wrote database to /tmp/122082851/bundles.db
...

4, Check the ICSP object.
[jzhang@dhcp-140-36 ~]$ vim jiazha/art-manifests/imageContentSourcePolicy.yaml 

apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
metadata:
  name: jiazha-art
spec:
  repositoryDigestMirrors:
  - mirrors:
    - localhost:5000/olm/jiazha-art-bug-openshift-ose-sriov-dp-admission-controller
    source: image-registry.openshift-image-registry.svc:5000/openshift/ose-sriov-dp-admission-controller@sha256:f467b0179e8c37eacdaa76e92af406261c384dc967e47bbfd588e773243d276a

As we can see, the image name is "localhost:5000/olm/jiazha-art-bug-openshift-ose-sriov-dp-admission-controller", replace the "/" with "-".
LGTM, verify it.

Comment 5 errata-xmlrpc 2020-07-13 17:26:16 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:2409