nixpkgs/pkgs/development/tools/kind/kernel-module-path.patch
Maxine Aubrey 5b062820b6
kind: 0.11.1 -> 0.14.0
- https://github.com/kubernetes-sigs/kind/releases/tag/v0.12.0
- https://github.com/kubernetes-sigs/kind/releases/tag/v0.13.0
- https://github.com/kubernetes-sigs/kind/releases/tag/v0.14.0

Changes:
- update/fix nixos specific kernel module path patch
- change build options to match upstream
- pin major go version to match upstream
2022-05-26 22:09:55 +02:00

48 lines
2.1 KiB
Diff

diff --git a/pkg/cluster/internal/providers/common/getmodules.go b/pkg/cluster/internal/providers/common/getmodules.go
new file mode 100644
index 00000000..1cce5675
--- /dev/null
+++ b/pkg/cluster/internal/providers/common/getmodules.go
@@ -0,0 +1,15 @@
+package common
+
+import "os"
+
+const (
+ fhsKernelModulePath = "/lib/modules"
+ nixKernelModulePath = "/run/booted-system/kernel-modules/lib/modules"
+)
+
+func GetKernelModulePath() string {
+ if _, err := os.Stat(nixKernelModulePath); !os.IsNotExist(err) {
+ return nixKernelModulePath
+ }
+ return fhsKernelModulePath
+}
diff --git a/pkg/cluster/internal/providers/docker/provision.go b/pkg/cluster/internal/providers/docker/provision.go
index 97b05594..3aaa9830 100644
--- a/pkg/cluster/internal/providers/docker/provision.go
+++ b/pkg/cluster/internal/providers/docker/provision.go
@@ -225,7 +225,7 @@ func runArgsForNode(node *config.Node, clusterIPFamily config.ClusterIPFamily, n
// (please don't depend on doing this though!)
"--volume", "/var",
// some k8s things want to read /lib/modules
- "--volume", "/lib/modules:/lib/modules:ro",
+ "--volume", fmt.Sprintf("%s:/lib/modules:ro", common.GetKernelModulePath()),
// propagate KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER to the entrypoint script
"-e", "KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER",
},
diff --git a/pkg/cluster/internal/providers/podman/provision.go b/pkg/cluster/internal/providers/podman/provision.go
index 50aa7018..7e25a4de 100644
--- a/pkg/cluster/internal/providers/podman/provision.go
+++ b/pkg/cluster/internal/providers/podman/provision.go
@@ -189,7 +189,7 @@ func runArgsForNode(node *config.Node, clusterIPFamily config.ClusterIPFamily, n
// dev: devices on the volume will be able to be used by processes within the container
"--volume", fmt.Sprintf("%s:/var:suid,exec,dev", varVolume),
// some k8s things want to read /lib/modules
- "--volume", "/lib/modules:/lib/modules:ro",
+ "--volume", fmt.Sprintf("%s:/lib/modules:ro", common.GetKernelModulePath()),
// propagate KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER to the entrypoint script
"-e", "KIND_EXPERIMENTAL_CONTAINERD_SNAPSHOTTER",
},