operator-framework / operator-registry

Operator Registry runs in a Kubernetes or OpenShift cluster to provide operator catalog data to Operator Lifecycle Manager.
Apache License 2.0
212 stars 248 forks source link

OPM index add and registry add with binary image option adds new layers with the index content #917

Open camilamacedo86 opened 2 years ago

camilamacedo86 commented 2 years ago

Adding bundles to an index using the --binary image option, new layers are added, increasing the size of the images exponentially. This only does not happen if the binary image does not have any layer with a database or an FBC catalog content. (this scenario is valid for FBC and SQL indexes formats).

Note that the layer added will have the new bundle. But the previous layer with the database or FBC content is not removed:

Screenshot 2022-02-09 at 15 41 50

Following the commands where this scenario can be faced.

For SQLite

opm index add --enable-alpha --generate --bundles <bundle> --binary-image  <binary-image> --from-index <index-mage>

For FBC

opm registry add --database <database> --enable-alpha --bundle-images <budlle> --overwrite-latest 
opm migrate <index.db> <path>
opm alpha generate dockerfile <path>. --binary-image <binnary-image>

How to reproduce:

camilamacedo86 commented 2 years ago

c/c @joelanford wdyt?

joelanford commented 2 years ago

@camilamacedo86 What image is being used for <binary-image> in these scenarios? I would expect that to be the base opm image that does not include any catalog content.

exdx commented 2 years ago

@camilamacedo86 is there any additional information for this issue?

camilamacedo86 commented 2 years ago

Hi @exdx,

We discuss this topic. The convoy is that the binary image field should not be used with existing/populated index images. It should just be the base opm image.

By default, that base image is the upstream quay.io/operator-framework/opm:latest image: https://github.com/operator-framework/operator-registry/blob/5566e4b6832a7fc08c12d3c79fc0a0b8c6a2e7aa/pkg/containertools/dockerfilegenerator.go#L11

See that:

So, it shows that what we could do here is just try to improve the help to clarifies it:

https://github.com/operator-framework/operator-registry/blob/5566e4b6832a7fc08c12d3c79fc0a0b8c6a2e7aa/cmd/opm/generate/cmd.go#L85