Bug 1983673 - opm may prune bundles from the input
Summary: opm may prune bundles from the input
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.9
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.9.0
Assignee: Ankita Thomas
QA Contact: xzha
URL:
Whiteboard:
: 1982311 (view as bug list)
Depends On:
Blocks: 1996162
TreeView+ depends on / blocked
 
Reported: 2021-07-19 13:13 UTC by Evan Cordell
Modified: 2021-10-18 17:40 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: opm chooses highest semver as channel head, adding edges by following replaces chain back from the head Consequence: A lower semver bundle replacing channel head never gets added to graph Fix: Warn on pruning of any bundle during add Result: Pruning can be caught early and fixed by changing semver/skips/replaces for the pruned bundle
Clone Of:
: 2009083 (view as bug list)
Environment:
Last Closed: 2021-10-18 17:39:54 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift operator-framework-olm pull 160 0 None None None 2021-08-09 17:25:16 UTC
Red Hat Product Errata RHSA-2021:3759 0 None None None 2021-10-18 17:40:15 UTC

Description Evan Cordell 2021-07-19 13:13:52 UTC
Description of problem:

It's possible to run `opm index add --bundles <bundle> --from-index <index>` and have it succeed with no errors, but not contain <bundle> at all.

This happens when:

- the bundle being added "replaces" the current head of a channel
- but the current head of the channel has a higher semver version than the bundle being added

Rather than walk back channel head heuristics, opm should just throw an error if bundles in the input are not included in the final graph. That should at least make this case detectable so that it can be corrected early in a release cycle.

Comment 2 John Francini 2021-07-19 18:40:13 UTC
This situation already causes problems for ISV bundles. One partner has the following situation:

Current head of channel: 4.0.5003
Intended replacement: 4.0.6, with "replaces" clause to supercede 4.0.5003.

Result: 4.0.6 is "submarined" and is not available to the OLM for upgrading.

Intended result by the partner: 4.0.6 would be the head of the channel. 

Rather than throwing an error, wouldn't it make more sense to ensure that the 'replaces' clause wins out over what semantic versioning would otherwise select as the head?

Comment 3 John Francini 2021-07-19 20:42:08 UTC
(In reply to John Francini from comment #2)
After discussing this issue with Brian Cook, I withdraw my suggestion in Comment #2.

Comment 4 Ankita Thomas 2021-08-05 13:35:38 UTC
*** Bug 1982311 has been marked as a duplicate of this bug. ***

Comment 6 xzha 2021-08-16 09:27:23 UTC
verify:

zhaoxia@xzha-mac ditto-operator % opm version
Version: version.Version{OpmVersion:"edcddea0f", GitCommit:"edcddea0f2b6344bc388b746078d6ae81dfbf1f8", BuildDate:"2021-08-16T06:57:47Z", GoOs:"darwin", GoArch:"amd64"}

1) check index image  quay.io/olmqe/ditto-index:1983673-1
zhaoxia@xzha-mac ditto-operator % opm alpha list channels quay.io/olmqe/ditto-index:1983673-1
PACKAGE         CHANNEL  HEAD
ditto-operator  alpha    ditto-operator.v0.2.0
zhaoxia@xzha-mac ditto-operator % opm alpha list bundles quay.io/olmqe/ditto-index:1983673-1
PACKAGE         CHANNEL  BUNDLE                 REPLACES               SKIPS  SKIP RANGE  IMAGE
ditto-operator  alpha    ditto-operator.v0.1.1                                            quay.io/olmqe/ditto-operator:1983673-0.1.1
ditto-operator  alpha    ditto-operator.v0.2.0  ditto-operator.v0.1.1                     quay.io/olmqe/ditto-operator:1983673-0.2.0

