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

✨ Able to run controller inside the container platform with write access to root restrictions #322

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dmvolod
Copy link
Contributor

@dmvolod dmvolod commented Dec 5, 2024

What this PR does / why we need it:
This fix allows you to run a container with an operator on platforms that do not allow writing data to the root directory, such as OpenShift.

The approach used is very simple, we mount /xdg as an emptyDir volume and redirect XDG_* variables used by helm there. This should work for upstream Kubernetes as well, but e2e validation is required.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #236

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Dec 5, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dmvolod
Once this PR has been reviewed and has the lgtm label, please assign mboersma for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot requested a review from mboersma December 5, 2024 20:35
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 5, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @dmvolod. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 5, 2024
@Jont828
Copy link
Contributor

Jont828 commented Dec 10, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 10, 2024
Copy link
Contributor

@Jont828 Jont828 left a comment

Choose a reason for hiding this comment

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

Thanks for picking this up! Is the idea here just to mount the /xdg path and expect the user or management cluster to populate it? And are you able to test this with OpenShift and verify that it works?

config/manager/manager.yaml Outdated Show resolved Hide resolved
@dmvolod
Copy link
Contributor Author

dmvolod commented Dec 11, 2024

Thanks for picking this up! Is the idea here just to mount the /xdg path and expect the user or management cluster to populate it? And are you able to test this with OpenShift and verify that it works?

Yes, I also changed the container security parameter readOnlyRootFilesystem to true in the next commit. This aligns our approach to running the controller inside OpenShift or a platform with similar security restrictions. Tested it, but not on OpenShift, seems to should work. Please run e2e again.

@dmvolod
Copy link
Contributor Author

dmvolod commented Dec 11, 2024

@Jont828 could you please to point me to the deployed addon prodived helm container pod logs in failed CI.

@dmvolod
Copy link
Contributor Author

dmvolod commented Dec 11, 2024

@Jont828 could you please to point me to the deployed addon prodived helm container pod logs in failed CI.

Oh, ran it locally and know why it happens, /tmp is also using as rw volume. Will fix soon.

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 11, 2024
Comment on lines +86 to +89
- emptyDir: {}
name: xdg
- emptyDir: {}
name: tmp
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can use single tmp volume mounted to the /tmp and utilize it for all temporary files (common and XDG based). @Jont828 what do you think about it? This should work for all Kubernetes platforms and security restrictions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for OpenShift as Management Cluster
3 participants