mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-23 15:33:13 +00:00
kind: patch for correct kernal module path
Signed-off-by: Atkins Chang <atkinschang@gmail.com>
This commit is contained in:
parent
b626776ab2
commit
303f9b6b44
@ -13,6 +13,11 @@ buildGoModule rec {
|
||||
sha256 = "sha256-pjg52ONseKNw06EOBzD6Elge+Cz+C3llPvjJPHkn1cw=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# fix kernel module path used by kind
|
||||
./kernel-module-path.patch
|
||||
];
|
||||
|
||||
vendorSha256 = "sha256-HiVdekSZrC/RkMSvcwm1mv6AE4bA5kayUsMdVCbckiE=";
|
||||
|
||||
doCheck = false;
|
||||
|
47
pkgs/development/tools/kind/kernel-module-path.patch
Normal file
47
pkgs/development/tools/kind/kernel-module-path.patch
Normal file
@ -0,0 +1,47 @@
|
||||
diff --git a/pkg/cluster/internal/providers/common/getmodules.go b/pkg/cluster/internal/providers/common/getmodules.go
|
||||
new file mode 100644
|
||||
index 00000000..f42a883d
|
||||
--- /dev/null
|
||||
+++ b/pkg/cluster/internal/providers/common/getmodules.go
|
||||
@@ -0,0 +1,15 @@
|
||||
+package common
|
||||
+
|
||||
+import "os"
|
||||
+
|
||||
+const (
|
||||
+ fhsKernalModulePath = "/lib/modules"
|
||||
+ nixKernalModulePath = "/run/booted-system/kernel-modules/lib"
|
||||
+)
|
||||
+
|
||||
+func GetKernelModulePath() string {
|
||||
+ if _, err := os.Stat(nixKernalModulePath); !os.IsNotExist(err) {
|
||||
+ return nixKernalModulePath
|
||||
+ }
|
||||
+ return fhsKernalModulePath
|
||||
+}
|
||||
diff --git a/pkg/cluster/internal/providers/docker/provision.go b/pkg/cluster/internal/providers/docker/provision.go
|
||||
index 50161861..86d5b7b6 100644
|
||||
--- a/pkg/cluster/internal/providers/docker/provision.go
|
||||
+++ b/pkg/cluster/internal/providers/docker/provision.go
|
||||
@@ -242,7 +242,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()),
|
||||
},
|
||||
args...,
|
||||
)
|
||||
diff --git a/pkg/cluster/internal/providers/podman/provision.go b/pkg/cluster/internal/providers/podman/provision.go
|
||||
index 51dce486..3bc36b42 100644
|
||||
--- a/pkg/cluster/internal/providers/podman/provision.go
|
||||
+++ b/pkg/cluster/internal/providers/podman/provision.go
|
||||
@@ -205,7 +205,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()),
|
||||
},
|
||||
args...,
|
||||
)
|
Loading…
Reference in New Issue
Block a user