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

Don't write an empty k3s service on disk #519

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

jimmykarily
Copy link
Contributor

just use the one that was created by the k3s installer script

Fixes: kairos-io/kairos#2125

just use the one that was created by the k3s installer script

Fixes: kairos-io/kairos#2125

Signed-off-by: Dimitris Karakasilis <[email protected]>
Copy link

codecov bot commented Jan 10, 2024

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (874beb3) 7.93% compared to head (096d0ef) 8.11%.

Files Patch % Lines
internal/provider/bootstrap.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #519      +/-   ##
========================================
+ Coverage   7.93%   8.11%   +0.17%     
========================================
  Files         15      15              
  Lines        958     937      -21     
========================================
  Hits          76      76              
+ Misses       866     845      -21     
  Partials      16      16              

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

svc, err = openrc.NewService(
openrc.WithName(svcName),
openrc.WithUnitContent(string(content)),
Copy link
Member

Choose a reason for hiding this comment

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

this likely will break alpine - in the original openrc service file there is no way to override environment variables (which are actually used to set K3S_*)

Copy link
Member

Choose a reason for hiding this comment

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

we are not over-writing the init file any longer since we remove the WriteService line. So the original installation unit will be present and reading from the env location

Copy link
Member

@mudler mudler Jan 10, 2024

Choose a reason for hiding this comment

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

yep right, what I'm saying is that we used to write to a custom location, the env file is not read by the original k3s unit, it is kairos-specific (at least at the time of writing the provider)

Copy link
Member

Choose a reason for hiding this comment

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

@mudler gotcha, let me validate alpine then, meanwhile, I decided to merge because at least is better to have systemd systems working even if OpenRC ones (alpine) would break

@jimmykarily
Copy link
Contributor Author

We built an image with this for fedora and it works.

@mauromorales mauromorales merged commit 05d3833 into main Jan 10, 2024
8 of 9 checks passed
@mauromorales mauromorales deleted the 2125-fix-k3s-service-mess branch January 10, 2024 16:11
@mudler
Copy link
Member

mudler commented Jan 10, 2024

We built an image with this for fedora and it works.

did you tried with a master/agent or just single-node? #519 (comment) would probably get unnoticed until you try specifically to customize how you start k3s or k3s-agent

@mauromorales
Copy link
Member

@mudler validated it and it's working correctly on alpine too. This is because the installer from k3s creates a unit file which ends with:

if [ -f /etc/environment ]; then . /etc/environment; fi
if [ -f /etc/rancher/k3s/k3s-agent.env ]; then . /etc/rancher/k3s/k3s-agent.env; fi

and we write to /etc/rancher/k3s/k3s-agent.env the following:

K3S_TOKEN="..."
K3S_URL="https://192.168.122.18:6443"
command_args="agent --with-node-id >>/var/log/k3s-agent.log 2>&1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

🐛 k3s fails to start on multiple distros
3 participants