forked from LaconicNetwork/kompose
delete objects based on label
This PR uses the "SelectorFromSet()" function which takes alabel or selector as an argument returns all the object that uses that label or selector. Once we get the object that uses a particular label we can further do the delete operation on them. This is similar to "kubectl delete <object> --selector=<key>=<value>". Also the label has been modified from service to io.kompose.service.
This commit is contained in:
+6
-6
@@ -10,7 +10,7 @@
|
||||
"name": "redis",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "redis"
|
||||
"io.kompose.service": "redis"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
@@ -22,7 +22,7 @@
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"service": "redis"
|
||||
"io.kompose.service": "redis"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
@@ -36,7 +36,7 @@
|
||||
"name": "web",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "web"
|
||||
"io.kompose.service": "web"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
@@ -48,7 +48,7 @@
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"service": "web"
|
||||
"io.kompose.service": "web"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
@@ -68,7 +68,7 @@
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "redis"
|
||||
"io.kompose.service": "redis"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
@@ -104,7 +104,7 @@
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "web"
|
||||
"io.kompose.service": "web"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
|
||||
+61
-61
@@ -3,33 +3,6 @@
|
||||
"apiVersion": "v1",
|
||||
"metadata": {},
|
||||
"items": [
|
||||
{
|
||||
"kind": "Service",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "worker",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "worker"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"ports": [
|
||||
{
|
||||
"name": "headless",
|
||||
"port": 55555,
|
||||
"targetPort": 0
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"service": "worker"
|
||||
},
|
||||
"clusterIP": "None"
|
||||
},
|
||||
"status": {
|
||||
"loadBalancer": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": "Service",
|
||||
"apiVersion": "v1",
|
||||
@@ -37,7 +10,7 @@
|
||||
"name": "db",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "db"
|
||||
"io.kompose.service": "db"
|
||||
},
|
||||
"annotations": {
|
||||
"com.example.description": "Postgres Database"
|
||||
@@ -52,7 +25,7 @@
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"service": "db"
|
||||
"io.kompose.service": "db"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
@@ -66,7 +39,7 @@
|
||||
"name": "redis",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "redis"
|
||||
"io.kompose.service": "redis"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
@@ -78,7 +51,7 @@
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"service": "redis"
|
||||
"io.kompose.service": "redis"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
@@ -92,7 +65,7 @@
|
||||
"name": "result",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "result"
|
||||
"io.kompose.service": "result"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
@@ -104,7 +77,7 @@
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"service": "result"
|
||||
"io.kompose.service": "result"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
@@ -118,7 +91,7 @@
|
||||
"name": "vote",
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "vote"
|
||||
"io.kompose.service": "vote"
|
||||
},
|
||||
"annotations": {
|
||||
"com.example.description": "Vote"
|
||||
@@ -133,7 +106,7 @@
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"service": "vote"
|
||||
"io.kompose.service": "vote"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
@@ -141,35 +114,31 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": "Deployment",
|
||||
"apiVersion": "extensions/v1beta1",
|
||||
"kind": "Service",
|
||||
"apiVersion": "v1",
|
||||
"metadata": {
|
||||
"name": "worker",
|
||||
"creationTimestamp": null
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "worker"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"replicas": 1,
|
||||
"template": {
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "worker"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "worker",
|
||||
"image": "docker/example-voting-app-worker",
|
||||
"resources": {}
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Always"
|
||||
"ports": [
|
||||
{
|
||||
"name": "headless",
|
||||
"port": 55555,
|
||||
"targetPort": 0
|
||||
}
|
||||
],
|
||||
"selector": {
|
||||
"io.kompose.service": "worker"
|
||||
},
|
||||
"strategy": {}
|
||||
"clusterIP": "None"
|
||||
},
|
||||
"status": {}
|
||||
"status": {
|
||||
"loadBalancer": {}
|
||||
}
|
||||
},
|
||||
{
|
||||
"kind": "Deployment",
|
||||
@@ -187,7 +156,7 @@
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "db"
|
||||
"io.kompose.service": "db"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
@@ -223,7 +192,7 @@
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "redis"
|
||||
"io.kompose.service": "redis"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
@@ -259,7 +228,7 @@
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "result"
|
||||
"io.kompose.service": "result"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
@@ -298,7 +267,7 @@
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"service": "vote"
|
||||
"io.kompose.service": "vote"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
@@ -320,6 +289,37 @@
|
||||
"strategy": {}
|
||||
},
|
||||
"status": {}
|
||||
},
|
||||
{
|
||||
"kind": "Deployment",
|
||||
"apiVersion": "extensions/v1beta1",
|
||||
"metadata": {
|
||||
"name": "worker",
|
||||
"creationTimestamp": null
|
||||
},
|
||||
"spec": {
|
||||
"replicas": 1,
|
||||
"template": {
|
||||
"metadata": {
|
||||
"creationTimestamp": null,
|
||||
"labels": {
|
||||
"io.kompose.service": "worker"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
"containers": [
|
||||
{
|
||||
"name": "worker",
|
||||
"image": "docker/example-voting-app-worker",
|
||||
"resources": {}
|
||||
}
|
||||
],
|
||||
"restartPolicy": "Always"
|
||||
}
|
||||
},
|
||||
"strategy": {}
|
||||
},
|
||||
"status": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user