operator-registry icon indicating copy to clipboard operation
operator-registry copied to clipboard

Problem adding bundles after operator is removed when missing replaces

Open mvalahtv opened this issue 5 years ago • 7 comments
trafficstars

Creating index image from scratch

$ /tmp/operator-test/bin/opm index add -u docker --bundles quay.io/operator_testing/aqua-operator:v1.0.1,quay.io/operator_testing/aqua-operator:v1.0.2 --tag quay.io/operator_testing/upstream-community-operators-index:latest --skip-tls
INFO[0000] building the index                            bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0000] resolved name: quay.io/operator_testing/aqua-operator:v1.0.1 
INFO[0000] fetched                                       digest="sha256:10f7ada4950f9f74ec90ff957caa35812262c9e975aacc9dbca7e628539fd790"
INFO[0001] fetched                                       digest="sha256:da517556988c3a2fa29320c67d1bf39dce9f5d3b852f0f54f15e8ff212acddde"
INFO[0001] fetched                                       digest="sha256:13a1ead6c4fcdb26c3b17c0690f6c9a6562f0838d6c79cfd6ba172ef4526f362"
INFO[0001] fetched                                       digest="sha256:c1ff09bbf7538894c683457efab44e93e8e7b63751b4d5614695462df570f4b8"
INFO[0002] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:13a1ead6c4fcdb26c3b17c0690f6c9a6562f0838d6c79cfd6ba172ef4526f362 4445 [] map[] <nil>} 
INFO[0002] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:da517556988c3a2fa29320c67d1bf39dce9f5d3b852f0f54f15e8ff212acddde 286 [] map[] <nil>} 
INFO[0002] resolved name: quay.io/operator_testing/aqua-operator:v1.0.2 
INFO[0002] fetched                                       digest="sha256:4d55cffc64b67a1559c13d7fe91a7a19f1916d3bf7adbecb7be9e643e9bb992b"
INFO[0003] fetched                                       digest="sha256:3ae2a56f3a776da7bdc7024cb261eac22051bf64cb6d3ae64c891df64149904f"
INFO[0003] fetched                                       digest="sha256:463d9e36ed63bb06c9dc12e99ac8fd5cdfea7141ca25330b9529c4777707a4e8"
INFO[0003] fetched                                       digest="sha256:90ee98ac67f7c06971033742912252c8d0c0ef15aa64573c0106a83b6e39b40e"
INFO[0003] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:90ee98ac67f7c06971033742912252c8d0c0ef15aa64573c0106a83b6e39b40e 4446 [] map[] <nil>} 
INFO[0003] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:3ae2a56f3a776da7bdc7024cb261eac22051bf64cb6d3ae64c891df64149904f 286 [] map[] <nil>} 
INFO[0003] Could not find optional dependencies file     dir=bundle_tmp143155157 file=bundle_tmp143155157/metadata load=annotations
INFO[0003] found csv, loading bundle                     dir=bundle_tmp143155157 file=bundle_tmp143155157/manifests load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp143155157/manifests file=aqua-operator.v1.0.1.clusterserviceversion.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp143155157/manifests file=aquacsps.operator.aquasec.com.crd.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp143155157/manifests file=aquadatabases.operator.aquasec.com.crd.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp143155157/manifests file=aquaenforcers.operator.aquasec.com.crd.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp143155157/manifests file=aquagateways.operator.aquasec.com.crd.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp143155157/manifests file=aquascanners.operator.aquasec.com.crd.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp143155157/manifests file=aquaservers.operator.aquasec.com.crd.yaml load=bundle
INFO[0003] Could not find optional dependencies file     dir=bundle_tmp400528176 file=bundle_tmp400528176/metadata load=annotations
INFO[0003] found csv, loading bundle                     dir=bundle_tmp400528176 file=bundle_tmp400528176/manifests load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp400528176/manifests file=aqua-operator.v1.0.2.clusterserviceversion.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp400528176/manifests file=aquacsps.operator.aquasec.com.crd.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp400528176/manifests file=aquadatabases.operator.aquasec.com.crd.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp400528176/manifests file=aquaenforcers.operator.aquasec.com.crd.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp400528176/manifests file=aquagateways.operator.aquasec.com.crd.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp400528176/manifests file=aquascanners.operator.aquasec.com.crd.yaml load=bundle
INFO[0003] loading bundle file                           dir=bundle_tmp400528176/manifests file=aquaservers.operator.aquasec.com.crd.yaml load=bundle
INFO[0004] Generating dockerfile                         bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0004] writing dockerfile: index.Dockerfile052235371  bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0004] running docker build                          bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0004] [docker build -f index.Dockerfile052235371 -t quay.io/operator_testing/upstream-community-operators-index:latest .]  bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"

