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

Add PATH to k3s env in install script #11096

Closed
wants to merge 2 commits into from

Conversation

vitorsavian
Copy link
Member

@vitorsavian vitorsavian commented Oct 11, 2024

Proposed Changes

  • Add the PATH environment variable to the install script

When running with systemd, k3s cannot see the $PATH variable that the root has, so the runtimes searcher cannot find the additional runtimes dirs using the $PATH.

Types of Changes

  • New Feature

Verification

  • Install k3s with the PATH variable
curl -sfL https://get.k3s.io/ | PATH=${PATH} sh -
  • cat the k3s env file
sudo cat /etc/systemd/system/k3s.service.env

Testing

Linked Issues

User-Facing Change

PATH can now be added to k3s env with PATH=${PATH} in install script

Further Comments

@vitorsavian vitorsavian requested a review from a team as a code owner October 11, 2024 21:58
Signed-off-by: Vitor Savian <[email protected]>
@@ -963,6 +963,7 @@ create_env_file() {
$SUDO chmod 0600 ${FILE_K3S_ENV}
sh -c export | while read x v; do echo $v; done | grep -E '^(K3S|CONTAINERD)_' | $SUDO tee ${FILE_K3S_ENV} >/dev/null
sh -c export | while read x v; do echo $v; done | grep -Ei '^(NO|HTTP|HTTPS)_PROXY' | $SUDO tee -a ${FILE_K3S_ENV} >/dev/null
sh -c export | while read x v; do echo $v; done | grep -E 'PATH' | sed "s/'//g" | $SUDO tee -a ${FILE_K3S_ENV} >/dev/null
Copy link
Member

@brandond brandond Oct 11, 2024

Choose a reason for hiding this comment

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

Why are we adding the user’s PATH to the systemd unit’s PATH?

Generally system services have a path that is intentionally more restricted than user paths. It is not really a best practice to add random untrusted paths to the service. If users have non-standard paths in their environment that they want K3s to use I think they should have to add these manually, I would not like to just grab whatever the user has in their env when they run the installer.

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.

needs discussion

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