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:
Abhishek
2017-03-24 00:31:33 +05:30
parent 123b3144d2
commit 55ad1d9b1f
44 changed files with 1933 additions and 1662 deletions
@@ -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"
},
"annotations": {
"kompose.service.expose": "batman.example.com"
@@ -56,7 +56,7 @@
}
],
"selector": {
"service": "web"
"io.kompose.service": "web"
}
},
"status": {
@@ -76,7 +76,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "redis"
"io.kompose.service": "redis"
}
},
"spec": {
@@ -115,7 +115,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
}
},
"spec": {
@@ -3,6 +3,32 @@
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"ports": [
{
"name": "6379",
"port": 6379,
"targetPort": 6379
}
],
"selector": {
"io.kompose.service": "redis"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Service",
"apiVersion": "v1",
@@ -10,7 +36,7 @@
"name": "web",
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
},
"annotations": {
"kompose.service.expose": "batman.example.com"
@@ -25,7 +51,7 @@
}
],
"selector": {
"service": "web"
"io.kompose.service": "web"
}
},
"status": {
@@ -33,30 +59,40 @@
}
},
{
"kind": "Service",
"apiVersion": "v1",
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"service": "redis"
}
"creationTimestamp": null
},
"spec": {
"ports": [
{
"name": "6379",
"port": 6379,
"targetPort": 6379
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"containers": [
{
"name": "redis",
"image": "redis:3.0",
"ports": [
{
"containerPort": 6379
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
],
"selector": {
"service": "redis"
}
},
"strategy": {}
},
"status": {
"loadBalancer": {}
}
"status": {}
},
{
"kind": "Deployment",
@@ -74,7 +110,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
}
},
"spec": {
@@ -124,42 +160,6 @@
"status": {
"loadBalancer": {}
}
},
{
"kind": "Deployment",
"apiVersion": "extensions/v1beta1",
"metadata": {
"name": "redis",
"creationTimestamp": null
},
"spec": {
"replicas": 1,
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "redis"
}
},
"spec": {
"containers": [
{
"name": "redis",
"image": "redis:3.0",
"ports": [
{
"containerPort": 6379
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
},
"strategy": {}
},
"status": {}
}
]
}
@@ -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"
},
"annotations": {
"kompose.service.expose": "True"
@@ -56,7 +56,7 @@
}
],
"selector": {
"service": "web"
"io.kompose.service": "web"
}
},
"status": {
@@ -76,7 +76,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "redis"
"io.kompose.service": "redis"
}
},
"spec": {
@@ -115,7 +115,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
}
},
"spec": {
@@ -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"
},
"annotations": {
"kompose.service.expose": "True"
@@ -51,7 +51,7 @@
}
],
"selector": {
"service": "web"
"io.kompose.service": "web"
}
},
"status": {
@@ -71,7 +71,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "redis"
"io.kompose.service": "redis"
}
},
"spec": {
@@ -110,7 +110,7 @@
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
}
},
"spec": {
@@ -3,6 +3,32 @@
"apiVersion": "v1",
"metadata": {},
"items": [
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"ports": [
{
"name": "6379",
"port": 6379,
"targetPort": 6379
}
],
"selector": {
"io.kompose.service": "redis"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Service",
"apiVersion": "v1",
@@ -10,7 +36,7 @@
"name": "web",
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
},
"annotations": {
"kompose.service.expose": "batman.example.com"
@@ -30,39 +56,104 @@
}
],
"selector": {
"service": "web"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "Service",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"service": "redis"
}
},
"spec": {
"ports": [
{
"name": "6379",
"port": 6379,
"targetPort": 6379
}
],
"selector": {
"service": "redis"
"io.kompose.service": "web"
}
},
"status": {
"loadBalancer": {}
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"redis"
],
"from": {
"kind": "ImageStreamTag",
"name": "redis:3.0"
}
}
}
],
"replicas": 1,
"test": false,
"selector": {
"io.kompose.service": "redis"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"containers": [
{
"name": "redis",
"image": " ",
"ports": [
{
"containerPort": 6379
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"tags": [
{
"name": "3.0",
"annotations": null,
"from": {
"kind": "DockerImage",
"name": "redis:3.0"
},
"generation": null,
"importPolicy": {}
}
]
},
"status": {
"dockerImageRepository": ""
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
@@ -70,7 +161,7 @@
"name": "web",
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
},
"annotations": {
"kompose.service.expose": "batman.example.com"
@@ -101,13 +192,13 @@
"replicas": 1,
"test": false,
"selector": {
"service": "web"
"io.kompose.service": "web"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
}
},
"spec": {
@@ -137,7 +228,10 @@
"apiVersion": "v1",
"metadata": {
"name": "web",
"creationTimestamp": null
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
}
},
"spec": {
"tags": [
@@ -178,94 +272,6 @@
"status": {
"ingress": null
}
},
{
"kind": "DeploymentConfig",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null,
"labels": {
"service": "redis"
}
},
"spec": {
"strategy": {
"resources": {}
},
"triggers": [
{
"type": "ConfigChange"
},
{
"type": "ImageChange",
"imageChangeParams": {
"automatic": true,
"containerNames": [
"redis"
],
"from": {
"kind": "ImageStreamTag",
"name": "redis:3.0"
}
}
}
],
"replicas": 1,
"test": false,
"selector": {
"service": "redis"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "redis"
}
},
"spec": {
"containers": [
{
"name": "redis",
"image": " ",
"ports": [
{
"containerPort": 6379
}
],
"resources": {}
}
],
"restartPolicy": "Always"
}
}
},
"status": {}
},
{
"kind": "ImageStream",
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null
},
"spec": {
"tags": [
{
"name": "3.0",
"annotations": null,
"from": {
"kind": "DockerImage",
"name": "redis:3.0"
},
"generation": null,
"importPolicy": {}
}
]
},
"status": {
"dockerImageRepository": ""
}
}
]
}
@@ -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"
},
"annotations": {
"kompose.service.expose": "batman.example.com"
@@ -51,7 +51,7 @@
}
],
"selector": {
"service": "web"
"io.kompose.service": "web"
}
},
"status": {
@@ -65,7 +65,7 @@
"name": "redis",
"creationTimestamp": null,
"labels": {
"service": "redis"
"io.kompose.service": "redis"
}
},
"spec": {
@@ -93,13 +93,13 @@
"replicas": 1,
"test": false,
"selector": {
"service": "redis"
"io.kompose.service": "redis"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "redis"
"io.kompose.service": "redis"
}
},
"spec": {
@@ -126,7 +126,10 @@
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"tags": [
@@ -153,7 +156,7 @@
"name": "web",
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
},
"annotations": {
"kompose.service.expose": "batman.example.com"
@@ -184,13 +187,13 @@
"replicas": 1,
"test": false,
"selector": {
"service": "web"
"io.kompose.service": "web"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
}
},
"spec": {
@@ -217,7 +220,10 @@
"apiVersion": "v1",
"metadata": {
"name": "web",
"creationTimestamp": null
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
}
},
"spec": {
"tags": [
@@ -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"
},
"annotations": {
"kompose.service.expose": "True"
@@ -56,7 +56,7 @@
}
],
"selector": {
"service": "web"
"io.kompose.service": "web"
}
},
"status": {
@@ -70,7 +70,7 @@
"name": "redis",
"creationTimestamp": null,
"labels": {
"service": "redis"
"io.kompose.service": "redis"
}
},
"spec": {
@@ -98,13 +98,13 @@
"replicas": 1,
"test": false,
"selector": {
"service": "redis"
"io.kompose.service": "redis"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "redis"
"io.kompose.service": "redis"
}
},
"spec": {
@@ -131,7 +131,10 @@
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"tags": [
@@ -158,7 +161,7 @@
"name": "web",
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
},
"annotations": {
"kompose.service.expose": "True"
@@ -189,13 +192,13 @@
"replicas": 1,
"test": false,
"selector": {
"service": "web"
"io.kompose.service": "web"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
}
},
"spec": {
@@ -225,7 +228,10 @@
"apiVersion": "v1",
"metadata": {
"name": "web",
"creationTimestamp": null
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
}
},
"spec": {
"tags": [
@@ -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"
},
"annotations": {
"kompose.service.expose": "True"
@@ -51,7 +51,7 @@
}
],
"selector": {
"service": "web"
"io.kompose.service": "web"
}
},
"status": {
@@ -65,7 +65,7 @@
"name": "redis",
"creationTimestamp": null,
"labels": {
"service": "redis"
"io.kompose.service": "redis"
}
},
"spec": {
@@ -93,13 +93,13 @@
"replicas": 1,
"test": false,
"selector": {
"service": "redis"
"io.kompose.service": "redis"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "redis"
"io.kompose.service": "redis"
}
},
"spec": {
@@ -126,7 +126,10 @@
"apiVersion": "v1",
"metadata": {
"name": "redis",
"creationTimestamp": null
"creationTimestamp": null,
"labels": {
"io.kompose.service": "redis"
}
},
"spec": {
"tags": [
@@ -153,7 +156,7 @@
"name": "web",
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
},
"annotations": {
"kompose.service.expose": "True"
@@ -184,13 +187,13 @@
"replicas": 1,
"test": false,
"selector": {
"service": "web"
"io.kompose.service": "web"
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"service": "web"
"io.kompose.service": "web"
}
},
"spec": {
@@ -217,7 +220,10 @@
"apiVersion": "v1",
"metadata": {
"name": "web",
"creationTimestamp": null
"creationTimestamp": null,
"labels": {
"io.kompose.service": "web"
}
},
"spec": {
"tags": [