Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index permission denied on openshift #619

Open
daFritz84 opened this issue Apr 1, 2021 · 2 comments
Open

Index permission denied on openshift #619

daFritz84 opened this issue Apr 1, 2021 · 2 comments
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.
Milestone

Comments

@daFritz84
Copy link

Hi,

so, I tried to build an Index and deploy it via catalog source to an openshift cluster according to the README. This went without hickups, except that the spawned pod crashlooped after deployment.

After some initial debugging, I figured out that the index.db could not be opened due to insufficient write permissions. Then, I examined the existing RedHat marketplace index and found that they have a folder /registry with permissions 755. I replicated this behavior by generating the dockerfile, patch it, and pushed it to our registry. And guess what? It worked.

However, my solution seems kinda fishy. I just expected it to work out of the box, and not having to modify the generated Dockerfile.
Does anyone have any insights what I might did wrong? Do I need to set some additional service account permissions in openshift? Or is my solution fine?

Here is my current solution:

opm index add --bundles XXX/operator-test/memcached-operator-bundle:latest --tag XXX/operator-test/index:latest --generate --container-tool docker

Modify the generated Dockerfile, creating the /registry folder and set it as working dir.

FROM quay.io/operator-framework/upstream-opm-builder
LABEL operators.operatorframework.io.index.database.v1=/database/index.db
ADD database/index.db /database/index.db
RUN mkdir /registry && chmod 775 /registry
EXPOSE 50051
WORKDIR /registry
ENTRYPOINT ["/bin/opm"]
CMD ["registry", "serve", "--database", "/database/index.db"]

And push it to the registry

docker build . -f index.Dockerfile -t XXX/operator-test/index:latest
docker push XXX/operator-test/index:latest
@exdx
Copy link
Member

exdx commented Apr 29, 2021

Hi @daFritz84, what version of opm are you on?

We ran into this same issue where registry was using the umask of the terminal session, but it should be fixed in the most recent upstream opm releases.

@exdx exdx added the kind/bug Categorizes issue or PR as related to a bug. label Apr 29, 2021
@exdx exdx added this to the 1.18.0 milestone Apr 29, 2021
@daFritz84
Copy link
Author

daFritz84 commented Apr 30, 2021

Hi @exdx ,

I originally used version 1.15.4:

❯ opm version
Version: version.Version{OpmVersion:"v1.15.4-6-ga97d366a", GitCommit:"a97d366a92d302ff2056fa2d19aa3e48b0fbc99c", BuildDate:"2021-03-13T02:24:44Z", GoOs:"linux", GoArch:"amd64"}

Next, I tried the latest opm available from the openshift-v4 mirror.

❯ opm version
Version: version.Version{OpmVersion:"v1.15.4-6-ga97d366a", GitCommit:"a97d366a92d302ff2056fa2d19aa3e48b0fbc99c", BuildDate:"2021-04-14T22:47:35Z", GoOs:"linux", GoArch:"amd64"}

Same version but slightly newer build date.

Regardless of the build date, I still see the CrashLoopBackoff, i.e.:

Error: open db-522839942: permission denied

Finally, I tried the latest version from the github repository release page:

❯ opm version
Version: version.Version{OpmVersion:"v1.17.0", GitCommit:"ebeac77", BuildDate:"2021-04-13T18:40:36Z", GoOs:"linux", GoArch:"amd64"}

But sadly, I encountered the same CrashLoopBackoff situation.

One thing I noticed, that opm inside the pod does not seem to have any version information (openshift remote shell):

/registry $ opm version
Version: version.Version{OpmVersion:"unknown", GitCommit:"", BuildDate:"", GoOs:"linux", GoArch:"amd64"}

