Bug 1989431 - fail to "opm alpha diff" bundle image with heads-only mode.
Summary: fail to "opm alpha diff" bundle image with heads-only mode.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.9
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: ---
: 4.9.0
Assignee: Eric Stroczynski
QA Contact: kuiwang
URL: https://github.com/openshift/operator...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-08-03 08:19 UTC by kuiwang
Modified: 2021-10-18 17:44 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-10-18 17:44:09 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift operator-framework-olm pull 164 0 None None None 2021-08-11 20:39:11 UTC
Red Hat Product Errata RHSA-2021:3759 0 None None None 2021-10-18 17:44:18 UTC

Description kuiwang 2021-08-03 08:19:27 UTC
Description of problem:
When I try to "opm diff <bundle image>", I meet error 
"error converting new declarative config to model: unknown package"

if bundle image is not supported for "opm diff", need to provide the clear error information, like "it is bundle image which is not supported".
if bundle image is supported for "opm diff", please resolve the issue.

Thanks

Version-Release number of selected component (if applicable):
[root@preserve-olm-env OSDK-1869]# opm version
Version: version.Version{OpmVersion:"cf7140bf3", GitCommit:"cf7140bf3c404454892c9c972b0d9e839a46f619", BuildDate:"2021-08-02T05:12:33Z", GoOs:"linux", GoArch:"amd64"}


How reproducible:
Always

Steps to Reproduce:
1, make bundle image
[root@preserve-olm-env OSDK-1869]# rm -fr bundle.Dockerfile mta-operator/0.0.4/metadata/annotations.yaml
[root@preserve-olm-env OSDK-1869]# opm alpha bundle build -d mta-operator/0.0.4/manifests -t quay.io/olmqe/mta-operator:v0.0.4-1869 -p mta-operator -c alpha -e alpha
INFO[0000] Building annotations.yaml                    
INFO[0000] Writing annotations.yaml in /data/kuiwang/cases/OSDK-1869/mta-operator/0.0.4/metadata 
INFO[0000] Building Dockerfile                          
INFO[0000] Writing bundle.Dockerfile in /data/kuiwang/cases/OSDK-1869 
INFO[0000] Building bundle image                        
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
STEP 1: FROM scratch
STEP 2: LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
--> cc0a097dd78
STEP 3: LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
--> 2b63bb1f72a
STEP 4: LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
--> c5e6ebd173a
STEP 5: LABEL operators.operatorframework.io.bundle.package.v1=mta-operator
--> e0c4c704c4c
STEP 6: LABEL operators.operatorframework.io.bundle.channels.v1=alpha
--> 29b46a92be0
STEP 7: LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
--> 1acb54fb7db
STEP 8: COPY mta-operator/0.0.4/manifests /manifests/
--> 4bfbffeb2e6
STEP 9: COPY mta-operator/0.0.4/metadata /metadata/
STEP 10: COMMIT quay.io/olmqe/mta-operator:v0.0.4-1869
--> f3a203937ea
f3a203937ea3f8754e43c1ee9c822cfbae0a61542595948c86201a3b4c25056a
[root@preserve-olm-env OSDK-1869]# rm -fr bundle.Dockerfile mta-operator/0.0.4/metadata/annotations.yaml
[root@preserve-olm-env OSDK-1869]# podman push quay.io/olmqe/mta-operator:v0.0.4-1869
Getting image source signatures
Copying blob d2125c96921a done  
Copying blob cac0212e67d6 done  
Copying config f3a203937e done  
Writing manifest to image destination
Copying config f3a203937e [======================================] 2.1KiB / 2.1KiB
Writing manifest to image destination
Storing signatures


