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

Include auth model in OCI image #1212

Merged
merged 5 commits into from
May 17, 2024

Conversation

kian99
Copy link
Contributor

@kian99 kian99 commented May 10, 2024

Description

I'd like to propose an improvement to JIMM's deployment. The OpenFGA authorisation model is tightly coupled to JIMM's codebase i.e. there are several Go types defined based on the types in the auth model.

Currently the JIMM charm creates the auth model from user input, if the auth model supplied by the user is not the same as the one JIMM was tested against, things will break. This change would add the auth model as a file to the OCI image and in a separate PR to the charm, allow the charm to read the auth model and create it rather than using error-prone user input.

Fixes CSS-8463

Dockerfile Outdated
@@ -21,6 +21,7 @@ LABEL org.opencontainers.image.source=https://github.com/canonical/jimm
LABEL org.opencontainers.image.description="JIMM server container image"
RUN apt-get -qq update && apt-get -qq install -y ca-certificates postgresql-client
WORKDIR /root/
COPY --from=build-env /usr/src/jimm/local/openfga/authorisation_model.json .
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: I have a feeling that grouping OpenFGA-related files (which at the moment, it's just this one) in a separate directory (e.g., /openfga) could be beneficial some day in the future. What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's a good idea, I'll make an openfga folder inside /root/

Dockerfile Outdated
Comment on lines 24 to 27
RUN mkdir ./openfga
COPY --from=build-env /usr/src/jimm/openfga/authorisation_model.json ./openfga/
COPY --from=build-env /usr/src/jimm/jimmsrv .
COPY --from=build-env /usr/src/jimm/internal/dbmodel/sql ./sql/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to mkdir? Because for the SQL files (the last line) it just works.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point!

@kian99 kian99 merged commit d7037a8 into canonical:feature-oidc May 17, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants