48d4c8cc3c
GitOrigin-RevId: 6ef4f522d63f22b40004319778761040d3197390
47 lines
1.9 KiB
Diff
47 lines
1.9 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..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...,
|
|
)
|