Pushing current index image

$ docker push quay.io/operator_testing/upstream-community-operators-index:latest
The push refers to repository [quay.io/operator_testing/upstream-community-operators-index]
8b08412eeea6: Pushed 
44c88d01ae53: Layer already exists 
486c2c489ca7: Layer already exists 
4150c4f2e6df: Layer already exists 
50644c29ef5a: Layer already exists 
latest: digest: sha256:ac51220dccbf84d490e956aa8d28e669847182a9a9d3520f6529876ad23d0183 size: 1370

Removing operator

$ /tmp/operator-test/bin/opm index rm  -c docker --operators aqua-operator --tag quay.io/operator_testing/upstream-community-operators-index:latest  --from-index quay.io/operator_testing/upstream-community-operators-index:latest
INFO[0000] building the index                            operators="[aqua-operator]"
INFO[0000] Pulling previous image quay.io/operator_testing/upstream-community-operators-index:latest to get metadata  operators="[aqua-operator]"
INFO[0000] running /usr/bin/docker pull quay.io/operator_testing/upstream-community-operators-index:latest  operators="[aqua-operator]"
INFO[0001] running /usr/bin/docker pull quay.io/operator_testing/upstream-community-operators-index:latest  operators="[aqua-operator]"
INFO[0003] Getting label data from previous image        operators="[aqua-operator]"
INFO[0003] running docker inspect                        operators="[aqua-operator]"
INFO[0003] running /usr/bin/docker pull quay.io/operator_testing/upstream-community-operators-index:latest  operators="[aqua-operator]"
INFO[0004] running docker save                           operators="[aqua-operator]"
INFO[0005] deleting packages                             pkg=aqua-operator
INFO[0005] input has been sanitized                      pkg=aqua-operator
INFO[0005] packages: [aqua-operator]                     pkg=aqua-operator
INFO[0005] Generating dockerfile                         operators="[aqua-operator]"
INFO[0005] writing dockerfile: index.Dockerfile198986098  operators="[aqua-operator]"
INFO[0005] running docker build                          operators="[aqua-operator]"
INFO[0005] [docker build -f index.Dockerfile198986098 -t quay.io/operator_testing/upstream-community-operators-index:latest .]  operators="[aqua-operator]"

Pushing current version of index image (without operator)

$ docker push quay.io/operator_testing/upstream-community-operators-index:latest
The push refers to repository [quay.io/operator_testing/upstream-community-operators-index]
a0a5c08d33ef: Pushed 
44c88d01ae53: Layer already exists 
486c2c489ca7: Layer already exists 
4150c4f2e6df: Layer already exists 
50644c29ef5a: Layer already exists 
latest: digest: sha256:c9c047a85a1034393987dba009dd5d2369642b6844a6ed4ef7ab416b45cb4133 size: 1370

Adding 2 bundles again will fail

