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

Fix K3S_DATA_DIR when running as non-root user #11378

Merged
merged 1 commit into from
Jan 10, 2025

Conversation

unguiculus
Copy link
Contributor

@unguiculus unguiculus commented Nov 27, 2024

Proposed Changes

When running the generated kill and uninstall scripts as non-root user, the environment variable K3S_DATA_DIR got lost, because sudo by default doesn't preserve the environment. This is fixed by adding the --preserve-env flag.

Types of Changes

Bugfix

Verification

  • Set environment variable K3S_DATA_DIR.
  • Run the generated k3s-uninstall.sh script as non-root user and check the log output.
  • Verify that the $K3S_DATA_DIR directory got cleaned.

Fixes: #11386

@unguiculus unguiculus requested a review from a team as a code owner November 27, 2024 16:35
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 47.81%. Comparing base (0144d9b) to head (749bf91).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11378      +/-   ##
==========================================
- Coverage   50.04%   47.81%   -2.24%     
==========================================
  Files         185      185              
  Lines       19239    19239              
==========================================
- Hits         9629     9199     -430     
- Misses       8222     8717     +495     
+ Partials     1388     1323      -65     
Flag Coverage Δ
e2etests 40.58% <ø> (-3.74%) ⬇️
inttests 35.14% <ø> (-0.07%) ⬇️
unittests 17.06% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@brandond
Copy link
Member

Thanks for the fix! Can you open an issue describing the problem this fixes, so our QA team can validate that the issue is resolved by this change?

Copy link
Member

@brandond brandond left a comment

Choose a reason for hiding this comment

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

I'd prefer to pass through only this one necessary env var, instead of passing through ALL of them.

install.sh Outdated Show resolved Hide resolved
install.sh Outdated Show resolved Hide resolved
brandond
brandond previously approved these changes Dec 3, 2024
thomasferrandiz
thomasferrandiz previously approved these changes Dec 3, 2024
@unguiculus
Copy link
Contributor Author

Any chance this get's merged soonish? Thanks.

@dereknola
Copy link
Member

We are in code freeze for December releases. This will get in for January.

@dereknola dereknola self-assigned this Dec 19, 2024
@brandond
Copy link
Member

brandond commented Jan 9, 2025

Would you mind rebasing this? Thanks!

@unguiculus
Copy link
Contributor Author

@brandond Done.

When running the generated kill and uninstall scripts, the environment
variable `K3S_DATA_DIR` got lost, because `sudo` by default doesn't
preserve the environment. This is fixed by adding the `--preserve-env`
flag.

Signed-off-by: Reinhard Nägele <[email protected]>
@dereknola dereknola merged commit dde2fef into k3s-io:master Jan 10, 2025
49 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.

K3S_DATA_DIR is lost when running kill and uninstall scripts as non-root user
4 participants