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

Kubernetes: Fix file uploads #771

Merged
merged 1 commit into from
Mar 14, 2024
Merged

Kubernetes: Fix file uploads #771

merged 1 commit into from
Mar 14, 2024

Conversation

gXkch
Copy link
Contributor

@gXkch gXkch commented Mar 11, 2024

  • This fixes a server error caused by missing volumeMounts on the Squest container. A securityContext is needed too since the user ID is 999.
  • Also sets the volumes on the NGINX container to readOnly to match with the docker-compose deployment.
  • Move the ldap_config.py file to the Squest container.
  • Add missing django-media volumeMounts

@Sispheor Sispheor changed the base branch from master to dev March 11, 2024 21:42
@Sispheor
Copy link
Contributor

Not sure that static is needed as it's served by nginx.

@Sispheor
Copy link
Contributor

Do you have the logs concerning the error you get so we can try to reproduce?

@gXkch
Copy link
Contributor Author

gXkch commented Mar 11, 2024

This is the log I get in the squest container when trying to access an uploaded portfolio image:

2024/03/11 22:47:43 [error] 7#7: *1 open() "/app/media/portfolio_image/icon-250272462.png" failed (2: No such file or directory), client: 10.42.1.161, server: , request: "GET /media/portfolio_image/icon-2502724 62.png HTTP/1.1", host: "squest.internal", referrer: "https://squest.internal/ui/service-catalog/"

I have not set a securityContext and neither have I configured any volume Mounts on the squest container.

However, when I do set the securityContext to 999 and mount /app/media in the Squest container I am able to load / display the image in the browser. I had the issue that the Squest container did not have permissions to create directories / files in the volume when I did NOT set the securityContext to 999.

Upon further testing I do agree that /app/static is only needed in the NGINX container and I will remove this mound from the Squest container.

@Sispheor
Copy link
Contributor

Indeed the squest image user named "django" is using id 999.
Just wondering now if it will work in Openshift as it generate a random ID.

@gXkch
Copy link
Contributor Author

gXkch commented Mar 14, 2024

Then how do you handle the migration job which also sets the fsGroup to 999?

securityContext:
fsGroup: 999

@Sispheor
Copy link
Contributor

Oh yes it's there already 😅.
Well... lt's merge the !

@Sispheor
Copy link
Contributor

Could you Squash your commit into a single one?

@gXkch
Copy link
Contributor Author

gXkch commented Mar 14, 2024

Done.

@gXkch gXkch changed the title Fix file uploads Kubernetes: Fix file uploads Mar 14, 2024
@Sispheor Sispheor merged commit 2e39487 into HewlettPackard:dev Mar 14, 2024
2 checks passed
@Sispheor
Copy link
Contributor

Thank you for your contribution.

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.

2 participants