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 K0s utility functions and cleanup #546

Merged
merged 10 commits into from
Jan 14, 2025
Merged

Conversation

wrkode
Copy link
Contributor

@wrkode wrkode commented Jan 12, 2025

This PR adds the systemd units and Env needed for provider-kairos to be able to manage k0s deployments.
I'm working on the provider-kairos as well.

Utils Package

  • K0sBin() added function for k0s binary
  • Version() Updated to handle both K3s and K0s versions
  • WriteEnv() Made generic to handle any service environment
  • FindCommand Enhanced to dynamically search for k0s
  • GetInit() Improved readability and robustness
  • PowerOFF() Updated to use a more generic shutdown command

machine package
added k0s services functions

CC @mauromorales

@wrkode wrkode marked this pull request as draft January 12, 2025 06:08
@wrkode wrkode marked this pull request as ready for review January 12, 2025 06:34
@mauromorales mauromorales requested a review from a team January 12, 2025 14:07
utils/utils.go Fixed Show fixed Hide fixed
utils/utils.go Fixed Show fixed Hide fixed
Copy link

codecov bot commented Jan 13, 2025

Codecov Report

Attention: Patch coverage is 0% with 23 lines in your changes missing coverage. Please review.

Project coverage is 52.50%. Comparing base (4bfcc75) to head (cc9f480).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
machine/machine.go 0.00% 23 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #546      +/-   ##
==========================================
- Coverage   53.11%   52.50%   -0.62%     
==========================================
  Files          19       19              
  Lines        1973     1996      +23     
==========================================
  Hits         1048     1048              
- Misses        795      818      +23     
  Partials      130      130              

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

Copy link
Contributor

@jimmykarily jimmykarily left a comment

Choose a reason for hiding this comment

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

Thanks for your work on this @wrkode!

I haven't seen the provider code yet so I would suggest we wait before we merge this until we see how it's used (in case the provider implementation shows that there is a better option than what we have here).

machine/machine.go Outdated Show resolved Hide resolved
utils/utils.go Outdated Show resolved Hide resolved
utils/utils.go Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
utils/utils.go Outdated Show resolved Hide resolved
@mauromorales
Copy link
Member

relates to kairos-io/kairos#3121

wrkode and others added 7 commits January 14, 2025 13:05
Signed-off-by: William Rizzo <[email protected]>
Signed-off-by: William Rizzo <[email protected]>
This function is not specific for k3s hence also not for k0s

Signed-off-by: Mauro Morales <[email protected]>
For versioning we now use the versioneer package also in this repo. I
couldn't find any instance of components depending on utils.Version() so
I think it's safe to remove

Signed-off-by: Mauro Morales <[email protected]>
@mauromorales mauromorales changed the title Adding systemd units for k0s Utils cleanup Jan 14, 2025
@mauromorales mauromorales changed the title Utils cleanup Add K0s utility functions and cleanup Jan 14, 2025
mauromorales and others added 2 commits January 14, 2025 13:11
This is not being used anymore, use Versioneer package instead

Signed-off-by: Mauro Morales <[email protected]>
Co-authored-by: Dimitris Karakasilis <[email protected]>
@mauromorales mauromorales merged commit 716d3f4 into kairos-io:main Jan 14, 2025
8 of 11 checks passed
mauromorales added a commit to kairos-io/provider-kairos that referenced this pull request Jan 14, 2025
This PR is dependent of
kairos-io/kairos-sdk#546, and it adds the
possibility to deploy k0s instead of k3s.

refactored `oneTimeBootstrap()` to handle k0s and k3s.
Added `K0s` type to bootstrap `config` package
added k0s to provider `package`` InteractiveInstall()` and check for
mutual exclusivity

CC: @mauromorales

---------

Signed-off-by: William Rizzo <[email protected]>
Signed-off-by: Mauro Morales <[email protected]>
Co-authored-by: Mauro Morales <[email protected]>
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.

4 participants