$ /tmp/operator-test/bin/opm index add -u docker --bundles quay.io/operator_testing/aqua-operator:v1.0.1,quay.io/operator_testing/aqua-operator:v1.0.2 --tag quay.io/operator_testing/upstream-community-operators-index:latest --from-index quay.io/operator_testing/upstream-community-operators-index:latest --skip-tls
INFO[0000] building the index                            bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0000] Pulling previous image quay.io/operator_testing/upstream-community-operators-index:latest to get metadata  bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0000] resolved name: quay.io/operator_testing/upstream-community-operators-index:latest  bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0000] fetched                                       bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]" digest="sha256:c9c047a85a1034393987dba009dd5d2369642b6844a6ed4ef7ab416b45cb4133"
INFO[0000] fetched                                       bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]" digest="sha256:ebd71dd6a3cb2864a7738034793e3acb6f5bf44f09041b06ffee26fa5019dc93"
INFO[0000] fetched                                       bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]" digest="sha256:03260e9c3f626c4f2822688eda12971a44cd0bedeb21c194b5e22cd478db1126"
INFO[0000] fetched                                       bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]" digest="sha256:f6438b5ca3ee9fa2f192bd55bc8aba2e5919f76bc9644b0233dc36c508c77541"
INFO[0000] fetched                                       bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]" digest="sha256:df20fa9351a15782c64e6dddb2d4a6f50bf6d3688060a34c4014b0d9a752eb4c"
INFO[0000] fetched                                       bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]" digest="sha256:2bde5083bdaabc4b3cc87be42a03f13182c89a3bf8cec69fe648fa77ca46b7b9"
INFO[0000] fetched                                       bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]" digest="sha256:f0afe0609b2cff773639cb4442a523d1e077ce6b93d6c77167a35d507cf4b0d3"
WARN[0003] {"architecture":"amd64","config":{"Hostname":"","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":{"50051/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["registry","serve","--database","/database/index.db"],"Image":"sha256:c668683b6f7185a5cca1f8ed28a1d62da1c4e004249a450e58f58c25c8397e84","Volumes":null,"WorkingDir":"","Entrypoint":["/bin/opm"],"OnBuild":null,"Labels":{"operators.operatorframework.io.index.database.v1":"/database/index.db"}},"container":"06a41448941b8814f97a34548a446f4c73e877d5f0dc5e5e1344f51dec44d6d0","container_config":{"Hostname":"06a41448941b","Domainname":"","User":"","AttachStdin":false,"AttachStdout":false,"AttachStderr":false,"ExposedPorts":{"50051/tcp":{}},"Tty":false,"OpenStdin":false,"StdinOnce":false,"Env":["PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"],"Cmd":["/bin/sh","-c","#(nop) ","CMD [\"registry\" \"serve\" \"--database\" \"/database/index.db\"]"],"Image":"sha256:c668683b6f7185a5cca1f8ed28a1d62da1c4e004249a450e58f58c25c8397e84","Volumes":null,"WorkingDir":"","Entrypoint":["/bin/opm"],"OnBuild":null,"Labels":{"operators.operatorframework.io.index.database.v1":"/database/index.db"}},"created":"2020-06-22T19:57:26.372808622Z","docker_version":"19.03.11","history":[{"created":"2020-05-29T21:19:46.192045972Z","created_by":"/bin/sh -c #(nop) ADD file:c92c248239f8c7b9b3c067650954815f391b7bcb09023f984972c082ace2a8d0 in / "},{"created":"2020-05-29T21:19:46.363518345Z","created_by":"/bin/sh -c #(nop)  CMD [\"/bin/sh\"]","empty_layer":true},{"created":"2020-06-02T23:42:55.241252016Z","created_by":"/bin/sh -c apk update \u0026\u0026 apk add ca-certificates"},{"created":"2020-06-11T22:26:41.437527146Z","created_by":"/bin/sh -c #(nop) COPY file:3eb9a2fca35f36b8314cf861b32c1a5e20c39831e4928adfb81b029b1df08177 in /bin/opm "},{"created":"2020-06-11T22:26:41.685787322Z","created_by":"/bin/sh -c #(nop) COPY file:9501a4e82bb8fa49a1f5b0ba285f0b3f779adbb71346b968b1c4940041ff9c17 in /bin/grpc_health_probe "},{"created":"2020-06-22T11:37:00.051603676Z","created_by":"/bin/sh -c #(nop)  LABEL operators.operatorframework.io.index.database.v1=/database/index.db","empty_layer":true},{"created":"2020-06-22T19:57:22.094146834Z","created_by":"/bin/sh -c #(nop) ADD file:3c82c648bd810b7aaaca8bc7fed0b528c37551a647f9ab5b68ed9d98c7520e94 in /database/index.db "},{"created":"2020-06-22T19:57:25.794099165Z","created_by":"/bin/sh -c #(nop)  EXPOSE 50051","empty_layer":true},{"created":"2020-06-22T19:57:26.076834582Z","created_by":"/bin/sh -c #(nop)  ENTRYPOINT [\"/bin/opm\"]","empty_layer":true},{"created":"2020-06-22T19:57:26.372808622Z","created_by":"/bin/sh -c #(nop)  CMD [\"registry\" \"serve\" \"--database\" \"/database/index.db\"]","empty_layer":true}],"os":"linux","rootfs":{"type":"layers","diff_ids":["sha256:50644c29ef5a27c9a40c393a73ece2479de78325cae7d762ef3cdc19bf42dd0a","sha256:4150c4f2e6dfcb80618a9323b447f6feefcc3c44cdc811d910b0a04879a51e56","sha256:486c2c489ca776d9722f48aa2d48b560e3efb892a2b9d312116bb0051a1581ef","sha256:44c88d01ae5337e28d0ceae23b1ee27725f2a295774c24a35f1826764e7d88e2","sha256:a0a5c08d33efea9331a355cf0b58ee29b583b25e95266a273571df984a26ac94"]}}  bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0003] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:df20fa9351a15782c64e6dddb2d4a6f50bf6d3688060a34c4014b0d9a752eb4c 2797541 [] map[] <nil>}  bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0004] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:03260e9c3f626c4f2822688eda12971a44cd0bedeb21c194b5e22cd478db1126 2058239 [] map[] <nil>}  bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0004] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:2bde5083bdaabc4b3cc87be42a03f13182c89a3bf8cec69fe648fa77ca46b7b9 15523703 [] map[] <nil>}  bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0004] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:f0afe0609b2cff773639cb4442a523d1e077ce6b93d6c77167a35d507cf4b0d3 3405423 [] map[] <nil>}  bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0004] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:ebd71dd6a3cb2864a7738034793e3acb6f5bf44f09041b06ffee26fa5019dc93 9583 [] map[] <nil>}  bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]"
INFO[0005] resolved name: quay.io/operator_testing/aqua-operator:v1.0.1 
INFO[0005] fetched                                       digest="sha256:10f7ada4950f9f74ec90ff957caa35812262c9e975aacc9dbca7e628539fd790"
INFO[0005] fetched                                       digest="sha256:da517556988c3a2fa29320c67d1bf39dce9f5d3b852f0f54f15e8ff212acddde"
INFO[0005] fetched                                       digest="sha256:c1ff09bbf7538894c683457efab44e93e8e7b63751b4d5614695462df570f4b8"
INFO[0005] fetched                                       digest="sha256:13a1ead6c4fcdb26c3b17c0690f6c9a6562f0838d6c79cfd6ba172ef4526f362"
INFO[0006] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:13a1ead6c4fcdb26c3b17c0690f6c9a6562f0838d6c79cfd6ba172ef4526f362 4445 [] map[] <nil>} 
INFO[0006] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:da517556988c3a2fa29320c67d1bf39dce9f5d3b852f0f54f15e8ff212acddde 286 [] map[] <nil>} 
INFO[0007] resolved name: quay.io/operator_testing/aqua-operator:v1.0.2 
INFO[0007] fetched                                       digest="sha256:4d55cffc64b67a1559c13d7fe91a7a19f1916d3bf7adbecb7be9e643e9bb992b"
INFO[0007] fetched                                       digest="sha256:3ae2a56f3a776da7bdc7024cb261eac22051bf64cb6d3ae64c891df64149904f"
INFO[0007] fetched                                       digest="sha256:463d9e36ed63bb06c9dc12e99ac8fd5cdfea7141ca25330b9529c4777707a4e8"
INFO[0007] fetched                                       digest="sha256:90ee98ac67f7c06971033742912252c8d0c0ef15aa64573c0106a83b6e39b40e"
INFO[0008] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:90ee98ac67f7c06971033742912252c8d0c0ef15aa64573c0106a83b6e39b40e 4446 [] map[] <nil>} 
INFO[0008] unpacking layer: {application/vnd.docker.image.rootfs.diff.tar.gzip sha256:3ae2a56f3a776da7bdc7024cb261eac22051bf64cb6d3ae64c891df64149904f 286 [] map[] <nil>} 
INFO[0008] Could not find optional dependencies file     dir=bundle_tmp125757119 file=bundle_tmp125757119/metadata load=annotations
INFO[0008] found csv, loading bundle                     dir=bundle_tmp125757119 file=bundle_tmp125757119/manifests load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp125757119/manifests file=aqua-operator.v1.0.1.clusterserviceversion.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp125757119/manifests file=aquacsps.operator.aquasec.com.crd.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp125757119/manifests file=aquadatabases.operator.aquasec.com.crd.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp125757119/manifests file=aquaenforcers.operator.aquasec.com.crd.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp125757119/manifests file=aquagateways.operator.aquasec.com.crd.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp125757119/manifests file=aquascanners.operator.aquasec.com.crd.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp125757119/manifests file=aquaservers.operator.aquasec.com.crd.yaml load=bundle
INFO[0008] Could not find optional dependencies file     dir=bundle_tmp269837074 file=bundle_tmp269837074/metadata load=annotations
INFO[0008] found csv, loading bundle                     dir=bundle_tmp269837074 file=bundle_tmp269837074/manifests load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp269837074/manifests file=aqua-operator.v1.0.2.clusterserviceversion.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp269837074/manifests file=aquacsps.operator.aquasec.com.crd.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp269837074/manifests file=aquadatabases.operator.aquasec.com.crd.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp269837074/manifests file=aquaenforcers.operator.aquasec.com.crd.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp269837074/manifests file=aquagateways.operator.aquasec.com.crd.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp269837074/manifests file=aquascanners.operator.aquasec.com.crd.yaml load=bundle
INFO[0008] loading bundle file                           dir=bundle_tmp269837074/manifests file=aquaservers.operator.aquasec.com.crd.yaml load=bundle
ERRO[0008] permissive mode disabled                      bundles="[quay.io/operator_testing/aqua-operator:v1.0.1 quay.io/operator_testing/aqua-operator:v1.0.2]" error="error loading bundle from image: Error adding package error loading bundle into db: UNIQUE constraint failed: operatorbundle.name, operatorbundle.version, operatorbundle.bundlepath"
Error: error loading bundle from image: Error adding package error loading bundle into db: UNIQUE constraint failed: operatorbundle.name, operatorbundle.version, operatorbundle.bundlepath
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.
      --skip-tls                skip TLS certificate verification for container image registries while pulling bundles
  -t, --tag string              custom tag for container image being built

