@@ -25,14 +25,17 @@ import (
25
25
)
26
26
27
27
const (
28
- configPathEnvName = "FIRECRACKER_CONTAINERD_RUNTIME_CONFIG_PATH"
28
+ // ConfigPathEnvName is the name of the environment variable used to
29
+ // overwrite the default runtime config path
30
+ ConfigPathEnvName = "FIRECRACKER_CONTAINERD_RUNTIME_CONFIG_PATH"
29
31
defaultConfigPath = "/etc/containerd/firecracker-runtime.json"
30
32
defaultKernelArgs = "console=ttyS0 noapic reboot=k panic=1 pci=off nomodules rw"
31
33
defaultFilesPath = "/var/lib/firecracker-containerd/runtime/"
32
34
defaultKernelPath = defaultFilesPath + "default-vmlinux.bin"
33
35
defaultRootfsPath = defaultFilesPath + "default-rootfs.img"
34
36
defaultCPUTemplate = models .CPUTemplateT2
35
37
defaultShimBaseDir = "/var/lib/firecracker-containerd/shim-base"
38
+ runcConfigPath = "/etc/containerd/firecracker-runc-config.json"
36
39
)
37
40
38
41
// Config represents runtime configuration parameters
@@ -60,12 +63,13 @@ type Config struct {
60
63
// TODO: Add netns field
61
64
type JailerConfig struct {
62
65
RuncBinaryPath string `json:"runc_binary_path"`
66
+ RuncConfigPath string `json:"runc_config_path"`
63
67
}
64
68
65
69
// LoadConfig loads configuration from JSON file at 'path'
66
70
func LoadConfig (path string ) (* Config , error ) {
67
71
if path == "" {
68
- path = os .Getenv (configPathEnvName )
72
+ path = os .Getenv (ConfigPathEnvName )
69
73
}
70
74
71
75
if path == "" {
@@ -83,6 +87,9 @@ func LoadConfig(path string) (*Config, error) {
83
87
RootDrive : defaultRootfsPath ,
84
88
CPUTemplate : string (defaultCPUTemplate ),
85
89
ShimBaseDir : defaultShimBaseDir ,
90
+ JailerConfig : JailerConfig {
91
+ RuncConfigPath : runcConfigPath ,
92
+ },
86
93
}
87
94
88
95
if err := json .Unmarshal (data , cfg ); err != nil {
0 commit comments