Merge pull request #127 from kadel/entrypoint

docker-compose - Entrypoint support
This commit is contained in:
Tomas Kral
2016-09-05 10:50:20 +02:00
committed by GitHub
9 changed files with 124 additions and 23 deletions
-2
View File
@@ -35,7 +35,6 @@ var unsupportedKey = map[string]int{
"DNS": 0,
"DNSSearch": 0,
"DomainName": 0,
"Entrypoint": 0,
"EnvFile": 0,
"Expose": 0,
"Extends": 0,
@@ -146,7 +145,6 @@ type ServiceConfig struct {
CPUQuota int64
CapAdd []string
CapDrop []string
Entrypoint []string
Expose []string
Privileged bool
Restart string
+3
View File
@@ -119,6 +119,7 @@ func (c *Compose) LoadFile(file string) kobject.KomposeObject {
// load compose file into composeObject
composeObject := project.NewProject(&context.Context, nil, nil)
err := composeObject.Parse()
if err != nil {
logrus.Fatalf("Failed to load compose file: %v", err)
@@ -150,6 +151,8 @@ func (c *Compose) LoadFile(file string) kobject.KomposeObject {
serviceConfig := kobject.ServiceConfig{}
serviceConfig.Image = composeServiceConfig.Image
serviceConfig.ContainerName = composeServiceConfig.ContainerName
serviceConfig.Command = composeServiceConfig.Entrypoint
serviceConfig.Args = composeServiceConfig.Command
// load environment variables
envs := loadEnvVars(composeServiceConfig.Environment.ToMap())
+1 -4
View File
@@ -251,9 +251,6 @@ func UpdateKubernetesObjects(name string, service kobject.ServiceConfig, objects
// Configure the environment variables.
envs := ConfigEnvs(name, service)
// Configure the container command.
cmds := transformer.ConfigCommands(service)
// Configure the container volumes.
volumesMount, volumes := ConfigVolumes(service)
@@ -269,7 +266,7 @@ func UpdateKubernetesObjects(name string, service kobject.ServiceConfig, objects
template.Spec.Containers[0].Name = service.ContainerName
}
template.Spec.Containers[0].Env = envs
template.Spec.Containers[0].Command = cmds
template.Spec.Containers[0].Command = service.Command
template.Spec.Containers[0].Args = service.Args
template.Spec.Containers[0].WorkingDir = service.WorkingDir
template.Spec.Containers[0].VolumeMounts = volumesMount
@@ -42,13 +42,12 @@ func newServiceConfig() kobject.ServiceConfig {
Network: []string{"network1", "network2"}, // not supported
Labels: nil,
Annotations: map[string]string{"abc": "def"},
CPUSet: "cpu_set", // not supported
CPUShares: 1, // not supported
CPUQuota: 1, // not supported
CapAdd: []string{"cap_add"}, // not supported
CapDrop: []string{"cap_drop"}, // not supported
Entrypoint: []string{"entrypoint"}, // not supported
Expose: []string{"expose"}, // not supported
CPUSet: "cpu_set", // not supported
CPUShares: 1, // not supported
CPUQuota: 1, // not supported
CapAdd: []string{"cap_add"}, // not supported
CapDrop: []string{"cap_drop"}, // not supported
Expose: []string{"expose"}, // not supported
Privileged: true,
Restart: "always",
User: "user", // not supported
-10
View File
@@ -41,16 +41,6 @@ func CreateOutFile(out string) *os.File {
return f
}
// Configure the container commands
func ConfigCommands(service kobject.ServiceConfig) []string {
var cmds []string
for _, cmd := range service.Command {
cmds = append(cmds, cmd)
}
return cmds
}
// parseVolume parse a given volume, which might be [name:][host:]container[:access_mode]
func ParseVolume(volume string) (name, host, container, mode string, err error) {
separator := ":"