summaryrefslogtreecommitdiffstats
path: root/clover/orchestration
diff options
context:
space:
mode:
authorStephen Wong <stephen.kf.wong@gmail.com>2018-04-18 16:27:59 -0700
committerStephen Wong <stephen.kf.wong@gmail.com>2018-04-23 23:27:19 -0700
commit6c5d33ba097c7cce07487db5a6fa306cb0e9cc8f (patch)
tree796b3f2bdee422fedf2d70d1120497b0c8036431 /clover/orchestration
parent867c4309a10df56eeb5098a78956e5d6951b8ba4 (diff)
Experimental commit for A-B testing with Clover Fraser release
and on the SDC application Change-Id: I6e1bd84a6d674a2c4c4484722b20415f5402a59c Signed-off-by: Stephen Wong <stephen.kf.wong@gmail.com>
Diffstat (limited to 'clover/orchestration')
-rw-r--r--clover/orchestration/kube_client.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/clover/orchestration/kube_client.py b/clover/orchestration/kube_client.py
index e5f1d89..f7fa708 100644
--- a/clover/orchestration/kube_client.py
+++ b/clover/orchestration/kube_client.py
@@ -31,9 +31,28 @@ class KubeClient(object):
ret_dict[svc.metadata.name] = {}
ret_dict[svc.metadata.name]['labels'] = svc.metadata.labels
ret_dict[svc.metadata.name]['selector'] = svc.spec.selector
+ ret_dict[svc.metadata.name]['cluster_ip'] = svc.spec.cluster_ip
return ret_dict
+ def find_pod_by_name(self, pod_name, namespace='default'):
+ ret_dict = {}
+ try:
+ pod = self.core_v1.read_namespaced_pod(name=pod_name,
+ namespace=namespace)
+ except client.rest.ApiException:
+ pod = None
+ if not pod:
+ print('found no pod %s in namespace %s' \
+ % (pod_name, namespace))
+ return None
+ ret_dict['name'] = pod_name
+ ret_dict['labels'] = pod.metadata.labels
+ ret_dict['pod_ip'] = pod.status.pod_ip
+
+ return ret_dict
+
+
def find_pod_by_namespace(self, namespace='default'):
ret_dict = {}
pods = self.core_v1.list_namespaced_pod(namespace=namespace)