mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-10 08:56:47 +00:00
Allow alternative runtimes for functions
By setting FUNCTION_RUNTIME, in theory an alternative container runtime could be used such as libkrun or kata. In practice, other changes are required like using the VM network. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
parent
dca036ee51
commit
5a7a5b2d6d
@ -140,10 +140,7 @@ func deploy(ctx context.Context, req types.FunctionDeployment, client *container
|
|||||||
memory.Limit = &v
|
memory.Limit = &v
|
||||||
}
|
}
|
||||||
|
|
||||||
container, err := client.NewContainer(
|
ctrOps := []containerd.NewContainerOpts{containerd.WithImage(image),
|
||||||
ctx,
|
|
||||||
name,
|
|
||||||
containerd.WithImage(image),
|
|
||||||
containerd.WithSnapshotter(snapshotter),
|
containerd.WithSnapshotter(snapshotter),
|
||||||
containerd.WithNewSnapshot(name+"-snapshot", image),
|
containerd.WithNewSnapshot(name+"-snapshot", image),
|
||||||
containerd.WithNewSpec(oci.WithImageConfig(image),
|
containerd.WithNewSpec(oci.WithImageConfig(image),
|
||||||
@ -152,7 +149,16 @@ func deploy(ctx context.Context, req types.FunctionDeployment, client *container
|
|||||||
oci.WithMounts(mounts),
|
oci.WithMounts(mounts),
|
||||||
oci.WithEnv(envs),
|
oci.WithEnv(envs),
|
||||||
withMemory(memory)),
|
withMemory(memory)),
|
||||||
containerd.WithContainerLabels(labels),
|
containerd.WithContainerLabels(labels)}
|
||||||
|
|
||||||
|
if v, ok := os.LookupEnv("FUNCTION_RUNTIME"); ok && len(v) > 0 {
|
||||||
|
ctrOps = append(ctrOps, containerd.WithRuntime(v, nil))
|
||||||
|
}
|
||||||
|
|
||||||
|
container, err := client.NewContainer(
|
||||||
|
ctx,
|
||||||
|
name,
|
||||||
|
ctrOps...,
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user