Propagate underscores into valid names

Now we can provide service name with "_" in docker-compose files and they will by converted as "-" in the generated artifacts by kompose eg, if the service name in docker-compose file is "foo_bar" then it will be converted into "foo-bar" in the generated artifacts
This commit is contained in:
Abhishek 2017-03-24 09:53:39 +05:30
parent 99f70109b7
commit 6e0b934f77
2 changed files with 5 additions and 2 deletions

View File

@ -374,7 +374,10 @@ func (c *Compose) LoadFile(files []string) (kobject.KomposeObject, error) {
serviceConfig.Tty = composeServiceConfig.Tty
serviceConfig.MemLimit = composeServiceConfig.MemLimit
serviceConfig.TmpFs = composeServiceConfig.Tmpfs
komposeObject.ServiceConfigs[name] = serviceConfig
komposeObject.ServiceConfigs[normalizeServiceNames(name)] = serviceConfig
if normalizeServiceNames(name) != name {
log.Infof("Service name in docker-compose has been changed from %q to %q", name, normalizeServiceNames(name))
}
}
return komposeObject, nil

View File

@ -637,7 +637,7 @@ func (k *Kubernetes) Deploy(komposeObject kobject.KomposeObject, opt kobject.Con
if !opt.EmptyVols {
pvcStr = " and PersistentVolumeClaims "
}
fmt.Println("We are going to create Kubernetes Deployments, Services" + pvcStr + "for your Dockerized application. \n" +
log.Info("We are going to create Kubernetes Deployments, Services" + pvcStr + "for your Dockerized application. " +
"If you need different kind of resources, use the 'kompose convert' and 'kubectl create -f' commands instead. \n")
client, namespace, err := k.GetKubernetesClient()