mirror of https://github.com/k3s-io/k3s
Signed-off-by: Vitor Savian <vitor.savian@suse.com> Added default runtime flag Signed-off-by: Vitor Savian <vitor.savian@suse.com>pull/8962/head
parent
9c6ba42ca0
commit
03532f7c0b
@ -0,0 +1,59 @@
|
||||
apiVersion: node.k8s.io/v1
|
||||
kind: RuntimeClass
|
||||
metadata:
|
||||
name: nvidia
|
||||
handler: nvidia
|
||||
---
|
||||
apiVersion: node.k8s.io/v1
|
||||
kind: RuntimeClass
|
||||
metadata:
|
||||
name: nvidia-experimental
|
||||
handler: nvidia-experimental
|
||||
---
|
||||
apiVersion: node.k8s.io/v1
|
||||
kind: RuntimeClass
|
||||
metadata:
|
||||
name: crun
|
||||
handler: crun
|
||||
---
|
||||
apiVersion: node.k8s.io/v1
|
||||
kind: RuntimeClass
|
||||
metadata:
|
||||
name: lunatic
|
||||
handler: lunatic
|
||||
---
|
||||
apiVersion: node.k8s.io/v1
|
||||
kind: RuntimeClass
|
||||
metadata:
|
||||
name: slight
|
||||
handler: slight
|
||||
---
|
||||
apiVersion: node.k8s.io/v1
|
||||
kind: RuntimeClass
|
||||
metadata:
|
||||
name: spin
|
||||
handler: spin
|
||||
---
|
||||
apiVersion: node.k8s.io/v1
|
||||
kind: RuntimeClass
|
||||
metadata:
|
||||
name: wws
|
||||
handler: wws
|
||||
---
|
||||
apiVersion: node.k8s.io/v1
|
||||
kind: RuntimeClass
|
||||
metadata:
|
||||
name: wasmedge
|
||||
handler: wasmedge
|
||||
---
|
||||
apiVersion: node.k8s.io/v1
|
||||
kind: RuntimeClass
|
||||
metadata:
|
||||
name: wasmer
|
||||
handler: wasmer
|
||||
---
|
||||
apiVersion: node.k8s.io/v1
|
||||
kind: RuntimeClass
|
||||
metadata:
|
||||
name: wasmtime
|
||||
handler: wasmtime
|
@ -1,37 +0,0 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package containerd
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
)
|
||||
|
||||
// findNvidiaContainerRuntimes returns a list of nvidia container runtimes that
|
||||
// are available on the system. It checks install locations used by the nvidia
|
||||
// gpu operator and by system package managers. The gpu operator installation
|
||||
// takes precedence over the system package manager installation.
|
||||
// The given fs.FS should represent the filesystem root directory to search in.
|
||||
func findNvidiaContainerRuntimes(root fs.FS, foundRuntimes runtimeConfigs) {
|
||||
// Check these locations in order. The GPU operator's installation should
|
||||
// take precedence over the package manager's installation.
|
||||
locationsToCheck := []string{
|
||||
"usr/local/nvidia/toolkit", // Path when installing via GPU Operator
|
||||
"usr/bin", // Path when installing via package manager
|
||||
}
|
||||
|
||||
// Fill in the binary location with just the name of the binary,
|
||||
// and check against each of the possible locations. If a match is found,
|
||||
// set the location to the full path.
|
||||
potentialRuntimes := runtimeConfigs{
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "nvidia-container-runtime",
|
||||
},
|
||||
"nvidia-experimental": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "nvidia-container-runtime-experimental",
|
||||
},
|
||||
}
|
||||
findContainerRuntimes(root, potentialRuntimes, locationsToCheck, foundRuntimes)
|
||||
}
|
@ -1,267 +0,0 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package containerd
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"reflect"
|
||||
"testing"
|
||||
"testing/fstest"
|
||||
)
|
||||
|
||||
func Test_UnitFindNvidiaContainerRuntimes(t *testing.T) {
|
||||
executable := &fstest.MapFile{Mode: 0755}
|
||||
type args struct {
|
||||
root fs.FS
|
||||
alreadyFoundRuntimes runtimeConfigs
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want runtimeConfigs
|
||||
}{
|
||||
{
|
||||
name: "No runtimes",
|
||||
args: args{
|
||||
root: fstest.MapFS{},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{},
|
||||
},
|
||||
{
|
||||
name: "Nvidia runtime in /usr/bin",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/nvidia-container-runtime": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/bin/nvidia-container-runtime",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Experimental runtime in /usr/local/nvidia/toolkit",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/local/nvidia/toolkit/nvidia-container-runtime": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/local/nvidia/toolkit/nvidia-container-runtime",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Two runtimes in separate directories",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/nvidia-container-runtime": executable,
|
||||
"usr/local/nvidia/toolkit/nvidia-container-runtime": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/local/nvidia/toolkit/nvidia-container-runtime",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Experimental runtime in /usr/bin",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/nvidia-container-runtime-experimental": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"nvidia-experimental": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/bin/nvidia-container-runtime-experimental",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Same runtime in two directories",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/nvidia-container-runtime-experimental": executable,
|
||||
"usr/local/nvidia/toolkit/nvidia-container-runtime-experimental": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"nvidia-experimental": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/local/nvidia/toolkit/nvidia-container-runtime-experimental",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Both runtimes in /usr/bin",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/nvidia-container-runtime-experimental": executable,
|
||||
"usr/bin/nvidia-container-runtime": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/bin/nvidia-container-runtime",
|
||||
},
|
||||
"nvidia-experimental": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/bin/nvidia-container-runtime-experimental",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Both runtimes in both directories",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/local/nvidia/toolkit/nvidia-container-runtime": executable,
|
||||
"usr/local/nvidia/toolkit/nvidia-container-runtime-experimental": executable,
|
||||
"usr/bin/nvidia-container-runtime": executable,
|
||||
"usr/bin/nvidia-container-runtime-experimental": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/local/nvidia/toolkit/nvidia-container-runtime",
|
||||
},
|
||||
"nvidia-experimental": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/local/nvidia/toolkit/nvidia-container-runtime-experimental",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Both runtimes in /usr/local/nvidia/toolkit",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/local/nvidia/toolkit/nvidia-container-runtime": executable,
|
||||
"usr/local/nvidia/toolkit/nvidia-container-runtime-experimental": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/local/nvidia/toolkit/nvidia-container-runtime",
|
||||
},
|
||||
"nvidia-experimental": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/local/nvidia/toolkit/nvidia-container-runtime-experimental",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Both runtimes in /usr/bin and one duplicate in /usr/local/nvidia/toolkit",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/nvidia-container-runtime": executable,
|
||||
"usr/bin/nvidia-container-runtime-experimental": executable,
|
||||
"usr/local/nvidia/toolkit/nvidia-container-runtime-experimental": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/bin/nvidia-container-runtime",
|
||||
},
|
||||
"nvidia-experimental": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/local/nvidia/toolkit/nvidia-container-runtime-experimental",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Runtime is a directory",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/nvidia-container-runtime": &fstest.MapFile{
|
||||
Mode: fs.ModeDir,
|
||||
},
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{},
|
||||
},
|
||||
{
|
||||
name: "Runtime in both directories, but one is a directory",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/nvidia-container-runtime": executable,
|
||||
"usr/local/nvidia/toolkit/nvidia-container-runtime": &fstest.MapFile{
|
||||
Mode: fs.ModeDir,
|
||||
},
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/bin/nvidia-container-runtime",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Preserve already found runtimes",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/nvidia-container-runtime": executable,
|
||||
"usr/local/nvidia/toolkit/nvidia-container-runtime": &fstest.MapFile{
|
||||
Mode: fs.ModeDir,
|
||||
},
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{
|
||||
"slight": {
|
||||
RuntimeType: "io.containerd.slight.v2",
|
||||
BinaryName: "/opt/kwasm/bin/containerd-shim-slight-v1",
|
||||
},
|
||||
"wasmtime": {
|
||||
RuntimeType: "io.containerd.wasmtime.v2",
|
||||
BinaryName: "/opt/kwasm/bin/containerd-shim-wasmtime-v1",
|
||||
},
|
||||
},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"slight": {
|
||||
RuntimeType: "io.containerd.slight.v2",
|
||||
BinaryName: "/opt/kwasm/bin/containerd-shim-slight-v1",
|
||||
},
|
||||
"wasmtime": {
|
||||
RuntimeType: "io.containerd.wasmtime.v2",
|
||||
BinaryName: "/opt/kwasm/bin/containerd-shim-wasmtime-v1",
|
||||
},
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/bin/nvidia-container-runtime",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
foundRuntimes := tt.args.alreadyFoundRuntimes
|
||||
findNvidiaContainerRuntimes(tt.args.root, foundRuntimes)
|
||||
if !reflect.DeepEqual(foundRuntimes, tt.want) {
|
||||
t.Errorf("findNvidiaContainerRuntimes() = %+v\nWant = %+v", foundRuntimes, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package containerd
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
)
|
||||
|
||||
// findWasiRuntimes returns a list of WebAssembly (WASI) container runtimes that
|
||||
// are available on the system. It checks install locations used by the kwasm
|
||||
// operator and by system package managers. The kwasm operator installation
|
||||
// takes precedence over the system package manager installation.
|
||||
// The given fs.FS should represent the filesystem root directory to search in.
|
||||
func findWasiRuntimes(root fs.FS,
|
||||
foundRuntimes runtimeConfigs,
|
||||
) {
|
||||
// Check these locations in order. The GPU operator's installation should
|
||||
// take precedence over the package manager's installation.
|
||||
locationsToCheck := []string{
|
||||
"opt/kwasm/bin", // Path when installing via kwasm Operator
|
||||
"usr/bin", // Path when installing via package manager
|
||||
"usr/sbin", // Path when installing via package manager
|
||||
}
|
||||
|
||||
// Fill in the binary location with just the name of the binary,
|
||||
// and check against each of the possible locations. If a match is found,
|
||||
// set the location to the full path.
|
||||
potentialRuntimes := runtimeConfigs{
|
||||
"lunatic": {
|
||||
RuntimeType: "io.containerd.lunatic.v2",
|
||||
BinaryName: "containerd-shim-lunatic-v1",
|
||||
},
|
||||
"slight": {
|
||||
RuntimeType: "io.containerd.slight.v2",
|
||||
BinaryName: "containerd-shim-slight-v1",
|
||||
},
|
||||
"spin": {
|
||||
RuntimeType: "io.containerd.spin.v2",
|
||||
BinaryName: "containerd-shim-spin-v1",
|
||||
},
|
||||
"wws": {
|
||||
RuntimeType: "io.containerd.wws.v2",
|
||||
BinaryName: "containerd-shim-wws-v1",
|
||||
},
|
||||
"wasmedge": {
|
||||
RuntimeType: "io.containerd.wasmedge.v2",
|
||||
BinaryName: "containerd-shim-wasmedge-v1",
|
||||
},
|
||||
"wasmer": {
|
||||
RuntimeType: "io.containerd.wasmer.v2",
|
||||
BinaryName: "containerd-shim-wasmer-v1",
|
||||
},
|
||||
"wasmtime": {
|
||||
RuntimeType: "io.containerd.wasmtime.v2",
|
||||
BinaryName: "containerd-shim-wasmtime-v1",
|
||||
},
|
||||
}
|
||||
findContainerRuntimes(root, potentialRuntimes, locationsToCheck, foundRuntimes)
|
||||
}
|
@ -1,199 +0,0 @@
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package containerd
|
||||
|
||||
import (
|
||||
"io/fs"
|
||||
"reflect"
|
||||
"testing"
|
||||
"testing/fstest"
|
||||
)
|
||||
|
||||
func Test_UnitFindWasiRuntimes(t *testing.T) {
|
||||
executable := &fstest.MapFile{Mode: 0755}
|
||||
type args struct {
|
||||
root fs.FS
|
||||
alreadyFoundRuntimes runtimeConfigs
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
args args
|
||||
want runtimeConfigs
|
||||
}{
|
||||
{
|
||||
name: "No runtimes",
|
||||
args: args{
|
||||
root: fstest.MapFS{},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{},
|
||||
},
|
||||
{
|
||||
name: "wasmtime runtime in /usr/sbin",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/sbin/containerd-shim-wasmtime-v1": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"wasmtime": {
|
||||
RuntimeType: "io.containerd.wasmtime.v2",
|
||||
BinaryName: "/usr/sbin/containerd-shim-wasmtime-v1",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "lunatic runtime in /opt/kwasm/bin/",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"opt/kwasm/bin/containerd-shim-lunatic-v1": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"lunatic": {
|
||||
RuntimeType: "io.containerd.lunatic.v2",
|
||||
BinaryName: "/opt/kwasm/bin/containerd-shim-lunatic-v1",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Two runtimes in separate directories",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/containerd-shim-wasmer-v1": executable,
|
||||
"opt/kwasm/bin/containerd-shim-slight-v1": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"slight": {
|
||||
RuntimeType: "io.containerd.slight.v2",
|
||||
BinaryName: "/opt/kwasm/bin/containerd-shim-slight-v1",
|
||||
},
|
||||
"wasmer": {
|
||||
RuntimeType: "io.containerd.wasmer.v2",
|
||||
BinaryName: "/usr/bin/containerd-shim-wasmer-v1",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Same runtime in two directories",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/containerd-shim-wasmedge-v1": executable,
|
||||
"opt/kwasm/bin/containerd-shim-wasmedge-v1": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"wasmedge": {
|
||||
RuntimeType: "io.containerd.wasmedge.v2",
|
||||
BinaryName: "/opt/kwasm/bin/containerd-shim-wasmedge-v1",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "All runtimes in /usr/bin",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"usr/bin/containerd-shim-lunatic-v1": executable,
|
||||
"usr/bin/containerd-shim-slight-v1": executable,
|
||||
"usr/bin/containerd-shim-spin-v1": executable,
|
||||
"usr/bin/containerd-shim-wws-v1": executable,
|
||||
"usr/bin/containerd-shim-wasmedge-v1": executable,
|
||||
"usr/bin/containerd-shim-wasmer-v1": executable,
|
||||
"usr/bin/containerd-shim-wasmtime-v1": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"lunatic": {
|
||||
RuntimeType: "io.containerd.lunatic.v2",
|
||||
BinaryName: "/usr/bin/containerd-shim-lunatic-v1",
|
||||
},
|
||||
"slight": {
|
||||
RuntimeType: "io.containerd.slight.v2",
|
||||
BinaryName: "/usr/bin/containerd-shim-slight-v1",
|
||||
},
|
||||
"spin": {
|
||||
RuntimeType: "io.containerd.spin.v2",
|
||||
BinaryName: "/usr/bin/containerd-shim-spin-v1",
|
||||
},
|
||||
"wws": {
|
||||
RuntimeType: "io.containerd.wws.v2",
|
||||
BinaryName: "/usr/bin/containerd-shim-wws-v1",
|
||||
},
|
||||
"wasmedge": {
|
||||
RuntimeType: "io.containerd.wasmedge.v2",
|
||||
BinaryName: "/usr/bin/containerd-shim-wasmedge-v1",
|
||||
},
|
||||
"wasmer": {
|
||||
RuntimeType: "io.containerd.wasmer.v2",
|
||||
BinaryName: "/usr/bin/containerd-shim-wasmer-v1",
|
||||
},
|
||||
"wasmtime": {
|
||||
RuntimeType: "io.containerd.wasmtime.v2",
|
||||
BinaryName: "/usr/bin/containerd-shim-wasmtime-v1",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Both runtimes in both directories",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"opt/kwasm/bin/containerd-shim-slight-v1": executable,
|
||||
"opt/kwasm/bin/containerd-shim-wasmtime-v1": executable,
|
||||
"usr/bin/containerd-shim-slight-v1": executable,
|
||||
"usr/bin/containerd-shim-wasmtime-v1": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"slight": {
|
||||
RuntimeType: "io.containerd.slight.v2",
|
||||
BinaryName: "/opt/kwasm/bin/containerd-shim-slight-v1",
|
||||
},
|
||||
"wasmtime": {
|
||||
RuntimeType: "io.containerd.wasmtime.v2",
|
||||
BinaryName: "/opt/kwasm/bin/containerd-shim-wasmtime-v1",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Preserve already found runtimes",
|
||||
args: args{
|
||||
root: fstest.MapFS{
|
||||
"opt/kwasm/bin/containerd-shim-wasmtime-v1": executable,
|
||||
},
|
||||
alreadyFoundRuntimes: runtimeConfigs{
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/bin/nvidia-container-runtime",
|
||||
},
|
||||
},
|
||||
},
|
||||
want: runtimeConfigs{
|
||||
"nvidia": {
|
||||
RuntimeType: "io.containerd.runc.v2",
|
||||
BinaryName: "/usr/bin/nvidia-container-runtime",
|
||||
},
|
||||
"wasmtime": {
|
||||
RuntimeType: "io.containerd.wasmtime.v2",
|
||||
BinaryName: "/opt/kwasm/bin/containerd-shim-wasmtime-v1",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
foundRuntimes := tt.args.alreadyFoundRuntimes
|
||||
findWasiRuntimes(tt.args.root, foundRuntimes)
|
||||
if !reflect.DeepEqual(foundRuntimes, tt.want) {
|
||||
t.Errorf("findWasiRuntimes() = %+v\nWant = %+v", foundRuntimes, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Reference in new issue