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

Create the k3s package using the upstream installer script #335

Merged
merged 9 commits into from
Jul 24, 2023
22 changes: 0 additions & 22 deletions packages/bundles/osbuilder/k3s/build.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions packages/bundles/osbuilder/k3s/collection.yaml

This file was deleted.

24 changes: 0 additions & 24 deletions packages/k3s/build.yaml

This file was deleted.

13 changes: 0 additions & 13 deletions packages/k3s/collection.yaml

This file was deleted.

38 changes: 38 additions & 0 deletions packages/k8s/k3s/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
requires:
- name: "toolchain-go"
category: "development"
version: ">=0"
env:
{{$arch:=(default .Values.arch "amd64")}}
- INSTALL_K3S_BIN_DIR="/usr/bin"
- INSTALL_K3S_SELINUX_WARN=true
- INSTALL_K3S_SKIP_START="true"
- INSTALL_K3S_SKIP_ENABLE="true"
- INSTALL_K3S_SKIP_SELINUX_RPM="true"
- INSTALL_K3S_VERSION=v{{.Values.version}}+k3s1
{{ if eq $arch "arm" }}
- ARCH=arm64
{{ else }}
- ARCH={{ $arch }}
{{ end }}
steps:
- curl -sfL https://get.k3s.io > installer.sh
# Let the installer script install service files both for openrc and systemd:
# https://github.com/k3s-io/k3s/blob/36645e7311e9bdbbf2adb79ecd8bd68556bc86f6/install.sh#L114-L122
- touch /bin/systemctl && chmod +x /bin/systemctl
jimmykarily marked this conversation as resolved.
Show resolved Hide resolved
- mkdir -p /etc/systemd/system/
- bash installer.sh
- bash installer.sh agent
# Run again to create the openrc service files
- rm /bin/systemctl
- rm -rf /etc/systemd/system/
- touch /sbin/openrc-run && chmod +x /sbin/openrc-run
- bash installer.sh
- rm -rf installer.sh
- echo "{{ ( index .Values (print "checksum-" $arch) ) }} /usr/bin/{{.Values.name}}" | sha256sum -w -c
- chmod +x /usr/bin/{{.Values.name}}

includes:
- /usr/bin/{{.Values.name}}
- /etc/systemd/system/k3s*.service
- /etc/init.d/k3s*
39 changes: 39 additions & 0 deletions packages/k8s/k3s/collection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
packages:
- name: k3s
category: k8s
checksum-amd64: "59c4285b5c9db1525ab0c2a08807804312f6b94640efffad92cc3e7c8385c9c0"
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
category: k8s
checksum-amd64: "4e10a9de751306b177347ddbbbfc52f3771e5f6aaf95a19441dad6f837721410"
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
category: k8s
checksum-amd64: "ee130a125683a2e588a1f92c144b927a184c209adb59c0fdc6930822b07b4c90"
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 "
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{{ if .Values.init }}
{{ if eq .Values.init "systemd" }}
image: golang:1.20
env:
- CGO_ENABLED=0
- LDFLAGS="-s -w -X 'github.com/kairos-io/provider-kairos/v2/internal/cli.VERSION={{ .Values.version }}'"
prelude:
- apt-get update
- apt-get install -y git
{{ else }}
image: golang:1.20-alpine
prelude:
- apk add git
{{ end }}
- git clone https://github.com/kairos-io/provider-kairos
- |
PACKAGE_VERSION=${PACKAGE_VERSION%\-*} && \
cd provider-kairos && git checkout v$PACKAGE_VERSION
steps:
- mkdir -p /system/providers
- cd provider-kairos && go build -o agent-provider-kairos
- cd provider-kairos && go build -ldflags "${LDFLAGS}" -o agent-provider-kairos
- mv provider-kairos/agent-provider-kairos /system/providers/agent-provider-kairos
- ln -s /system/providers/agent-provider-kairos /usr/bin/kairos
{{ end }}

includes:
- ^/system$
- ^/system/providers$
- ^/system/providers/agent-provider-kairos$
- ^/usr/bin/kairos$
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
packages:
- name: "provider-kairos"
category: "bundles"
category: "system"
version: "2.3.0"
labels:
github.repo: "provider-kairos"
Expand Down