2) add quay.io/olmqe/ditto-operator:1983673-0.1.2 to quay.io/olmqe/ditto-index:1983673-1
zhaoxia@xzha-mac ditto-operator % opm render quay.io/olmqe/ditto-operator:1983673-0.1.2 -o json
{
    "schema": "olm.bundle",
    "name": "ditto-operator.v0.1.2",
    "package": "ditto-operator",
    "image": "quay.io/olmqe/ditto-operator:1983673-0.1.2",
    "properties": [
        {
            "type": "olm.channel",
            "value": {
                "name": "alpha",
                "replaces": "ditto-operator.v0.2.0"
            }
        },
        {
            "type": "olm.gvk",
            "value": {
                "group": "iot.eclipse.org",
                "kind": "Ditto",
                "version": "v1alpha1"
            }
        },
        {
            "type": "olm.package",
            "value": {
                "packageName": "ditto-operator",
                "version": "0.1.2"
            }
        }
    ]
}

zhaoxia@xzha-mac ditto-operator % opm index add -b quay.io/olmqe/ditto-operator:1983673-0.1.2 -f quay.io/olmqe/ditto-index:1983673-1 -t quay.io/olmqe/ditto-index:1983673-2 -c docker
INFO[0000] building the index                            bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0000] Pulling previous image quay.io/olmqe/ditto-index:1983673-1 to get metadata  bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0000] running /usr/local/bin/docker pull quay.io/olmqe/ditto-index:1983673-1  bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0003] running /usr/local/bin/docker pull quay.io/olmqe/ditto-index:1983673-1  bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0007] Getting label data from previous image        bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0007] running docker inspect                        bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0008] running docker create                         bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0008] running docker cp                             bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0009] running docker rm                             bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0010] running /usr/local/bin/docker pull quay.io/olmqe/ditto-operator:1983673-0.1.2  bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0015] running docker create                         bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0015] running docker cp                             bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0015] running docker rm                             bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0015] Could not find optional dependencies file     file=bundle_tmp453545669/metadata load=annotations with=bundle_tmp453545669
INFO[0015] Could not find optional properties file       file=bundle_tmp453545669/metadata load=annotations with=bundle_tmp453545669
INFO[0015] Could not find optional dependencies file     file=bundle_tmp453545669/metadata load=annotations with=bundle_tmp453545669
INFO[0015] Could not find optional properties file       file=bundle_tmp453545669/metadata load=annotations with=bundle_tmp453545669
ERRO[0015] permissive mode disabled                      bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.2]" error="added bundle quay.io/olmqe/ditto-operator:1983673-0.1.2 pruned from package ditto-operator, channel alpha: this may be due to incorrect channel head (ditto-operator.v0.2.0)"
Error: added bundle quay.io/olmqe/ditto-operator:1983673-0.1.2 pruned from package ditto-operator, channel alpha: this may be due to incorrect channel head (ditto-operator.v0.2.0)
Usage:
  opm index add [flags]

Examples:
  # Create an index image from scratch with a single bundle image
  opm index add --bundles quay.io/operator-framework/operator-bundle-prometheus@sha256:a3ee653ffa8a0d2bbb2fabb150a94da6e878b6e9eb07defd40dc884effde11a0 --tag quay.io/operator-framework/monitoring:1.0.0
  
  # Add a single bundle image to an index image
  opm index add --bundles quay.io/operator-framework/operator-bundle-prometheus:0.15.0 --from-index quay.io/operator-framework/monitoring:1.0.0 --tag quay.io/operator-framework/monitoring:1.0.1
  
  # Add multiple bundles to an index and generate a Dockerfile instead of an image
  opm index add --bundles quay.io/operator-framework/operator-bundle-prometheus:0.15.0,quay.io/operator-framework/operator-bundle-prometheus:0.22.2 --generate

