Bug 1827748 - Use opm to prune an operator catalog
Summary: Use opm to prune an operator catalog
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.5
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: 4.5.0
Assignee: Evan Cordell
QA Contact: Bruno Andrade
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-24 17:29 UTC by David Zager
Modified: 2020-07-13 17:31 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-07-13 17:31:30 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github operator-framework operator-registry pull 243 0 None closed bug 1827748: feature: opm (index|registry) prune command 2021-01-21 06:28:54 UTC
Red Hat Product Errata RHBA-2020:2409 0 None None None 2020-07-13 17:31:47 UTC

Description David Zager 2020-04-24 17:29:21 UTC
Description of problem:

Currently, it is possible to remove operators from an index. It should be possible to select operator packages to keep in an operator database (with `opm registry prune --packages "package1,package2"`) or an operator index (with `opm index prune --packages "package1,package2"`) such that all other operator packages are removed from the operator database (or index).

Comment 4 Bruno Andrade 2020-05-22 05:48:40 UTC
LGTM, marking as VERIFIED. Only marked with --packages parameter remains in the new image.

Operator Registry Commit Id:18b8ef337b35b480d91f5bc593019d0186ec25f0

$ opm index add --bundles quay.io/bandrade/lib-bucket-provisioner:1.0,quay.io/bandrade/etcd-olm-1643:16.0 --tag quay.io/bandrade/index:1.0 -u podman -p podman

$ opm index export -i quay.io/bandrade/index:1.0 -o etcd -c podman
INFO[0000] export from the index                         index="quay.io/bandrade/index:1.0" package=etcd
INFO[0000] Pulling previous image quay.io/bandrade/index:1.0 to get metadata  index="quay.io/bandrade/index:1.0" package=etcd
INFO[0000] running /usr/bin/podman pull quay.io/bandrade/index:1.0  index="quay.io/bandrade/index:1.0" package=etcd
INFO[0004] running /usr/bin/podman pull quay.io/bandrade/index:1.0  index="quay.io/bandrade/index:1.0" package=etcd
INFO[0008] Getting label data from previous image        index="quay.io/bandrade/index:1.0" package=etcd
INFO[0008] running podman inspect                        index="quay.io/bandrade/index:1.0" package=etcd
INFO[0008] running /usr/bin/podman pull quay.io/bandrade/index:1.0  index="quay.io/bandrade/index:1.0" package=etcd
INFO[0012] running podman save                           index="quay.io/bandrade/index:1.0" package=etcd
INFO[0014] Preparing to pull bundles ["quay.io/bandrade/etcd-olm-1643:16.0"]  index="quay.io/bandrade/index:1.0" package=etcd
INFO[0014] running /usr/bin/podman pull quay.io/bandrade/etcd-olm-1643:16.0  img="quay.io/bandrade/etcd-olm-1643:16.0"
INFO[0019] running /usr/bin/podman pull quay.io/bandrade/etcd-olm-1643:16.0  img="quay.io/bandrade/etcd-olm-1643:16.0"
INFO[0023] running podman save                           img="quay.io/bandrade/etcd-olm-1643:16.0"
$ tree downloaded/
downloaded/
├── 0.9.0
│   ├── etcdbackups.etcd.database.coreos.com.crd.yaml
│   ├── etcdclusters.etcd.database.coreos.com.crd.yaml
│   ├── etcdoperator.v0.9.0.clusterserviceversion.yaml
│   └── etcdrestores.etcd.database.coreos.com.crd.yaml
└── package.yaml

1 directory, 5 files

$ rm -rf downloaded/

$ opm index prune -f quay.io/bandrade/index:1.0 -p lib-bucket-provisioner -c podman
INFO[0000] pruning the index                             packages="[lib-bucket-provisioner]"
INFO[0000] Pulling previous image quay.io/bandrade/index:1.0 to get metadata  packages="[lib-bucket-provisioner]"
INFO[0000] running /usr/bin/podman pull quay.io/bandrade/index:1.0  packages="[lib-bucket-provisioner]"
INFO[0004] running /usr/bin/podman pull quay.io/bandrade/index:1.0  packages="[lib-bucket-provisioner]"
INFO[0008] Getting label data from previous image        packages="[lib-bucket-provisioner]"
INFO[0008] running podman inspect                        packages="[lib-bucket-provisioner]"
INFO[0009] running /usr/bin/podman pull quay.io/bandrade/index:1.0  packages="[lib-bucket-provisioner]"
INFO[0012] running podman save                           packages="[lib-bucket-provisioner]"
INFO[0014] deleting packages                             pkg=etcd
INFO[0014] input has been sanitized                      pkg=etcd
INFO[0014] packages: [etcd]                              pkg=etcd
INFO[0015] Generating dockerfile                         packages="[lib-bucket-provisioner]"
INFO[0015] writing dockerfile: index.Dockerfile899534339  packages="[lib-bucket-provisioner]"
INFO[0015] running podman build                          packages="[lib-bucket-provisioner]"
INFO[0015] [podman build -f index.Dockerfile899534339 -t operator-registry-index:latest .]  packages="[lib-bucket-provisioner]"

$ podman push quay.io/bandrade/index:2.0
Getting image source signatures
Copying blob a3ed95caeb02 skipped: already exists
Copying blob a3ed95caeb02 skipped: already exists
Copying blob a3ed95caeb02 skipped: already exists
Copying blob a3ed95caeb02 skipped: already exists
Copying blob 9e3f512ced9c skipped: already exists
Copying blob 5658e440f799 skipped: already exists
Copying blob d8a53ddb879b skipped: already exists
Copying blob 3e207b409db3 skipped: already exists
Copying blob a3ed95caeb02 skipped: already exists
Copying blob c942d5f76235 skipped: already exists
Writing manifest to image destination
Storing signatures

$ opm index export -i quay.io/bandrade/index:2.0 -o etcd -c podman
INFO[0000] export from the index                         index="quay.io/bandrade/index:2.0" package=etcd
INFO[0000] Pulling previous image quay.io/bandrade/index:2.0 to get metadata  index="quay.io/bandrade/index:2.0" package=etcd
INFO[0000] running /usr/bin/podman pull quay.io/bandrade/index:2.0  index="quay.io/bandrade/index:2.0" package=etcd
INFO[0004] running /usr/bin/podman pull quay.io/bandrade/index:2.0  index="quay.io/bandrade/index:2.0" package=etcd
INFO[0008] Getting label data from previous image        index="quay.io/bandrade/index:2.0" package=etcd
INFO[0008] running podman inspect                        index="quay.io/bandrade/index:2.0" package=etcd
INFO[0008] running /usr/bin/podman pull quay.io/bandrade/index:2.0  index="quay.io/bandrade/index:2.0" package=etcd
INFO[0012] running podman save                           index="quay.io/bandrade/index:2.0" package=etcd
INFO[0014] Preparing to pull bundles []                  index="quay.io/bandrade/index:2.0" package=etcd
[vagrant@localhost ~]$ tree downloaded/
downloaded/
└── package.yaml

Comment 5 errata-xmlrpc 2020-07-13 17:31:30 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


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