Skip to content

Commit 2e442ea

Browse files
committed
[cri] 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]>
1 parent 3cd1c83 commit 2e442ea

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

pkg/cri/server/helpers_linux.go

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

157157
// openLogFile opens/creates a container log file.
158158
func openLogFile(path string) (*os.File, error) {
159+
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
160+
return nil, err
161+
}
159162
return os.OpenFile(path, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0640)
160163
}
161164

0 commit comments

Comments
 (0)