Merge pull request #1141 from hangyan/container-name

Fix container_name set error
This commit is contained in:
Kubernetes Prow Robot
2019-06-20 09:04:48 -07:00
committed by GitHub
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -380,7 +380,7 @@ func (k *Kubernetes) UpdateKubernetesObjects(name string, service kobject.Servic
// fillTemplate fills the pod template with the value calculated from config
fillTemplate := func(template *api.PodTemplateSpec) error {
if len(service.ContainerName) > 0 {
template.Spec.Containers[0].Name = service.ContainerName
template.Spec.Containers[0].Name = FormatContainerName(service.ContainerName)
}
template.Spec.Containers[0].Env = envs
template.Spec.Containers[0].Command = service.Command
@@ -650,3 +650,10 @@ func FormatFileName(name string) string {
envName = strings.Replace(envName, "_", "-", -1)
return envName
}
//FormatContainerName format Container name
func FormatContainerName(name string) string {
name = strings.Replace(name, "_", "-", -1)
return name
}
+1 -1
View File
@@ -15,7 +15,7 @@ services:
command: bundle exec thin -p 3000
# command: ["bundle", "exec", "thin", "-p", "3000"]
container_name: my-web-container
container_name: my_web-container
depends_on:
- db