summaryrefslogtreecommitdiff
path: root/src/flufigut.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/flufigut.py')
-rwxr-xr-xsrc/flufigut.py53
1 files changed, 40 insertions, 13 deletions
diff --git a/src/flufigut.py b/src/flufigut.py
index 39d4c71..4100aab 100755
--- a/src/flufigut.py
+++ b/src/flufigut.py
@@ -33,6 +33,7 @@ import os
import sys
import yaml
import jinja2
+import kubernetes
# helper functions ############################################
#
@@ -523,6 +524,31 @@ class Planet:
f.write(planet_xml.encode("utf8"))
f.write(b'\n')
+
+# kubernetes handling #############################
+#
+
+class K8sDeployment:
+
+ def __init__(self, desc, planet):
+ self._desc = desc
+ self._planet = planet
+
+ kubernetes.config.load_kube_config()
+ kubernetes.client.user_agent = 'flufigut'
+
+ def deploy(self):
+ pass
+
+ def wipe(self):
+ pass
+
+ def print_pods(self):
+ v1 = kubernetes.client.CoreV1Api()
+ ret = v1.list_namespaced_pod(namespace=self._desc.globals['name'])
+ for i in ret.items:
+ print("%s\t%s\t%s" % (i.status.pod_ip, i.metadata.namespace, i.metadata.name))
+
# Main ########################################################
#
@@ -549,19 +575,20 @@ if __name__ == '__main__':
print("- " + c)
sys.exit(1)
- p.toXML('../templates/', 'output/planet.xml')
-
- print("****************************************************")
- print("** atmosphere **")
- print("**")
- __pp.pprint(p.atmosphere)
- print("**")
- print("**************************")
- print("** planet **")
- print("**")
- __pp.pprint(p.flow)
- print("**")
- print("****************************************************")
+ # print("****************************************************")
+ # print("** atmosphere **")
+ # print("**")
+ # __pp.pprint(p.atmosphere)
+ # print("**")
+ # print("**************************")
+ # print("** planet **")
+ # print("**")
+ # __pp.pprint(p.flow)
+ # print("**")
+ # print("****************************************************")
+
+ k8s = K8sDeployment(d, p)
+ k8s.print_pods()
except Exception as e:
print("ERROR: while running app: %s" % e)