Merge pull request #900 from piyush1594/iss_kompose_down

Added Case for Config Map in kompose down
This commit is contained in:
Charlie Drage 2018-01-04 09:11:14 -05:00 committed by GitHub
commit 6b7ba44dfc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 3 deletions

View File

@ -177,7 +177,8 @@ func (k *Kubernetes) InitConfigMap(name string, service kobject.ServiceConfig, o
APIVersion: "v1",
},
ObjectMeta: api.ObjectMeta{
Name: name + "-" + envName,
Name: name + "-" + envName,
Labels: transformer.ConfigLabels(name + "-" + envName),
},
Data: envs,
}
@ -1066,6 +1067,24 @@ func (k *Kubernetes) Undeploy(komposeObject kobject.KomposeObject, opt kobject.C
log.Infof("Successfully deleted Pod: %s", t.Name)
}
}
case *api.ConfigMap:
// delete ConfigMap
configMap, err := client.ConfigMaps(namespace).List(options)
if err != nil {
errorList = append(errorList, err)
break
}
for _, l := range configMap.Items {
if reflect.DeepEqual(l.Labels, komposeLabel) {
err = client.ConfigMaps(namespace).Delete(t.Name)
if err != nil {
errorList = append(errorList, err)
break
}
log.Infof("Successfully deleted ConfigMap: %s", t.Name)
}
}
}
}

View File

@ -113,7 +113,10 @@
"apiVersion": "v1",
"metadata": {
"name": "redis-foo-env",
"creationTimestamp": null
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis-foo-env"
}
},
"data": {
"ALLOW_EMPTY_PASSWORD": "yes"
@ -124,7 +127,10 @@
"apiVersion": "v1",
"metadata": {
"name": "redis-bar-env",
"creationTimestamp": null
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis-bar-env"
}
},
"data": {
"BAR": "FOO",