Merge pull request #815 from Random-Liu/support-cmd-for-sandbox-container
Support `Cmd` for sandbox container.
This commit is contained in:
commit
b39546ce2b
@ -344,9 +344,9 @@ func (c *criService) generateSandboxContainerSpec(id string, config *runtime.Pod
|
|||||||
g.SetProcessCwd(imageConfig.WorkingDir)
|
g.SetProcessCwd(imageConfig.WorkingDir)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(imageConfig.Entrypoint) == 0 {
|
if len(imageConfig.Entrypoint) == 0 && len(imageConfig.Cmd) == 0 {
|
||||||
// Pause image must have entrypoint.
|
// Pause image must have entrypoint or cmd.
|
||||||
return nil, errors.Errorf("invalid empty entrypoint in image config %+v", imageConfig)
|
return nil, errors.Errorf("invalid empty entrypoint and cmd in image config %+v", imageConfig)
|
||||||
}
|
}
|
||||||
// Set process commands.
|
// Set process commands.
|
||||||
g.SetProcessArgs(append(imageConfig.Entrypoint, imageConfig.Cmd...))
|
g.SetProcessArgs(append(imageConfig.Entrypoint, imageConfig.Cmd...))
|
||||||
|
@ -128,9 +128,10 @@ func TestGenerateSandboxContainerSpec(t *testing.T) {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"should return error when entrypoint is empty": {
|
"should return error when entrypoint and cmd are empty": {
|
||||||
imageConfigChange: func(c *imagespec.ImageConfig) {
|
imageConfigChange: func(c *imagespec.ImageConfig) {
|
||||||
c.Entrypoint = nil
|
c.Entrypoint = nil
|
||||||
|
c.Cmd = nil
|
||||||
},
|
},
|
||||||
expectErr: true,
|
expectErr: true,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user