Add k8s client - test
This commit is contained in:
parent
6b8562662c
commit
71ee0cfe7c
5
main.py
5
main.py
@ -13,10 +13,15 @@ from routes import *
|
|||||||
from logging import error, info
|
from logging import error, info
|
||||||
from subprocess import STDOUT, CalledProcessError, check_output
|
from subprocess import STDOUT, CalledProcessError, check_output
|
||||||
from itertools import islice
|
from itertools import islice
|
||||||
|
from kubernetes import client, config
|
||||||
|
|
||||||
app.register_blueprint(routes)
|
app.register_blueprint(routes)
|
||||||
|
|
||||||
def get_namespaces():
|
def get_namespaces():
|
||||||
|
config.load_incluster_config()
|
||||||
|
v1 = client.Corev1Api()
|
||||||
|
ns = v1.list_namespace()
|
||||||
|
print(ns)
|
||||||
command = "/usr/local/bin/kubectl get ns -ojson"
|
command = "/usr/local/bin/kubectl get ns -ojson"
|
||||||
info(f"Running command: {command}")
|
info(f"Running command: {command}")
|
||||||
try:
|
try:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user