Skip to content

Commit

Permalink
Split k3s package in 2 (one for openrc, one for systemd) (#412)
Browse files Browse the repository at this point in the history
* Split k3s package in 2 (one for openrc, one for systemd)

because having all service files in places, confuses systemd because of
the sysv compatibility feature.

Part of: kairos-io/kairos#1797

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

* Use new names for the new packages

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

* Use one definition for both packages with templating

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

---------

Signed-off-by: Dimitris Karakasilis <[email protected]>
Signed-off-by: Dimitris Karakasilis <[email protected]>
Co-authored-by: Ettore Di Giacinto <[email protected]>
  • Loading branch information
jimmykarily and mudler authored Sep 8, 2023
1 parent 3d2c10a commit 038ee95
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 19 deletions.
25 changes: 12 additions & 13 deletions packages/k8s/k3s/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,26 @@ env:
{{ end }}
steps:
- curl -sfL https://get.k3s.io > installer.sh
# Let the installer script install service files both for openrc and systemd:
# Let the installer script install service files for openrc or systemd:
# https://github.com/k3s-io/k3s/blob/36645e7311e9bdbbf2adb79ecd8bd68556bc86f6/install.sh#L114-L122
{{ if eq .Values.name "k3s-openrc" }}
- touch /sbin/openrc-run && chmod +x /sbin/openrc-run
{{ else }}
- touch /bin/systemctl && chmod +x /bin/systemctl
- mkdir -p /etc/systemd/system/
{{ end }}
- bash installer.sh
- bash installer.sh agent
# Save the service files elsewhere because the next run will delete them
- mkdir -p /service-files && cp /etc/systemd/system/k3s*.service /service-files/
# Run again to create the openrc service files
- rm /bin/systemctl
- touch /sbin/openrc-run && chmod +x /sbin/openrc-run
- bash installer.sh
- rm -rf installer.sh
- chmod +x /usr/bin/{{.Values.name}}
# Put systemd service files back in place
- mv /service-files/* /etc/systemd/system/
- chmod +x /usr/bin/k3s

includes:
- ^/usr/bin/{{.Values.name}}
- ^/usr/bin/k3s
{{ if eq .Values.name "k3s-openrc" }}
- ^/etc/init.d/$
- ^/etc/init.d/k3s.*
{{ else }}
- ^/etc/systemd$
- ^/etc/systemd/system$
- ^/etc/systemd/system/k3s.*service$
- ^/etc/init.d/$
- ^/etc/init.d/k3s.*
{{ end }}
48 changes: 42 additions & 6 deletions packages/k8s/k3s/collection.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
packages:
- name: k3s
- name: k3s-openrc
category: k8s
version: "1.25.11+1"
version: "1.25.11"
k3s_version: "2"
labels:
github.owner: "k3s-io"
Expand All @@ -11,9 +11,9 @@ packages:
license: "APL-2"
description: " Lightweight Kubernetes "

- name: k3s
- name: k3s-openrc
category: k8s
version: "1.26.6+1"
version: "1.26.6"
k3s_version: "2"
labels:
github.owner: "k3s-io"
Expand All @@ -23,9 +23,45 @@ packages:
license: "APL-2"
description: " Lightweight Kubernetes "

- name: k3s
- name: k3s-openrc
category: k8s
version: "1.27.3+1"
version: "1.27.3"
k3s_version: "2"
labels:
github.owner: "k3s-io"
github.repo: "k3s"
uri:
- https://github.com/k3s-io/k3s
license: "APL-2"
description: " Lightweight Kubernetes "

- name: k3s-systemd
category: k8s
version: "1.25.11"
k3s_version: "2"
labels:
github.owner: "k3s-io"
github.repo: "k3s"
uri:
- https://github.com/k3s-io/k3s
license: "APL-2"
description: " Lightweight Kubernetes "

- name: k3s-systemd
category: k8s
version: "1.26.6"
k3s_version: "2"
labels:
github.owner: "k3s-io"
github.repo: "k3s"
uri:
- https://github.com/k3s-io/k3s
license: "APL-2"
description: " Lightweight Kubernetes "

- name: k3s-systemd
category: k8s
version: "1.27.3"
k3s_version: "2"
labels:
github.owner: "k3s-io"
Expand Down

0 comments on commit 038ee95

Please sign in to comment.