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

Set User in k3s systemd unit to fix loading AWS shared credentials files #11777

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

Conversation

brandond
Copy link
Member

@brandond brandond commented Feb 12, 2025

Proposed Changes

This ensures that the $HOME and $USER env vars get set. We have worked around this on the RKE2 side by setting it manually in the default .env file: https://github.com/rancher/rke2/blob/master/bundle/lib/systemd/system/rke2-server.env

This is required for loading credentials from shared credentials files (/root/.aws/credentials)

Ref: https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#%24USER

$HOME, $LOGNAME, and $SHELL are only set for the units that have User= set and SetLoginEnvironment= unset or set to true.

Types of Changes

bugfix

Verification

See instructions in #11614

Testing

yes, install script tests

Linked Issues

User-Facing Change


Further Comments

This ensures that the $HOME and $USER env vars get set. We have worked around this on the RKE2 side by setting it manually in the default .env file:
https://github.com/rancher/rke2/blob/master/bundle/lib/systemd/system/rke2-server.env

This is required for loading credentials from shared credentials files (`/root/.aws/credentials`)

Signed-off-by: Brad Davidson <[email protected]>
@brandond brandond requested a review from a team as a code owner February 12, 2025 22:40
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.36%. Comparing base (45dbc43) to head (564ce65).
Report is 11 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (45dbc43) and HEAD (564ce65). Click for more details.

HEAD has 3 uploads less than BASE
Flag BASE (45dbc43) HEAD (564ce65)
e2etests 8 5
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11777      +/-   ##
==========================================
- Coverage   47.66%   41.36%   -6.30%     
==========================================
  Files         206      206              
  Lines       19519    19519              
==========================================
- Hits         9304     8075    -1229     
- Misses       8874    10223    +1349     
+ Partials     1341     1221     -120     
Flag Coverage Δ
e2etests 4.44% <ø> (-39.71%) ⬇️
inttests 35.00% <ø> (?)
unittests 16.43% <ø> (ø)

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.

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.

1 participant