* [PR PATCH] kubernetes: Add runit to kubeadm initssytems list
@ 2024-12-13 21:09 tsndqst
2024-12-13 21:13 ` tsndqst
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: tsndqst @ 2024-12-13 21:09 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1613 bytes --]
There is a new pull request by tsndqst against master on the void-packages repository
https://github.com/tsndqst/void-packages kubeadm-runit
https://github.com/void-linux/void-packages/pull/53514
kubernetes: Add runit to kubeadm initssytems list
- Add runit to kubeadm initssytems list (I've been using this patch for 4 years)
- Create kubeadm subpackage.
- Set cgroupfs as default cgroup driver in kubeadm.
- Add example kubelet variables that simulate systemd drop-in. https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/#the-kubelet-drop-in-file-for-systemd
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-glibc
- aarch64-musl
A patch file from https://github.com/void-linux/void-packages/pull/53514.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-kubeadm-runit-53514.patch --]
[-- Type: text/x-diff, Size: 9061 bytes --]
From 5d244a6f4d19788c5f5e59dd712739a227ba4659 Mon Sep 17 00:00:00 2001
From: Tim Sandquist <tim.sandquist@gmail.com>
Date: Fri, 13 Dec 2024 12:48:26 -0600
Subject: [PATCH] kubernetes: Add runit to kubeadm initssytems list
Create kubeadm subpackage
Set cgroupfs as default cgroup driver in kubeadm
Add example kubelet variables that simulate systemd drop-in
---
srcpkgs/kubeadm | 1 +
srcpkgs/kubernetes/files/environ/kubelet | 10 +++
srcpkgs/kubernetes/files/kubelet/run | 2 +-
.../cgroupfs_default_cgroupDriver.patch | 14 +++
srcpkgs/kubernetes/patches/runit.patch | 85 +++++++++++++++++++
srcpkgs/kubernetes/template | 36 ++++++--
6 files changed, 142 insertions(+), 6 deletions(-)
create mode 120000 srcpkgs/kubeadm
create mode 100644 srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
create mode 100644 srcpkgs/kubernetes/patches/runit.patch
diff --git a/srcpkgs/kubeadm b/srcpkgs/kubeadm
new file mode 120000
index 00000000000000..70cfe557632f08
--- /dev/null
+++ b/srcpkgs/kubeadm
@@ -0,0 +1 @@
+kubernetes
\ No newline at end of file
diff --git a/srcpkgs/kubernetes/files/environ/kubelet b/srcpkgs/kubernetes/files/environ/kubelet
index db93a5eeb42a1b..675ae119350ae2 100644
--- a/srcpkgs/kubernetes/files/environ/kubelet
+++ b/srcpkgs/kubernetes/files/environ/kubelet
@@ -15,3 +15,13 @@ KUBELET_API_SERVER="--api-servers=http://127.0.0.1:8080"
# Add your own!
KUBELET_ARGS=""
+
+# Simulate kubelet drop-in file for systemd
+# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/#the-kubelet-drop-in-file-for-systemd
+KUBELET_KUBECONFIG_ARGS="--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
+KUBELET_CONFIG_ARGS="--config=/var/lib/kubelet/config.yaml"
+[ -r /var/lib/kubelet/kubeadm-flags.env ] && . /var/lib/kubelet/kubeadm-flags.env
+[ -r /etc/default/kubelet ] && . /etc/default/kubelet
+
+# Uncomment the next line to make use of the kubelet drop-in variables or set your own $OPTS variable
+#OPTS="$KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS"
diff --git a/srcpkgs/kubernetes/files/kubelet/run b/srcpkgs/kubernetes/files/kubelet/run
index 0bea9b4d28f6e8..5c551cce17f05c 100644
--- a/srcpkgs/kubernetes/files/kubelet/run
+++ b/srcpkgs/kubernetes/files/kubelet/run
@@ -2,4 +2,4 @@
exec 2>&1
[ -r /etc/kubernetes/config ] && . /etc/kubernetes/config
[ -r /etc/kubernetes/kubelet ] && . /etc/kubernetes/kubelet
-exec kubelet $OPTS 2>/dev/null
+exec kubelet $OPTS
diff --git a/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch b/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
new file mode 100644
index 00000000000000..84af97117b49c4
--- /dev/null
+++ b/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
@@ -0,0 +1,14 @@
+diff --git a/cmd/kubeadm/app/componentconfigs/kubelet.go b/cmd/kubeadm/app/componentconfigs/kubelet.go
+index 436bf1bc87c..6c7c915acd7 100644
+--- a/cmd/kubeadm/app/componentconfigs/kubelet.go
++++ b/cmd/kubeadm/app/componentconfigs/kubelet.go
+@@ -193,7 +193,7 @@ func (kc *kubeletConfig) Default(cfg *kubeadmapi.ClusterConfiguration, _ *kubead
+ kc.config.RotateCertificates = kubeletRotateCertificates
+
+ if len(kc.config.CgroupDriver) == 0 {
+- klog.V(1).Infof("the value of KubeletConfiguration.cgroupDriver is empty; setting it to %q", constants.CgroupDriverSystemd)
+- kc.config.CgroupDriver = constants.CgroupDriverSystemd
++ klog.V(1).Infof("the value of KubeletConfiguration.cgroupDriver is empty; setting it to %q", "cgroupfs")
++ kc.config.CgroupDriver = "cgroupfs"
+ }
+ }
diff --git a/srcpkgs/kubernetes/patches/runit.patch b/srcpkgs/kubernetes/patches/runit.patch
new file mode 100644
index 00000000000000..d7474d855cca8b
--- /dev/null
+++ b/srcpkgs/kubernetes/patches/runit.patch
@@ -0,0 +1,85 @@
+--- a/cmd/kubeadm/app/util/initsystem/initsystem_unix.go
++++ b/cmd/kubeadm/app/util/initsystem/initsystem_unix.go
+@@ -21,6 +21,7 @@ package initsystem
+ import (
+ "fmt"
+ "os/exec"
++ "os"
+ "strings"
+ )
+
+@@ -146,6 +147,63 @@ func (sysd SystemdInitSystem) ServiceIsActive(service string) bool {
+ return false
+ }
+
++// RunitInitSystem defines runit
++type RunitInitSystem struct{}
++
++// EnableCommand return a string describing how to enable a service
++func (runit RunitInitSystem) EnableCommand(service string) string {
++ return fmt.Sprintf("ln -s /etc/sv/%[1]s /var/service/%[1]s", service)
++}
++
++// ServiceExists ensures the service is defined for this init system.
++func (runit RunitInitSystem) ServiceExists(service string) bool {
++ servicePath := string(fmt.Sprintf("/etc/sv/%s/run", service))
++ info, err := os.Stat(servicePath)
++ if os.IsNotExist(err) {
++ return false
++ }
++ return !info.IsDir()
++}
++
++// ServiceIsActive ensures the service is running, or attempting to run. (crash looping in the case of kubelet)
++func (runit RunitInitSystem) ServiceIsActive(service string) bool {
++ args := []string{"status", fmt.Sprintf("/var/service/%s", service)}
++ outBytes, _ := exec.Command("sv", args...).CombinedOutput()
++ outStr := string(outBytes)
++ return strings.HasPrefix(outStr, "run:")
++}
++
++// ServiceIsEnabled ensures the service is enabled to start on each boot.
++func (runit RunitInitSystem) ServiceIsEnabled(service string) bool {
++ servicePath := string(fmt.Sprintf("/var/service/%s/run", service))
++ info, err := os.Stat(servicePath)
++ if os.IsNotExist(err) {
++ return false
++ }
++ return !info.IsDir()
++}
++
++// ServiceRestart tries to reload the environment and restart the specific service
++func (runit RunitInitSystem) ServiceRestart(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"restart", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
++// ServiceStart tries to start a specific service
++func (runit RunitInitSystem) ServiceStart(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"start", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
++// ServiceStop tries to stop a specific service
++func (runit RunitInitSystem) ServiceStop(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"stop", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
+ // GetInitSystem returns an InitSystem for the current system, or nil
+ // if we cannot detect a supported init system.
+ // This indicates we will skip init system checks, not an error.
+@@ -159,6 +217,10 @@ func GetInitSystem() (InitSystem, error) {
+ if err == nil {
+ return &OpenRCInitSystem{}, nil
+ }
++ _, err = exec.LookPath("runit")
++ if err == nil {
++ return &RunitInitSystem{}, nil
++ }
+
+ return nil, fmt.Errorf("no supported init system detected, skipping checking for services")
+ }
diff --git a/srcpkgs/kubernetes/template b/srcpkgs/kubernetes/template
index 4766f97a01740c..82e717b744c2bf 100644
--- a/srcpkgs/kubernetes/template
+++ b/srcpkgs/kubernetes/template
@@ -1,8 +1,8 @@
# Template file for 'kubernetes'
pkgname=kubernetes
version=1.32.0
-revision=1
-archs="aarch64* x86_64* ppc64le*"
+revision=2
+archs="aarch64* x86_64*"
build_style=go
go_import_path="github.com/kubernetes/kubernetes"
hostmakedepends="rsync git go-bindata which curl tar"
@@ -13,14 +13,30 @@ license="Apache-2.0"
homepage="http://kubernetes.io"
distfiles="https://$go_import_path/archive/v$version.tar.gz"
checksum=3793859c53f09ebc92e013ea858b8916cc19d7fe288ec95882dada4e5a075d08
-nocross=yes
system_accounts="kube"
make_dirs="/var/lib/kubelet 0755 kube kube"
conf_files="/etc/kubernetes/*"
+# Cross builds fail with -fuse-ld=gold
+LDFLAGS="-fuse-ld=bfd"
+
do_build() {
- make
- hack/generate-docs.sh
+ KUBE_BUILD_PLATFORMS=linux/${GOARCH} make
+
+ # Build the man pages on the host machine
+ # Run in a subshell to keep variables isolated
+ (
+ # Set GO variables based on host
+ case "$XBPS_MACHINE" in
+ aarch64*) export GOARCH=arm64;;
+ x86_64*) export GOARCH=amd64;;
+ esac
+ CGO_CFLAGS=${CFLAGS_host} CC=${GCC_host} CC_target=${GCC_host} \
+ GCC=${GCC_host} GCC_target=${GCC_host} \
+ PATH=$PATH:_output/local/go/bin/linux_${GOARCH} \
+ hack/update-generated-docs.sh
+ )
+
find "_output/local/bin/linux/" -type f -executable | grep "kubectl$" | egrep -v "gen|test" | while read line
do
$line completion bash > completion.bash
@@ -53,8 +69,18 @@ kubectl_package() {
short_desc="Controls the Kubernetes cluster manager"
pkg_install() {
vmove usr/bin/kubectl
+ vmove usr/bin/kubectl-convert
vmove usr/share/man/man1/kubectl*
vcompletion completion.bash bash
vcompletion completion.zsh zsh
}
}
+
+kubeadm_package() {
+ short_desc="Tool built for creating Kubernetes clusters"
+ pkg_install() {
+ vmove usr/bin/kubeadm
+ vmove usr/share/man/man1/kubeadm*
+ vmkdir etc/kubernetes/manifests
+ }
+}
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: kubernetes: Add runit to kubeadm initssytems list
2024-12-13 21:09 [PR PATCH] kubernetes: Add runit to kubeadm initssytems list tsndqst
@ 2024-12-13 21:13 ` tsndqst
2024-12-13 21:29 ` tsndqst
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: tsndqst @ 2024-12-13 21:13 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 170 bytes --]
New comment by tsndqst on void-packages repository
https://github.com/void-linux/void-packages/pull/53514#issuecomment-2542391466
Comment:
@thypon what do you think?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: kubernetes: Add runit to kubeadm initssytems list
2024-12-13 21:09 [PR PATCH] kubernetes: Add runit to kubeadm initssytems list tsndqst
2024-12-13 21:13 ` tsndqst
@ 2024-12-13 21:29 ` tsndqst
2024-12-14 1:55 ` [PR PATCH] [Updated] " tsndqst
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: tsndqst @ 2024-12-13 21:29 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 257 bytes --]
New comment by tsndqst on void-packages repository
https://github.com/void-linux/void-packages/pull/53514#issuecomment-2542412322
Comment:
I keep forgetting that my local machine has `binfmt-support` installed. I'll look into the cross-compile failures.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PR PATCH] [Updated] kubernetes: Add runit to kubeadm initssytems list
2024-12-13 21:09 [PR PATCH] kubernetes: Add runit to kubeadm initssytems list tsndqst
2024-12-13 21:13 ` tsndqst
2024-12-13 21:29 ` tsndqst
@ 2024-12-14 1:55 ` tsndqst
2024-12-14 2:15 ` tsndqst
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: tsndqst @ 2024-12-14 1:55 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]
There is an updated pull request by tsndqst against master on the void-packages repository
https://github.com/tsndqst/void-packages kubeadm-runit
https://github.com/void-linux/void-packages/pull/53514
kubernetes: Add runit to kubeadm initssytems list
- Add runit to kubeadm initssytems list (I've been using this patch for 4 years)
- Create kubeadm subpackage.
- Set cgroupfs as default cgroup driver in kubeadm.
- Add example kubelet variables that simulate systemd drop-in. https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/#the-kubelet-drop-in-file-for-systemd
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-glibc
- aarch64-musl
A patch file from https://github.com/void-linux/void-packages/pull/53514.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-kubeadm-runit-53514.patch --]
[-- Type: text/x-diff, Size: 9315 bytes --]
From df9d1187edac50d16e685478df21a0aeefa3865d Mon Sep 17 00:00:00 2001
From: Tim Sandquist <tim.sandquist@gmail.com>
Date: Fri, 13 Dec 2024 12:48:26 -0600
Subject: [PATCH] kubernetes: Add runit to kubeadm initssytems list
Create kubeadm subpackage
Set cgroupfs as default cgroup driver in kubeadm
Add example kubelet variables that simulate systemd drop-in
---
srcpkgs/kubeadm | 1 +
srcpkgs/kubernetes/files/environ/kubelet | 10 +++
srcpkgs/kubernetes/files/kubelet/run | 2 +-
.../cgroupfs_default_cgroupDriver.patch | 14 +++
srcpkgs/kubernetes/patches/runit.patch | 85 +++++++++++++++++++
srcpkgs/kubernetes/template | 42 +++++++--
6 files changed, 146 insertions(+), 8 deletions(-)
create mode 120000 srcpkgs/kubeadm
create mode 100644 srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
create mode 100644 srcpkgs/kubernetes/patches/runit.patch
diff --git a/srcpkgs/kubeadm b/srcpkgs/kubeadm
new file mode 120000
index 00000000000000..70cfe557632f08
--- /dev/null
+++ b/srcpkgs/kubeadm
@@ -0,0 +1 @@
+kubernetes
\ No newline at end of file
diff --git a/srcpkgs/kubernetes/files/environ/kubelet b/srcpkgs/kubernetes/files/environ/kubelet
index db93a5eeb42a1b..675ae119350ae2 100644
--- a/srcpkgs/kubernetes/files/environ/kubelet
+++ b/srcpkgs/kubernetes/files/environ/kubelet
@@ -15,3 +15,13 @@ KUBELET_API_SERVER="--api-servers=http://127.0.0.1:8080"
# Add your own!
KUBELET_ARGS=""
+
+# Simulate kubelet drop-in file for systemd
+# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/#the-kubelet-drop-in-file-for-systemd
+KUBELET_KUBECONFIG_ARGS="--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
+KUBELET_CONFIG_ARGS="--config=/var/lib/kubelet/config.yaml"
+[ -r /var/lib/kubelet/kubeadm-flags.env ] && . /var/lib/kubelet/kubeadm-flags.env
+[ -r /etc/default/kubelet ] && . /etc/default/kubelet
+
+# Uncomment the next line to make use of the kubelet drop-in variables or set your own $OPTS variable
+#OPTS="$KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS"
diff --git a/srcpkgs/kubernetes/files/kubelet/run b/srcpkgs/kubernetes/files/kubelet/run
index 0bea9b4d28f6e8..5c551cce17f05c 100644
--- a/srcpkgs/kubernetes/files/kubelet/run
+++ b/srcpkgs/kubernetes/files/kubelet/run
@@ -2,4 +2,4 @@
exec 2>&1
[ -r /etc/kubernetes/config ] && . /etc/kubernetes/config
[ -r /etc/kubernetes/kubelet ] && . /etc/kubernetes/kubelet
-exec kubelet $OPTS 2>/dev/null
+exec kubelet $OPTS
diff --git a/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch b/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
new file mode 100644
index 00000000000000..84af97117b49c4
--- /dev/null
+++ b/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
@@ -0,0 +1,14 @@
+diff --git a/cmd/kubeadm/app/componentconfigs/kubelet.go b/cmd/kubeadm/app/componentconfigs/kubelet.go
+index 436bf1bc87c..6c7c915acd7 100644
+--- a/cmd/kubeadm/app/componentconfigs/kubelet.go
++++ b/cmd/kubeadm/app/componentconfigs/kubelet.go
+@@ -193,7 +193,7 @@ func (kc *kubeletConfig) Default(cfg *kubeadmapi.ClusterConfiguration, _ *kubead
+ kc.config.RotateCertificates = kubeletRotateCertificates
+
+ if len(kc.config.CgroupDriver) == 0 {
+- klog.V(1).Infof("the value of KubeletConfiguration.cgroupDriver is empty; setting it to %q", constants.CgroupDriverSystemd)
+- kc.config.CgroupDriver = constants.CgroupDriverSystemd
++ klog.V(1).Infof("the value of KubeletConfiguration.cgroupDriver is empty; setting it to %q", "cgroupfs")
++ kc.config.CgroupDriver = "cgroupfs"
+ }
+ }
diff --git a/srcpkgs/kubernetes/patches/runit.patch b/srcpkgs/kubernetes/patches/runit.patch
new file mode 100644
index 00000000000000..d7474d855cca8b
--- /dev/null
+++ b/srcpkgs/kubernetes/patches/runit.patch
@@ -0,0 +1,85 @@
+--- a/cmd/kubeadm/app/util/initsystem/initsystem_unix.go
++++ b/cmd/kubeadm/app/util/initsystem/initsystem_unix.go
+@@ -21,6 +21,7 @@ package initsystem
+ import (
+ "fmt"
+ "os/exec"
++ "os"
+ "strings"
+ )
+
+@@ -146,6 +147,63 @@ func (sysd SystemdInitSystem) ServiceIsActive(service string) bool {
+ return false
+ }
+
++// RunitInitSystem defines runit
++type RunitInitSystem struct{}
++
++// EnableCommand return a string describing how to enable a service
++func (runit RunitInitSystem) EnableCommand(service string) string {
++ return fmt.Sprintf("ln -s /etc/sv/%[1]s /var/service/%[1]s", service)
++}
++
++// ServiceExists ensures the service is defined for this init system.
++func (runit RunitInitSystem) ServiceExists(service string) bool {
++ servicePath := string(fmt.Sprintf("/etc/sv/%s/run", service))
++ info, err := os.Stat(servicePath)
++ if os.IsNotExist(err) {
++ return false
++ }
++ return !info.IsDir()
++}
++
++// ServiceIsActive ensures the service is running, or attempting to run. (crash looping in the case of kubelet)
++func (runit RunitInitSystem) ServiceIsActive(service string) bool {
++ args := []string{"status", fmt.Sprintf("/var/service/%s", service)}
++ outBytes, _ := exec.Command("sv", args...).CombinedOutput()
++ outStr := string(outBytes)
++ return strings.HasPrefix(outStr, "run:")
++}
++
++// ServiceIsEnabled ensures the service is enabled to start on each boot.
++func (runit RunitInitSystem) ServiceIsEnabled(service string) bool {
++ servicePath := string(fmt.Sprintf("/var/service/%s/run", service))
++ info, err := os.Stat(servicePath)
++ if os.IsNotExist(err) {
++ return false
++ }
++ return !info.IsDir()
++}
++
++// ServiceRestart tries to reload the environment and restart the specific service
++func (runit RunitInitSystem) ServiceRestart(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"restart", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
++// ServiceStart tries to start a specific service
++func (runit RunitInitSystem) ServiceStart(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"start", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
++// ServiceStop tries to stop a specific service
++func (runit RunitInitSystem) ServiceStop(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"stop", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
+ // GetInitSystem returns an InitSystem for the current system, or nil
+ // if we cannot detect a supported init system.
+ // This indicates we will skip init system checks, not an error.
+@@ -159,6 +217,10 @@ func GetInitSystem() (InitSystem, error) {
+ if err == nil {
+ return &OpenRCInitSystem{}, nil
+ }
++ _, err = exec.LookPath("runit")
++ if err == nil {
++ return &RunitInitSystem{}, nil
++ }
+
+ return nil, fmt.Errorf("no supported init system detected, skipping checking for services")
+ }
diff --git a/srcpkgs/kubernetes/template b/srcpkgs/kubernetes/template
index 4766f97a01740c..44c26379517530 100644
--- a/srcpkgs/kubernetes/template
+++ b/srcpkgs/kubernetes/template
@@ -1,9 +1,10 @@
# Template file for 'kubernetes'
pkgname=kubernetes
version=1.32.0
-revision=1
-archs="aarch64* x86_64* ppc64le*"
+revision=2
+archs="aarch64* x86_64*"
build_style=go
+build_helper=qemu
go_import_path="github.com/kubernetes/kubernetes"
hostmakedepends="rsync git go-bindata which curl tar"
depends="kubectl conntrack-tools"
@@ -13,18 +14,35 @@ license="Apache-2.0"
homepage="http://kubernetes.io"
distfiles="https://$go_import_path/archive/v$version.tar.gz"
checksum=3793859c53f09ebc92e013ea858b8916cc19d7fe288ec95882dada4e5a075d08
-nocross=yes
system_accounts="kube"
make_dirs="/var/lib/kubelet 0755 kube kube"
conf_files="/etc/kubernetes/*"
+make_check=no # Too many tests
+
+# Cross builds fail with -fuse-ld=gold
+LDFLAGS="-fuse-ld=bfd"
do_build() {
- make
- hack/generate-docs.sh
+ KUBE_BUILD_PLATFORMS=linux/${GOARCH} make
+
+ # Build the man pages on the host machine
+ # Run in a subshell to keep variables isolated
+ (
+ # Set GO variables based on host
+ case "$XBPS_MACHINE" in
+ aarch64*) export GOARCH=arm64;;
+ x86_64*) export GOARCH=amd64;;
+ esac
+ CGO_CFLAGS=${CFLAGS_host} CC=${GCC_host} CC_target=${GCC_host} \
+ GCC=${GCC_host} GCC_target=${GCC_host} \
+ PATH=$PATH:_output/local/go/bin/linux_${GOARCH} \
+ hack/update-generated-docs.sh
+ )
+
find "_output/local/bin/linux/" -type f -executable | grep "kubectl$" | egrep -v "gen|test" | while read line
do
- $line completion bash > completion.bash
- $line completion zsh > completion.zsh
+ vtargetrun $line completion bash > completion.bash
+ vtargetrun $line completion zsh > completion.zsh
break
done
}
@@ -53,8 +71,18 @@ kubectl_package() {
short_desc="Controls the Kubernetes cluster manager"
pkg_install() {
vmove usr/bin/kubectl
+ vmove usr/bin/kubectl-convert
vmove usr/share/man/man1/kubectl*
vcompletion completion.bash bash
vcompletion completion.zsh zsh
}
}
+
+kubeadm_package() {
+ short_desc="Tool built for creating Kubernetes clusters"
+ pkg_install() {
+ vmove usr/bin/kubeadm
+ vmove usr/share/man/man1/kubeadm*
+ vmkdir etc/kubernetes/manifests
+ }
+}
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PR PATCH] [Updated] kubernetes: Add runit to kubeadm initssytems list
2024-12-13 21:09 [PR PATCH] kubernetes: Add runit to kubeadm initssytems list tsndqst
` (2 preceding siblings ...)
2024-12-14 1:55 ` [PR PATCH] [Updated] " tsndqst
@ 2024-12-14 2:15 ` tsndqst
2025-01-16 14:10 ` tsndqst
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: tsndqst @ 2024-12-14 2:15 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]
There is an updated pull request by tsndqst against master on the void-packages repository
https://github.com/tsndqst/void-packages kubeadm-runit
https://github.com/void-linux/void-packages/pull/53514
kubernetes: Add runit to kubeadm initssytems list
- Add runit to kubeadm initssytems list (I've been using this patch for 4 years)
- Create kubeadm subpackage.
- Set cgroupfs as default cgroup driver in kubeadm.
- Add example kubelet variables that simulate systemd drop-in. https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/#the-kubelet-drop-in-file-for-systemd
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-glibc
- aarch64-musl
A patch file from https://github.com/void-linux/void-packages/pull/53514.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-kubeadm-runit-53514.patch --]
[-- Type: text/x-diff, Size: 9314 bytes --]
From aad07b76f9b7fe37eb40e71eee5758c98202eb40 Mon Sep 17 00:00:00 2001
From: Tim Sandquist <tim.sandquist@gmail.com>
Date: Fri, 13 Dec 2024 12:48:26 -0600
Subject: [PATCH] kubernetes: Add runit to kubeadm initssytems list
Create kubeadm subpackage
Set cgroupfs as default cgroup driver in kubeadm
Add example kubelet variables that simulate systemd drop-in
---
srcpkgs/kubeadm | 1 +
srcpkgs/kubernetes/files/environ/kubelet | 10 +++
srcpkgs/kubernetes/files/kubelet/run | 2 +-
.../cgroupfs_default_cgroupDriver.patch | 14 +++
srcpkgs/kubernetes/patches/runit.patch | 85 +++++++++++++++++++
srcpkgs/kubernetes/template | 42 +++++++--
6 files changed, 146 insertions(+), 8 deletions(-)
create mode 120000 srcpkgs/kubeadm
create mode 100644 srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
create mode 100644 srcpkgs/kubernetes/patches/runit.patch
diff --git a/srcpkgs/kubeadm b/srcpkgs/kubeadm
new file mode 120000
index 00000000000000..70cfe557632f08
--- /dev/null
+++ b/srcpkgs/kubeadm
@@ -0,0 +1 @@
+kubernetes
\ No newline at end of file
diff --git a/srcpkgs/kubernetes/files/environ/kubelet b/srcpkgs/kubernetes/files/environ/kubelet
index db93a5eeb42a1b..675ae119350ae2 100644
--- a/srcpkgs/kubernetes/files/environ/kubelet
+++ b/srcpkgs/kubernetes/files/environ/kubelet
@@ -15,3 +15,13 @@ KUBELET_API_SERVER="--api-servers=http://127.0.0.1:8080"
# Add your own!
KUBELET_ARGS=""
+
+# Simulate kubelet drop-in file for systemd
+# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/#the-kubelet-drop-in-file-for-systemd
+KUBELET_KUBECONFIG_ARGS="--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
+KUBELET_CONFIG_ARGS="--config=/var/lib/kubelet/config.yaml"
+[ -r /var/lib/kubelet/kubeadm-flags.env ] && . /var/lib/kubelet/kubeadm-flags.env
+[ -r /etc/default/kubelet ] && . /etc/default/kubelet
+
+# Uncomment the next line to make use of the kubelet drop-in variables or set your own $OPTS variable
+#OPTS="$KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS"
diff --git a/srcpkgs/kubernetes/files/kubelet/run b/srcpkgs/kubernetes/files/kubelet/run
index 0bea9b4d28f6e8..5c551cce17f05c 100644
--- a/srcpkgs/kubernetes/files/kubelet/run
+++ b/srcpkgs/kubernetes/files/kubelet/run
@@ -2,4 +2,4 @@
exec 2>&1
[ -r /etc/kubernetes/config ] && . /etc/kubernetes/config
[ -r /etc/kubernetes/kubelet ] && . /etc/kubernetes/kubelet
-exec kubelet $OPTS 2>/dev/null
+exec kubelet $OPTS
diff --git a/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch b/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
new file mode 100644
index 00000000000000..84af97117b49c4
--- /dev/null
+++ b/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
@@ -0,0 +1,14 @@
+diff --git a/cmd/kubeadm/app/componentconfigs/kubelet.go b/cmd/kubeadm/app/componentconfigs/kubelet.go
+index 436bf1bc87c..6c7c915acd7 100644
+--- a/cmd/kubeadm/app/componentconfigs/kubelet.go
++++ b/cmd/kubeadm/app/componentconfigs/kubelet.go
+@@ -193,7 +193,7 @@ func (kc *kubeletConfig) Default(cfg *kubeadmapi.ClusterConfiguration, _ *kubead
+ kc.config.RotateCertificates = kubeletRotateCertificates
+
+ if len(kc.config.CgroupDriver) == 0 {
+- klog.V(1).Infof("the value of KubeletConfiguration.cgroupDriver is empty; setting it to %q", constants.CgroupDriverSystemd)
+- kc.config.CgroupDriver = constants.CgroupDriverSystemd
++ klog.V(1).Infof("the value of KubeletConfiguration.cgroupDriver is empty; setting it to %q", "cgroupfs")
++ kc.config.CgroupDriver = "cgroupfs"
+ }
+ }
diff --git a/srcpkgs/kubernetes/patches/runit.patch b/srcpkgs/kubernetes/patches/runit.patch
new file mode 100644
index 00000000000000..d7474d855cca8b
--- /dev/null
+++ b/srcpkgs/kubernetes/patches/runit.patch
@@ -0,0 +1,85 @@
+--- a/cmd/kubeadm/app/util/initsystem/initsystem_unix.go
++++ b/cmd/kubeadm/app/util/initsystem/initsystem_unix.go
+@@ -21,6 +21,7 @@ package initsystem
+ import (
+ "fmt"
+ "os/exec"
++ "os"
+ "strings"
+ )
+
+@@ -146,6 +147,63 @@ func (sysd SystemdInitSystem) ServiceIsActive(service string) bool {
+ return false
+ }
+
++// RunitInitSystem defines runit
++type RunitInitSystem struct{}
++
++// EnableCommand return a string describing how to enable a service
++func (runit RunitInitSystem) EnableCommand(service string) string {
++ return fmt.Sprintf("ln -s /etc/sv/%[1]s /var/service/%[1]s", service)
++}
++
++// ServiceExists ensures the service is defined for this init system.
++func (runit RunitInitSystem) ServiceExists(service string) bool {
++ servicePath := string(fmt.Sprintf("/etc/sv/%s/run", service))
++ info, err := os.Stat(servicePath)
++ if os.IsNotExist(err) {
++ return false
++ }
++ return !info.IsDir()
++}
++
++// ServiceIsActive ensures the service is running, or attempting to run. (crash looping in the case of kubelet)
++func (runit RunitInitSystem) ServiceIsActive(service string) bool {
++ args := []string{"status", fmt.Sprintf("/var/service/%s", service)}
++ outBytes, _ := exec.Command("sv", args...).CombinedOutput()
++ outStr := string(outBytes)
++ return strings.HasPrefix(outStr, "run:")
++}
++
++// ServiceIsEnabled ensures the service is enabled to start on each boot.
++func (runit RunitInitSystem) ServiceIsEnabled(service string) bool {
++ servicePath := string(fmt.Sprintf("/var/service/%s/run", service))
++ info, err := os.Stat(servicePath)
++ if os.IsNotExist(err) {
++ return false
++ }
++ return !info.IsDir()
++}
++
++// ServiceRestart tries to reload the environment and restart the specific service
++func (runit RunitInitSystem) ServiceRestart(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"restart", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
++// ServiceStart tries to start a specific service
++func (runit RunitInitSystem) ServiceStart(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"start", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
++// ServiceStop tries to stop a specific service
++func (runit RunitInitSystem) ServiceStop(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"stop", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
+ // GetInitSystem returns an InitSystem for the current system, or nil
+ // if we cannot detect a supported init system.
+ // This indicates we will skip init system checks, not an error.
+@@ -159,6 +217,10 @@ func GetInitSystem() (InitSystem, error) {
+ if err == nil {
+ return &OpenRCInitSystem{}, nil
+ }
++ _, err = exec.LookPath("runit")
++ if err == nil {
++ return &RunitInitSystem{}, nil
++ }
+
+ return nil, fmt.Errorf("no supported init system detected, skipping checking for services")
+ }
diff --git a/srcpkgs/kubernetes/template b/srcpkgs/kubernetes/template
index 4766f97a01740c..025434007d2a6c 100644
--- a/srcpkgs/kubernetes/template
+++ b/srcpkgs/kubernetes/template
@@ -1,9 +1,10 @@
# Template file for 'kubernetes'
pkgname=kubernetes
version=1.32.0
-revision=1
-archs="aarch64* x86_64* ppc64le*"
+revision=2
+archs="aarch64 x86_64*"
build_style=go
+build_helper=qemu
go_import_path="github.com/kubernetes/kubernetes"
hostmakedepends="rsync git go-bindata which curl tar"
depends="kubectl conntrack-tools"
@@ -13,18 +14,35 @@ license="Apache-2.0"
homepage="http://kubernetes.io"
distfiles="https://$go_import_path/archive/v$version.tar.gz"
checksum=3793859c53f09ebc92e013ea858b8916cc19d7fe288ec95882dada4e5a075d08
-nocross=yes
system_accounts="kube"
make_dirs="/var/lib/kubelet 0755 kube kube"
conf_files="/etc/kubernetes/*"
+make_check=no # Too many tests
+
+# Cross builds fail with -fuse-ld=gold
+LDFLAGS="-fuse-ld=bfd"
do_build() {
- make
- hack/generate-docs.sh
+ KUBE_BUILD_PLATFORMS=linux/${GOARCH} make
+
+ # Build the man pages on the host machine
+ # Run in a subshell to keep variables isolated
+ (
+ # Set GO variables based on host
+ case "$XBPS_MACHINE" in
+ aarch64*) export GOARCH=arm64;;
+ x86_64*) export GOARCH=amd64;;
+ esac
+ CGO_CFLAGS=${CFLAGS_host} CC=${GCC_host} CC_target=${GCC_host} \
+ GCC=${GCC_host} GCC_target=${GCC_host} \
+ PATH=$PATH:_output/local/go/bin/linux_${GOARCH} \
+ hack/update-generated-docs.sh
+ )
+
find "_output/local/bin/linux/" -type f -executable | grep "kubectl$" | egrep -v "gen|test" | while read line
do
- $line completion bash > completion.bash
- $line completion zsh > completion.zsh
+ vtargetrun $line completion bash > completion.bash
+ vtargetrun $line completion zsh > completion.zsh
break
done
}
@@ -53,8 +71,18 @@ kubectl_package() {
short_desc="Controls the Kubernetes cluster manager"
pkg_install() {
vmove usr/bin/kubectl
+ vmove usr/bin/kubectl-convert
vmove usr/share/man/man1/kubectl*
vcompletion completion.bash bash
vcompletion completion.zsh zsh
}
}
+
+kubeadm_package() {
+ short_desc="Tool built for creating Kubernetes clusters"
+ pkg_install() {
+ vmove usr/bin/kubeadm
+ vmove usr/share/man/man1/kubeadm*
+ vmkdir etc/kubernetes/manifests
+ }
+}
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PR PATCH] [Updated] kubernetes: Add runit to kubeadm initssytems list
2024-12-13 21:09 [PR PATCH] kubernetes: Add runit to kubeadm initssytems list tsndqst
` (3 preceding siblings ...)
2024-12-14 2:15 ` tsndqst
@ 2025-01-16 14:10 ` tsndqst
2025-01-30 14:51 ` thypon
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: tsndqst @ 2025-01-16 14:10 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 1618 bytes --]
There is an updated pull request by tsndqst against master on the void-packages repository
https://github.com/tsndqst/void-packages kubeadm-runit
https://github.com/void-linux/void-packages/pull/53514
kubernetes: Add runit to kubeadm initssytems list
- Add runit to kubeadm initssytems list (I've been using this patch for 4 years)
- Create kubeadm subpackage.
- Set cgroupfs as default cgroup driver in kubeadm.
- Add example kubelet variables that simulate systemd drop-in. https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/#the-kubelet-drop-in-file-for-systemd
<!-- Uncomment relevant sections and delete options which are not applicable -->
#### Testing the changes
- I tested the changes in this PR: **YES**
<!--
#### New package
- This new package conforms to the [package requirements](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#package-requirements): **YES**|**NO**
-->
<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
- aarch64-glibc
- aarch64-musl
A patch file from https://github.com/void-linux/void-packages/pull/53514.patch is attached
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-kubeadm-runit-53514.patch --]
[-- Type: text/x-diff, Size: 9289 bytes --]
From 564d6b70888ce292af4fee59421c2e2d95ffb3a5 Mon Sep 17 00:00:00 2001
From: Tim Sandquist <tim.sandquist@gmail.com>
Date: Fri, 13 Dec 2024 12:48:26 -0600
Subject: [PATCH] kubernetes: Add runit to kubeadm initssytems list
Create kubeadm subpackage
Set cgroupfs as default cgroup driver in kubeadm
Add example kubelet variables that simulate systemd drop-in
---
srcpkgs/kubeadm | 1 +
srcpkgs/kubernetes/files/environ/kubelet | 10 +++
srcpkgs/kubernetes/files/kubelet/run | 2 +-
.../cgroupfs_default_cgroupDriver.patch | 14 +++
srcpkgs/kubernetes/patches/runit.patch | 85 +++++++++++++++++++
srcpkgs/kubernetes/template | 40 +++++++--
6 files changed, 145 insertions(+), 7 deletions(-)
create mode 120000 srcpkgs/kubeadm
create mode 100644 srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
create mode 100644 srcpkgs/kubernetes/patches/runit.patch
diff --git a/srcpkgs/kubeadm b/srcpkgs/kubeadm
new file mode 120000
index 00000000000000..70cfe557632f08
--- /dev/null
+++ b/srcpkgs/kubeadm
@@ -0,0 +1 @@
+kubernetes
\ No newline at end of file
diff --git a/srcpkgs/kubernetes/files/environ/kubelet b/srcpkgs/kubernetes/files/environ/kubelet
index db93a5eeb42a1b..675ae119350ae2 100644
--- a/srcpkgs/kubernetes/files/environ/kubelet
+++ b/srcpkgs/kubernetes/files/environ/kubelet
@@ -15,3 +15,13 @@ KUBELET_API_SERVER="--api-servers=http://127.0.0.1:8080"
# Add your own!
KUBELET_ARGS=""
+
+# Simulate kubelet drop-in file for systemd
+# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/kubelet-integration/#the-kubelet-drop-in-file-for-systemd
+KUBELET_KUBECONFIG_ARGS="--bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf"
+KUBELET_CONFIG_ARGS="--config=/var/lib/kubelet/config.yaml"
+[ -r /var/lib/kubelet/kubeadm-flags.env ] && . /var/lib/kubelet/kubeadm-flags.env
+[ -r /etc/default/kubelet ] && . /etc/default/kubelet
+
+# Uncomment the next line to make use of the kubelet drop-in variables or set your own $OPTS variable
+#OPTS="$KUBELET_KUBECONFIG_ARGS $KUBELET_CONFIG_ARGS $KUBELET_KUBEADM_ARGS $KUBELET_EXTRA_ARGS"
diff --git a/srcpkgs/kubernetes/files/kubelet/run b/srcpkgs/kubernetes/files/kubelet/run
index 0bea9b4d28f6e8..5c551cce17f05c 100644
--- a/srcpkgs/kubernetes/files/kubelet/run
+++ b/srcpkgs/kubernetes/files/kubelet/run
@@ -2,4 +2,4 @@
exec 2>&1
[ -r /etc/kubernetes/config ] && . /etc/kubernetes/config
[ -r /etc/kubernetes/kubelet ] && . /etc/kubernetes/kubelet
-exec kubelet $OPTS 2>/dev/null
+exec kubelet $OPTS
diff --git a/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch b/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
new file mode 100644
index 00000000000000..84af97117b49c4
--- /dev/null
+++ b/srcpkgs/kubernetes/patches/cgroupfs_default_cgroupDriver.patch
@@ -0,0 +1,14 @@
+diff --git a/cmd/kubeadm/app/componentconfigs/kubelet.go b/cmd/kubeadm/app/componentconfigs/kubelet.go
+index 436bf1bc87c..6c7c915acd7 100644
+--- a/cmd/kubeadm/app/componentconfigs/kubelet.go
++++ b/cmd/kubeadm/app/componentconfigs/kubelet.go
+@@ -193,7 +193,7 @@ func (kc *kubeletConfig) Default(cfg *kubeadmapi.ClusterConfiguration, _ *kubead
+ kc.config.RotateCertificates = kubeletRotateCertificates
+
+ if len(kc.config.CgroupDriver) == 0 {
+- klog.V(1).Infof("the value of KubeletConfiguration.cgroupDriver is empty; setting it to %q", constants.CgroupDriverSystemd)
+- kc.config.CgroupDriver = constants.CgroupDriverSystemd
++ klog.V(1).Infof("the value of KubeletConfiguration.cgroupDriver is empty; setting it to %q", "cgroupfs")
++ kc.config.CgroupDriver = "cgroupfs"
+ }
+ }
diff --git a/srcpkgs/kubernetes/patches/runit.patch b/srcpkgs/kubernetes/patches/runit.patch
new file mode 100644
index 00000000000000..d7474d855cca8b
--- /dev/null
+++ b/srcpkgs/kubernetes/patches/runit.patch
@@ -0,0 +1,85 @@
+--- a/cmd/kubeadm/app/util/initsystem/initsystem_unix.go
++++ b/cmd/kubeadm/app/util/initsystem/initsystem_unix.go
+@@ -21,6 +21,7 @@ package initsystem
+ import (
+ "fmt"
+ "os/exec"
++ "os"
+ "strings"
+ )
+
+@@ -146,6 +147,63 @@ func (sysd SystemdInitSystem) ServiceIsActive(service string) bool {
+ return false
+ }
+
++// RunitInitSystem defines runit
++type RunitInitSystem struct{}
++
++// EnableCommand return a string describing how to enable a service
++func (runit RunitInitSystem) EnableCommand(service string) string {
++ return fmt.Sprintf("ln -s /etc/sv/%[1]s /var/service/%[1]s", service)
++}
++
++// ServiceExists ensures the service is defined for this init system.
++func (runit RunitInitSystem) ServiceExists(service string) bool {
++ servicePath := string(fmt.Sprintf("/etc/sv/%s/run", service))
++ info, err := os.Stat(servicePath)
++ if os.IsNotExist(err) {
++ return false
++ }
++ return !info.IsDir()
++}
++
++// ServiceIsActive ensures the service is running, or attempting to run. (crash looping in the case of kubelet)
++func (runit RunitInitSystem) ServiceIsActive(service string) bool {
++ args := []string{"status", fmt.Sprintf("/var/service/%s", service)}
++ outBytes, _ := exec.Command("sv", args...).CombinedOutput()
++ outStr := string(outBytes)
++ return strings.HasPrefix(outStr, "run:")
++}
++
++// ServiceIsEnabled ensures the service is enabled to start on each boot.
++func (runit RunitInitSystem) ServiceIsEnabled(service string) bool {
++ servicePath := string(fmt.Sprintf("/var/service/%s/run", service))
++ info, err := os.Stat(servicePath)
++ if os.IsNotExist(err) {
++ return false
++ }
++ return !info.IsDir()
++}
++
++// ServiceRestart tries to reload the environment and restart the specific service
++func (runit RunitInitSystem) ServiceRestart(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"restart", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
++// ServiceStart tries to start a specific service
++func (runit RunitInitSystem) ServiceStart(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"start", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
++// ServiceStop tries to stop a specific service
++func (runit RunitInitSystem) ServiceStop(service string) error {
++ servicePath := string(fmt.Sprintf("/var/service/%s", service))
++ args := []string{"stop", servicePath}
++ return exec.Command("sv", args...).Run()
++}
++
+ // GetInitSystem returns an InitSystem for the current system, or nil
+ // if we cannot detect a supported init system.
+ // This indicates we will skip init system checks, not an error.
+@@ -159,6 +217,10 @@ func GetInitSystem() (InitSystem, error) {
+ if err == nil {
+ return &OpenRCInitSystem{}, nil
+ }
++ _, err = exec.LookPath("runit")
++ if err == nil {
++ return &RunitInitSystem{}, nil
++ }
+
+ return nil, fmt.Errorf("no supported init system detected, skipping checking for services")
+ }
diff --git a/srcpkgs/kubernetes/template b/srcpkgs/kubernetes/template
index 33236ff18332a3..3d3cb247c2d51b 100644
--- a/srcpkgs/kubernetes/template
+++ b/srcpkgs/kubernetes/template
@@ -1,9 +1,10 @@
# Template file for 'kubernetes'
pkgname=kubernetes
version=1.32.1
-revision=1
+revision=2
archs="aarch64* x86_64* ppc64le*"
build_style=go
+build_helper=qemu
go_import_path="github.com/kubernetes/kubernetes"
hostmakedepends="rsync git go-bindata which curl tar"
depends="kubectl conntrack-tools"
@@ -13,18 +14,35 @@ license="Apache-2.0"
homepage="http://kubernetes.io"
distfiles="https://$go_import_path/archive/v$version.tar.gz"
checksum=9724c849c524c2e69a0a0da4f1a3b0335d7d544eeaa9fc22cb5b87d7c0c52c9d
-nocross=yes
system_accounts="kube"
make_dirs="/var/lib/kubelet 0755 kube kube"
conf_files="/etc/kubernetes/*"
+make_check=no # Too many tests
+
+# Cross builds fail with -fuse-ld=gold
+LDFLAGS="-fuse-ld=bfd"
do_build() {
- make
- hack/generate-docs.sh
+ KUBE_BUILD_PLATFORMS=linux/${GOARCH} make
+
+ # Build the man pages on the host machine
+ # Run in a subshell to keep variables isolated
+ (
+ # Set GO variables based on host
+ case "$XBPS_MACHINE" in
+ aarch64*) export GOARCH=arm64;;
+ x86_64*) export GOARCH=amd64;;
+ esac
+ CGO_CFLAGS=${CFLAGS_host} CC=${GCC_host} CC_target=${GCC_host} \
+ GCC=${GCC_host} GCC_target=${GCC_host} \
+ PATH=$PATH:_output/local/go/bin/linux_${GOARCH} \
+ hack/update-generated-docs.sh
+ )
+
find "_output/local/bin/linux/" -type f -executable | grep "kubectl$" | egrep -v "gen|test" | while read line
do
- $line completion bash > completion.bash
- $line completion zsh > completion.zsh
+ vtargetrun $line completion bash > completion.bash
+ vtargetrun $line completion zsh > completion.zsh
break
done
}
@@ -53,8 +71,18 @@ kubectl_package() {
short_desc="Controls the Kubernetes cluster manager"
pkg_install() {
vmove usr/bin/kubectl
+ vmove usr/bin/kubectl-convert
vmove usr/share/man/man1/kubectl*
vcompletion completion.bash bash
vcompletion completion.zsh zsh
}
}
+
+kubeadm_package() {
+ short_desc="Tool built for creating Kubernetes clusters"
+ pkg_install() {
+ vmove usr/bin/kubeadm
+ vmove usr/share/man/man1/kubeadm*
+ vmkdir etc/kubernetes/manifests
+ }
+}
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: kubernetes: Add runit to kubeadm initssytems list
2024-12-13 21:09 [PR PATCH] kubernetes: Add runit to kubeadm initssytems list tsndqst
` (4 preceding siblings ...)
2025-01-16 14:10 ` tsndqst
@ 2025-01-30 14:51 ` thypon
2025-01-30 15:14 ` tsndqst
2025-02-24 14:05 ` thypon
7 siblings, 0 replies; 9+ messages in thread
From: thypon @ 2025-01-30 14:51 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 279 bytes --]
New comment by thypon on void-packages repository
https://github.com/void-linux/void-packages/pull/53514#issuecomment-2624710612
Comment:
patch looks good, I'd rather try to upstream the patch instead of merging. I don't have much time to keep the patch up to date on my side!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: kubernetes: Add runit to kubeadm initssytems list
2024-12-13 21:09 [PR PATCH] kubernetes: Add runit to kubeadm initssytems list tsndqst
` (5 preceding siblings ...)
2025-01-30 14:51 ` thypon
@ 2025-01-30 15:14 ` tsndqst
2025-02-24 14:05 ` thypon
7 siblings, 0 replies; 9+ messages in thread
From: tsndqst @ 2025-01-30 15:14 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 341 bytes --]
New comment by tsndqst on void-packages repository
https://github.com/void-linux/void-packages/pull/53514#issuecomment-2624775878
Comment:
Thanks for taking a look @thypon. I can try to get the patch in upstream but I highly doubt they'll take it. There are probably only a handful of people that run kubernetes on a runit init system.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: kubernetes: Add runit to kubeadm initssytems list
2024-12-13 21:09 [PR PATCH] kubernetes: Add runit to kubeadm initssytems list tsndqst
` (6 preceding siblings ...)
2025-01-30 15:14 ` tsndqst
@ 2025-02-24 14:05 ` thypon
7 siblings, 0 replies; 9+ messages in thread
From: thypon @ 2025-02-24 14:05 UTC (permalink / raw)
To: ml
[-- Attachment #1: Type: text/plain, Size: 223 bytes --]
New comment by thypon on void-packages repository
https://github.com/void-linux/void-packages/pull/53514#issuecomment-2678513911
Comment:
I'd rather write a wrapper than a patch, then. I'll take a look next month, again!
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-02-24 14:05 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-13 21:09 [PR PATCH] kubernetes: Add runit to kubeadm initssytems list tsndqst
2024-12-13 21:13 ` tsndqst
2024-12-13 21:29 ` tsndqst
2024-12-14 1:55 ` [PR PATCH] [Updated] " tsndqst
2024-12-14 2:15 ` tsndqst
2025-01-16 14:10 ` tsndqst
2025-01-30 14:51 ` thypon
2025-01-30 15:14 ` tsndqst
2025-02-24 14:05 ` thypon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).