diff --git a/cmd/server/config.go b/cmd/server/config.go index 482b933e..97de9786 100644 --- a/cmd/server/config.go +++ b/cmd/server/config.go @@ -78,6 +78,7 @@ func DefaultConfig() *server.Config { Root: ocidRoot, SandboxDir: filepath.Join(ocidRoot, "sandboxes"), ContainerDir: filepath.Join(ocidRoot, "containers"), + LogDir: "/var/log/ocid/pods", }, APIConfig: server.APIConfig{ Listen: "/var/run/ocid.sock", diff --git a/server/config.go b/server/config.go index de3a4c72..afdf9551 100644 --- a/server/config.go +++ b/server/config.go @@ -33,6 +33,12 @@ type RootConfig struct { // ContainerDir is the directory where ocid will store all of its container // state and other information. ContainerDir string `toml:"container_dir"` + + // LogDir is the default log directory were all logs will go unless kubelet + // tells us to put them somewhere else. + // + // TODO: This is currently unused until the conmon logging rewrite is done. + LogDir string `toml:"log_dir"` } // APIConfig represents the "ocid.api" TOML config table. diff --git a/server/sandbox.go b/server/sandbox.go index ab428911..6b6fcf92 100644 --- a/server/sandbox.go +++ b/server/sandbox.go @@ -31,7 +31,6 @@ type sandbox struct { } const ( - podInfraRootfs = "/var/lib/ocid/graph/vfs/pause" podDefaultNamespace = "default" ) @@ -141,6 +140,8 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest // creates a spec Generator with the default spec. g := generate.New() + // TODO: Make the `graph/vfs` part of this configurable once the storage + // integration has been merged. podInfraRootfs := filepath.Join(s.config.Root, "graph/vfs/pause") // setup defaults for the pod sandbox g.SetRootPath(filepath.Join(podInfraRootfs, "rootfs")) @@ -156,7 +157,7 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest // set log directory logDir := req.GetConfig().GetLogDirectory() if logDir == "" { - logDir = fmt.Sprintf("/var/log/ocid/pods/%s", id) + logDir = filepath.Join(s.config.LogDir, id) } // set DNS options