mvalahtv avatar Jun 22 '20 20:06 mvalahtv

This definitely seems like a bug, we'll take a look at this one soon. Thanks for the report!

kevinrizza avatar Jun 23 '20 12:06 kevinrizza

Hi @kevinrizza, any ETA on this?

J0zi avatar Jun 25 '20 11:06 J0zi

@J0zi @mvalahtv Did some digging on this. This is a litte more complicated than a bug in opm index rm, it's actually a problem with opm index add failing to handle invalid manifests.

The two bundle images you are adding quay.io/operator_testing/aqua-operator:v1.0.1 and quay.io/operator_testing/aqua-operator:v1.0.2 both attempt to exist in the stable channel, but neither have an explicit replaces set to create an update graph for one or the other. This essentially orphans the 1.0.1 bundle in the bundles table of the database, and it can't get properly cleaned up with opm index rm. We need to make two changes:

  1. Fix the edge case where multiple things can be inserted into the front of the graph, which generates these orphans (this should have just resulted in an error in your index add command.
  2. Fix index rm to clean up these orphan bundles.

To get you unblocked, you can update the 1.0.2 bundle to actually define the replaces field to point to the previous 1.0.1 bundle. Alternatively, these bundles should work fine if you are using --mode=semver when adding bundle images.

kevinrizza avatar Jun 25 '20 13:06 kevinrizza

Ok. Yes we were ignoring replaces when building these images from manifest format. With replaces it is working fine. Feel free to close this issue now, unless you want to leave it as reminder for opm index rm fixes

mvalahtv avatar Jun 25 '20 15:06 mvalahtv

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 24 '20 19:08 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Oct 24 '20 10:10 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 23 '20 13:12 stale[bot]