runservice: add option to define custom container entrypoint

This commit is contained in:
Simone Gotti 2019-03-13 12:12:32 +01:00
parent 16ac6ada66
commit b05b377d31
4 changed files with 10 additions and 1 deletions

View File

@ -71,6 +71,7 @@ type Container struct {
Environment map[string]string `yaml:"environment,omitempty"` Environment map[string]string `yaml:"environment,omitempty"`
User string `yaml:"user"` User string `yaml:"user"`
Privileged bool `yaml:"privileged"` Privileged bool `yaml:"privileged"`
Entrypoint string `yaml:"entrypoint"`
} }
type Pipeline struct { type Pipeline struct {

View File

@ -37,6 +37,7 @@ func genRuntime(c *config.Config, runtimeName string) *rstypes.Runtime {
Environment: cc.Environment, Environment: cc.Environment,
User: cc.User, User: cc.User,
Privileged: cc.Privileged, Privileged: cc.Privileged,
Entrypoint: cc.Entrypoint,
}) })
} }
return &rstypes.Runtime{ return &rstypes.Runtime{

View File

@ -438,6 +438,12 @@ func (e *Executor) executeTask(ctx context.Context, et *types.ExecutorTask) {
return return
} }
cmd := []string{toolboxContainerPath, "sleeper"}
if et.Containers[0].Entrypoint != "" {
cmd = strings.Split(et.Containers[0].Entrypoint, " ")
log.Infof("cmd: %v", cmd)
}
log.Debugf("starting pod") log.Debugf("starting pod")
podConfig := &driver.PodConfig{ podConfig := &driver.PodConfig{
Labels: createTaskLabels(et.ID), Labels: createTaskLabels(et.ID),
@ -445,7 +451,7 @@ func (e *Executor) executeTask(ctx context.Context, et *types.ExecutorTask) {
Containers: []*driver.ContainerConfig{ Containers: []*driver.ContainerConfig{
{ {
Image: et.Containers[0].Image, Image: et.Containers[0].Image,
Cmd: []string{toolboxContainerPath, "sleeper"}, Cmd: cmd,
Env: et.Containers[0].Environment, Env: et.Containers[0].Environment,
WorkingDir: et.WorkingDir, WorkingDir: et.WorkingDir,
User: et.Containers[0].User, User: et.Containers[0].User,

View File

@ -425,6 +425,7 @@ type Container struct {
Environment map[string]string `json:"environment,omitempty"` Environment map[string]string `json:"environment,omitempty"`
User string `json:"user,omitempty"` User string `json:"user,omitempty"`
Privileged bool `json:"privileged"` Privileged bool `json:"privileged"`
Entrypoint string `json:"entrypoint"`
} }
type Workspace []WorkspaceLevel type Workspace []WorkspaceLevel