k0s icon indicating copy to clipboard operation
k0s copied to clipboard

Drop kardianos/service dependency

Open jnummelin opened this issue 1 year ago • 12 comments

We anyways already provide our own templates for system units and thus do not depend that much on the library functionality.

kardianos/service is not really maintained, there's e.g. a bug fix PR opened by myself on June 2023 which has not been merged.

I propose that we drop the whole dependency, use our own templates fully and provide needed wrappers around. We handle much of the same/similar logic in k0sctl/rig side already and thus known what needs to be done.

jnummelin avatar Sep 12 '24 10:09 jnummelin

  • Detect init system (done in https://github.com/k0sproject/rig/tree/main/initsystem)
  • Write out the template (they are already in go text/template format in k0s sources)
  • Implement k0s start and k0s stop (also implemented in the same files in rig)

kke avatar Sep 12 '24 11:09 kke

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] avatar Oct 12 '24 23:10 github-actions[bot]

We had a bug in the current implementation (here is the fix), so let's also add some unit tests to make sure, that the generated services are correct

makhov avatar Oct 22 '24 08:10 makhov

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] avatar Nov 21 '24 23:11 github-actions[bot]

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] avatar Dec 25 '24 23:12 github-actions[bot]

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] avatar Jan 25 '25 23:01 github-actions[bot]

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] avatar Feb 27 '25 23:02 github-actions[bot]

I see few options:

  • "Vendor in" the needed kardianos parts with the obvious notes on original source&licence etc.
  • Create a fork of kardianos. I'm not sure how much we'd want to maintain that
  • Do everything from scratch

I think the best option is to "vendor in" the needed kardianos bits and go from there.

@k0sproject/k0s-maintainers WDYT?

jnummelin avatar Apr 30 '25 10:04 jnummelin

I'd go for "from scratch". We're probably not interested in maintaining a general purpose service library, so forking wouldn't be sustainable. Inlining the code means that we'd need to address the legal requirements, copyright notices and everything, which has maintenance cost, too.

Doing it from scratch would be the cleanest approach.

twz123 avatar May 06 '25 05:05 twz123

Perhaps a middle ground could be to introduce an internal API to interact with init systems, which then delegates to Kardianos service. Then, we could add dinit support (#5765) ourselves in terms of our new internal API, without being forced to do so upstream. We could then port each init system individually until we replace them all and can drop the dependency entirely.

For the record, as far as I can tell we're concerned with:

  • systemd
  • OpenRC
  • The Windows Service API

twz123 avatar May 26 '25 08:05 twz123

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] avatar Oct 12 '25 23:10 github-actions[bot]

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] avatar Nov 19 '25 23:11 github-actions[bot]