Flags:
  -i, --binary-image opm        container image for on-image opm command
  -u, --build-tool string       tool to build container images. One of: [docker, podman]. Defaults to podman. Overrides part of container-tool.
  -b, --bundles strings         comma separated list of bundles to add
  -c, --container-tool string   tool to interact with container images (save, build, etc.). One of: [docker, podman]
  -f, --from-index string       previous index to add to
      --generate                if enabled, just creates the dockerfile and saves it to local disk
  -h, --help                    help for add
      --mode string             graph update mode that defines how channel graphs are updated. One of: [replaces, semver, semver-skippatch] (default "replaces")
  -d, --out-dockerfile string   if generating the dockerfile, this flag is used to (optionally) specify a dockerfile name
      --permissive              allow registry load errors
  -p, --pull-tool string        tool to pull container images. One of: [none, docker, podman]. Defaults to none. Overrides part of container-tool.
  -t, --tag string              custom tag for container image being built

Global Flags:
      --skip-tls   skip TLS certificate verification for container image registries while pulling bundles or index



zhaoxia@xzha-mac ditto-operator % opm index add -b quay.io/olmqe/ditto-operator:1983673-0.1.1,quay.io/olmqe/ditto-operator:1983673-0.2.0,quay.io/olmqe/ditto-operator:1983673-0.1.2 -t quay.io/olmqe/ditto-index:1983673-1 -c docker
INFO[0000] building the index                            bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0000] running /usr/local/bin/docker pull quay.io/olmqe/ditto-operator:1983673-0.1.1  bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0007] running docker create                         bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0007] running docker cp                             bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0007] running docker rm                             bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0008] running /usr/local/bin/docker pull quay.io/olmqe/ditto-operator:1983673-0.2.0  bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0015] running docker create                         bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0015] running docker cp                             bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0016] running docker rm                             bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0016] running /usr/local/bin/docker pull quay.io/olmqe/ditto-operator:1983673-0.1.2  bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0023] running docker create                         bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0023] running docker cp                             bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0024] running docker rm                             bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]"
INFO[0024] Could not find optional dependencies file     file=bundle_tmp846457054/metadata load=annotations with=bundle_tmp846457054
INFO[0024] Could not find optional properties file       file=bundle_tmp846457054/metadata load=annotations with=bundle_tmp846457054
INFO[0024] Could not find optional dependencies file     file=bundle_tmp806139340/metadata load=annotations with=bundle_tmp806139340
INFO[0024] Could not find optional properties file       file=bundle_tmp806139340/metadata load=annotations with=bundle_tmp806139340
INFO[0024] Could not find optional dependencies file     file=bundle_tmp121234107/metadata load=annotations with=bundle_tmp121234107
INFO[0024] Could not find optional properties file       file=bundle_tmp121234107/metadata load=annotations with=bundle_tmp121234107
INFO[0024] Could not find optional dependencies file     file=bundle_tmp806139340/metadata load=annotations with=bundle_tmp806139340
INFO[0024] Could not find optional properties file       file=bundle_tmp806139340/metadata load=annotations with=bundle_tmp806139340
INFO[0024] Could not find optional dependencies file     file=bundle_tmp121234107/metadata load=annotations with=bundle_tmp121234107
INFO[0024] Could not find optional properties file       file=bundle_tmp121234107/metadata load=annotations with=bundle_tmp121234107
INFO[0024] Could not find optional dependencies file     file=bundle_tmp846457054/metadata load=annotations with=bundle_tmp846457054
INFO[0024] Could not find optional properties file       file=bundle_tmp846457054/metadata load=annotations with=bundle_tmp846457054
ERRO[0024] permissive mode disabled                      bundles="[quay.io/olmqe/ditto-operator:1983673-0.1.1 quay.io/olmqe/ditto-operator:1983673-0.2.0 quay.io/olmqe/ditto-operator:1983673-0.1.2]" error="added bundle quay.io/olmqe/ditto-operator:1983673-0.1.2 pruned from package ditto-operator, channel alpha: this may be due to incorrect channel head (ditto-operator.v0.2.0)"
Error: added bundle quay.io/olmqe/ditto-operator:1983673-0.1.2 pruned from package ditto-operator, channel alpha: this may be due to incorrect channel head (ditto-operator.v0.2.0)
Usage:
  opm index add [flags]
....


LGTM, verified.

Comment 9 errata-xmlrpc 2021-10-18 17:39:54 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.