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).
https://github.com/operator-framework/operator-registry/pull/243
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
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