2, opm render the bundle image
[root@preserve-olm-env OSDK-1869]# opm render quay.io/olmqe/mta-operator:v0.0.4-1869
{
    "schema": "olm.bundle",
    "name": "windup-operator.0.0.4",
    "package": "mta-operator",
    "image": "quay.io/olmqe/mta-operator:v0.0.4-1869",
    "properties": [
        {
            "type": "olm.channel",
            "value": {
                "name": "alpha",
                "replaces": "windup-operator.0.0.3"
            }
        },
        {
            "type": "olm.gvk",
            "value": {
                "group": "windup.jboss.org",
                "kind": "Windup",
                "version": "v1"
            }
        },
        {
            "type": "olm.package",
            "value": {
                "packageName": "mta-operator",
                "version": "0.0.4"
            }
        }
    ]
}

3, opm diff the bundle image. fail
[root@preserve-olm-env OSDK-1869]# opm alpha diff quay.io/olmqe/mta-operator:v0.0.4-1869
WARN[0000] {"created":"2021-08-03T07:46:53.797796689Z","architecture":"amd64","os":"linux","config":{"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Labels":{"io.buildah.version":"1.19.8","operators.operatorframework.io.bundle.channel.default.v1":"alpha","operators.operatorframework.io.bundle.channels.v1":"alpha","operators.operatorframework.io.bundle.manifests.v1":"manifests/","operators.operatorframework.io.bundle.mediatype.v1":"registry+v1","operators.operatorframework.io.bundle.metadata.v1":"metadata/","operators.operatorframework.io.bundle.package.v1":"mta-operator"}},"rootfs":{"type":"layers","diff_ids":["sha256:d2125c96921a06554fcfe2581bbf47e13623d7f9b47acffde47381e9d75c797a","sha256:cac0212e67d626f6ce748c98c66fa3a2f5dc496863bbdf585f26ab8516cd1d3d"]},"history":[{"created":"2021-08-03T07:46:52.377960891Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1","empty_layer":true},{"created":"2021-08-03T07:46:52.461942074Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/","empty_layer":true},{"created":"2021-08-03T07:46:52.539197933Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/","empty_layer":true},{"created":"2021-08-03T07:46:52.62782331Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.package.v1=mta-operator","empty_layer":true},{"created":"2021-08-03T07:46:52.73077109Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.channels.v1=alpha","empty_layer":true},{"created":"2021-08-03T07:46:52.815621191Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha","empty_layer":true},{"created":"2021-08-03T07:46:53.217563306Z","created_by":"/bin/sh -c #(nop) COPY dir:9003ed531bdd32eb0e9098e6fc15d2f7f2fb7f530bb7bd2d0ab94d5708645c37 in /manifests/ "},{"created":"2021-08-03T07:46:54.000234819Z","created_by":"/bin/sh -c #(nop) COPY dir:f9b0beecbfe5f0cd1842a4f6f21e50039514e650c59c23e182ee5bfcfb404042 in /metadata/ "}]} 
INFO[0000] Could not find optional dependencies file     file=/tmp/render-unpack-312628132/metadata load=annotations with=/tmp/render-unpack-312628132
INFO[0000] Could not find optional properties file       file=/tmp/render-unpack-312628132/metadata load=annotations with=/tmp/render-unpack-312628132
FATA[0000] error generating diff: error converting new declarative config to model: unknown package "mta-operator" for bundle "windup-operator.0.0.4" 


Actual results:


Expected results:


Additional info:

Comment 1 Ankita Thomas 2021-08-03 18:19:47 UTC
the command help text already states that diff is meant to compare two catalog refs, not bundle refs.

./bin/opm alpha diff --help
Diff a set of old and new catalog references ("refs") to produce a declarative config containing only packages channels, and versions not present in the old set.

Comment 2 kuiwang 2021-08-04 01:13:38 UTC
Based on the comments with @estroczy in https://issues.redhat.com/browse/OSDK-1869, bundle image should be supported.
If finally it is not supported, I think we need to provide the clear error message as mentioned in the "Description of problem"

Thanks

Comment 4 Eric Stroczynski 2021-08-05 01:13:30 UTC
If I said it should be supported, my opinion has changed; bundles should not be supported directly. From https://github.com/operator-framework/operator-registry/pull/741:

>diff is really intended for indices. There's no way to infer which channel is the default for a package if more than one bundle in the same package is passed to diff either, so we could get non-deterministic behavior unless diff imposes some ordering on channels. Assuming icon doesn't exist (or other future olm.package fields) for a package may cause issues when using the diff'ed catalog in-cluster too.

Comment 5 kuiwang 2021-08-05 02:57:59 UTC
@estroczy, thanks to clarify it.

Now https://github.com/operator-framework/operator-registry/pull/741 is in upstream and not merged.
Please make it merged in downstream, and I will verify it. 
Thanks

Comment 6 kuiwang 2021-08-10 00:51:25 UTC
We need to the fix on downstream and then verify it.
Now the fix is not on downstream, so change it back to Assigned.

Comment 8 kuiwang 2021-08-19 06:42:24 UTC
verified with pass. LGTM
---
[root@preserve-olm-env OSDK-1869]# opm version
Version: version.Version{OpmVersion:"5bd4cad68", GitCommit:"5bd4cad6847aa9b0c0823e3dda553e8ee57eb3ae", BuildDate:"2021-08-19T06:30:22Z", GoOs:"linux", GoArch:"amd64"}
[root@preserve-olm-env OSDK-1869]# opm alpha diff quay.io/olmqe/mta-operator:v0.0.4-1869
WARN[0000] {"created":"2021-08-03T07:46:53.797796689Z","architecture":"amd64","os":"linux","config":{"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Labels":{"io.buildah.version":"1.19.8","operators.operatorframework.io.bundle.channel.default.v1":"alpha","operators.operatorframework.io.bundle.channels.v1":"alpha","operators.operatorframework.io.bundle.manifests.v1":"manifests/","operators.operatorframework.io.bundle.mediatype.v1":"registry+v1","operators.operatorframework.io.bundle.metadata.v1":"metadata/","operators.operatorframework.io.bundle.package.v1":"mta-operator"}},"rootfs":{"type":"layers","diff_ids":["sha256:d2125c96921a06554fcfe2581bbf47e13623d7f9b47acffde47381e9d75c797a","sha256:cac0212e67d626f6ce748c98c66fa3a2f5dc496863bbdf585f26ab8516cd1d3d"]},"history":[{"created":"2021-08-03T07:46:52.377960891Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1","empty_layer":true},{"created":"2021-08-03T07:46:52.461942074Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/","empty_layer":true},{"created":"2021-08-03T07:46:52.539197933Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/","empty_layer":true},{"created":"2021-08-03T07:46:52.62782331Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.package.v1=mta-operator","empty_layer":true},{"created":"2021-08-03T07:46:52.73077109Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.channels.v1=alpha","empty_layer":true},{"created":"2021-08-03T07:46:52.815621191Z","created_by":"/bin/sh -c #(nop) LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha","empty_layer":true},{"created":"2021-08-03T07:46:53.217563306Z","created_by":"/bin/sh -c #(nop) COPY dir:9003ed531bdd32eb0e9098e6fc15d2f7f2fb7f530bb7bd2d0ab94d5708645c37 in /manifests/ "},{"created":"2021-08-03T07:46:54.000234819Z","created_by":"/bin/sh -c #(nop) COPY dir:f9b0beecbfe5f0cd1842a4f6f21e50039514e650c59c23e182ee5bfcfb404042 in /metadata/ "}]} 
FATA[0000] error generating diff: render reference "quay.io/olmqe/mta-operator:v0.0.4-1869": cannot render bundle image: not allowed (diff does not permit direct bundle references) 
[root@preserve-olm-env OSDK-1869]# 

---

Comment 11 errata-xmlrpc 2021-10-18 17:44:09 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 (Moderate: OpenShift Container Platform 4.9.0 bug fix and security update), 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-2021:3759


Note You need to log in before you can comment on or make changes to this bug.