forked from LaconicNetwork/kompose
Added Case for Config Map in kompose down.
To implement this, added label in configmap object at the time of init Fixed ConfigMap test because we are adding one more field labels in metadata
This commit is contained in:
parent
f66ba3cee6
commit
52f8f1f2b4
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user