Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit 8b859cb

Browse files
committed
Ensure log dir is created
containerd is responsible for creating the log but there is no code to ensure that the log dir exists. While kubelet should have created this there can be times where this is not the case and this can cause stuck tasks. Signed-off-by: Michael Crosby <[email protected]> (cherry picked from commit containerd/containerd@2e442ea) Signed-off-by: Shengjing Zhu <[email protected]>
1 parent 779131a commit 8b859cb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

pkg/server/helpers_unix.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ func (c *criService) seccompEnabled() bool {
151151

152152
// openLogFile opens/creates a container log file.
153153
func openLogFile(path string) (*os.File, error) {
154+
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
155+
return nil, err
156+
}
154157
return os.OpenFile(path, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0640)
155158
}
156159

0 commit comments

Comments
 (0)