|
|
|
@ -77,7 +77,7 @@ def get_ingresses(api, namespace): |
|
|
|
|
def json_dump(object_list): |
|
|
|
|
return json.dumps(object_list) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def print_list(k8s_object_list): |
|
|
|
|
_k8s_object_list = [] |
|
|
|
|
for k8s_object in k8s_object_list.items: |
|
|
|
@ -105,22 +105,10 @@ def get_client(kubeconfig, context): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
k8s_types = { |
|
|
|
|
"deployments": { |
|
|
|
|
"function": get_deployments, |
|
|
|
|
"api": get_extensions |
|
|
|
|
}, |
|
|
|
|
"services": { |
|
|
|
|
"function": get_services, |
|
|
|
|
"api": get_core_api_v1 |
|
|
|
|
}, |
|
|
|
|
"pods": { |
|
|
|
|
"function": get_pods, |
|
|
|
|
"api": get_core_api_v1 |
|
|
|
|
}, |
|
|
|
|
"ingresses": { |
|
|
|
|
"function": get_ingresses, |
|
|
|
|
"api": get_extensions |
|
|
|
|
} |
|
|
|
|
"deployments": {"function": get_deployments, "api": get_extensions}, |
|
|
|
|
"services": {"function": get_services, "api": get_core_api_v1}, |
|
|
|
|
"pods": {"function": get_pods, "api": get_core_api_v1}, |
|
|
|
|
"ingresses": {"function": get_ingresses, "api": get_extensions}, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -130,7 +118,9 @@ def main(): |
|
|
|
|
api = None |
|
|
|
|
if parser.type in k8s_types.keys(): |
|
|
|
|
api = k8s_types[parser.type]["api"](_client) |
|
|
|
|
k8s_object_list = k8s_types[parser.type]["function"](api, parser.namespace) |
|
|
|
|
k8s_object_list = k8s_types[parser.type]["function"]( |
|
|
|
|
api, parser.namespace |
|
|
|
|
) |
|
|
|
|
print_list(k8s_object_list) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|