Maybe I am fetching some wrong base container image? Here ist the output of my docker build command (with my /registry folder fix):

 => [internal] load build definition from index.Dockerfile                                                                                                                             0.0s
 => => transferring dockerfile: 379B                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                      0.0s
 => => transferring context: 2B                                                                                                                                                        0.0s
 => [internal] load metadata for quay.io/operator-framework/upstream-opm-builder:latest                                                                                                0.6s
 => [internal] load build context                                                                                                                                                      0.0s
 => => transferring context: 68B                                                                                                                                                       0.0s
 => [1/4] FROM quay.io/operator-framework/upstream-opm-builder@sha256:6d3677d60356613b5e9f51012a44f826cb08b592e0f3e90fa8133b853c7720ac                                                 0.0s
 => CACHED [2/4] ADD database/index.db /database/index.db                                                                                                                              0.0s
 => [3/4] RUN mkdir /registry && chmod 775 /registry                                                                                                                                   0.3s
 => [4/4] WORKDIR /registry                                                                                                                                                            0.0s
 => exporting to image                                                                                                                                                                 0.1s
 => => exporting layers                                                                                                                                                                0.0s
 => => writing image sha256:7c18d4d6784e97e1dd966f0c98c605326bec2c8c7aeecd08c998cddbe03ef63b                                                                                           0.0s
 => => naming to XXX/operator-test/seconet-index:latest                                                                                          0.0s

@joelanford joelanford modified the milestones: 1.18.0, 1.19.0 Aug 19, 2021
@joelanford joelanford modified the milestones: 1.19.0, Backlog Feb 1, 2022
didierofrivia added a commit to Kuadrant/kuadrant-operator that referenced this issue Nov 16, 2022
* It will be used to build the catalog image
* In order to mitigate operator-framework/operator-registry#619
* The index.db is still generated with opm
didierofrivia added a commit to Kuadrant/kuadrant-operator that referenced this issue Nov 18, 2022
* In order to use instead of autogenerated index.Dockerfile
* To mitigate operator-framework/operator-registry#619
didierofrivia added a commit to Kuadrant/kuadrant-operator that referenced this issue Nov 18, 2022
* In order to use instead of autogenerated index.Dockerfile
* To mitigate operator-framework/operator-registry#619
didierofrivia added a commit to Kuadrant/kuadrant-operator that referenced this issue Nov 21, 2022
* In order to use instead of autogenerated index.Dockerfile
* To mitigate operator-framework/operator-registry#619
didierofrivia added a commit to Kuadrant/kuadrant-operator that referenced this issue Nov 22, 2022
* In order to use instead of autogenerated index.Dockerfile
* To mitigate operator-framework/operator-registry#619
alexsnaps pushed a commit to Kuadrant/kuadrant-operator that referenced this issue Dec 8, 2022
* Bumps opm version
* Creates tasks to load olm needed images to Kind for local testing
* Uses custom catalog Dockerfile

[catalog] Custom Dockerfile for building catalog

* In order to use instead of autogenerated index.Dockerfile
* To mitigate operator-framework/operator-registry#619

[gh] Using custom catalog.Dockerfile to build catalog images

[gh] Adding platforms for building images

[makefile] Adding platform param in custom docker build command
alexsnaps pushed a commit to Kuadrant/kuadrant-operator that referenced this issue Dec 8, 2022
* Bumps opm version
* Creates tasks to load olm needed images to Kind for local testing
* Uses custom catalog Dockerfile

[catalog] Custom Dockerfile for building catalog

* In order to use instead of autogenerated index.Dockerfile
* To mitigate operator-framework/operator-registry#619

[gh] Using custom catalog.Dockerfile to build catalog images

[gh] Adding platforms for building images

[makefile] Adding platform param in custom docker build command
alexsnaps added a commit to Kuadrant/kuadrant-operator that referenced this issue Dec 13, 2022
* [makefile] Adding target to setup olm kuadrant installation

* Bumps opm version
* Creates tasks to load olm needed images to Kind for local testing
* Uses custom catalog Dockerfile

[catalog] Custom Dockerfile for building catalog

* In order to use instead of autogenerated index.Dockerfile
* To mitigate operator-framework/operator-registry#619

[gh] Using custom catalog.Dockerfile to build catalog images

[gh] Adding platforms for building images

[makefile] Adding platform param in custom docker build command

* Reconcile Authorino when OSSM

* Updated workflows

* Skip lint'ing

* Deleted unneeded or dup'ed targets

* Get rid of the catalog docker file

* Delete catalog targets

* Fix target in catalog actions

* Partially addressing PR comments

* [gh] Removing conditional building catalog and bundle from workflow

* Removing diff task too

* [makefile] Removing unused target

* The catalog pod has its image policy set to ALWAYS

Co-authored-by: dd di cesare <[email protected]>
Co-authored-by: Guilherme Cassolato <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

No branches or pull requests

4 participants