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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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

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]>
@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 41.52%. Comparing base (0e15269) to head (329d73f).
Report is 1 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (0e15269) and HEAD (329d73f). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (0e15269) HEAD (329d73f)
e2etests 7 6
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11378      +/-   ##
==========================================
- Coverage   46.73%   41.52%   -5.21%     
==========================================
  Files         179      179              
  Lines       18600    18600              
==========================================
- Hits         8693     7724     -969     
- Misses       8553     9677    +1124     
+ Partials     1354     1199     -155     
Flag Coverage Δ
e2etests 32.30% <ø> (-9.63%) ⬇️
inttests 18.82% <ø> (ø)
unittests 13.82% <ø> (ø)

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
unguiculus and others added 3 commits November 28, 2024 09:12
Co-authored-by: Brad Davidson <[email protected]>
Signed-off-by: Reinhard Nägele <[email protected]>
Co-authored-by: Brad Davidson <[email protected]>
Signed-off-by: Reinhard Nägele <[email protected]>
@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
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