Fix container_name incorrectly being generated

Checks to see if "container_name" is used correctly in a docker-compose
file conversion and updates the changes respectively in the outputted
artifact files.

For example with container_name set as myfoobarname, the change will
correctly update the "containerNames" portion of the deployment-config
for OpenShift.

"imageChangeParams": {
  "automatic": true,
  "containerNames": [
    "myfoobarname"
  ],
  "from": {
    "kind": "ImageStreamTag",
    "name": "rabbit:3.6.1"
  }
}

Closes https://github.com/kubernetes-incubator/kompose/issues/301
This commit is contained in:
Charlie Drage
2016-12-08 13:49:11 -05:00
parent 04a3131834
commit ee2946c810
2 changed files with 70 additions and 1 deletions
+7 -1
View File
@@ -88,6 +88,12 @@ func (o *OpenShift) initImageStream(name string, service kobject.ServiceConfig)
// initDeploymentConfig initialize OpenShifts DeploymentConfig object
func (o *OpenShift) initDeploymentConfig(name string, service kobject.ServiceConfig, replicas int) *deployapi.DeploymentConfig {
tag := getImageTag(service.Image)
containerName := []string{name}
// Use ContainerName if it was set
if service.ContainerName != "" {
containerName = []string{service.ContainerName}
}
dc := &deployapi.DeploymentConfig{
TypeMeta: unversioned.TypeMeta{
@@ -126,7 +132,7 @@ func (o *OpenShift) initDeploymentConfig(name string, service kobject.ServiceCon
ImageChangeParams: &deployapi.DeploymentTriggerImageChangeParams{
//Automatic - if new tag is detected - update image update inside the pod template
Automatic: true,
ContainerNames: []string{name},
ContainerNames: containerName,
From: api.ObjectReference{
Name: name + ":" + tag,
Kind: "ImageStreamTag",