Files
k3s-health-dashboard/app/k8s_client.py
T
2026-04-28 13:11:31 -04:00

16 lines
428 B
Python

import os
import kubernetes import client, config
def get_core_client() -> client.CoreV1Api:
if os.getenv("IN_CLUSTER"):
config.load_incluster_config()
else:
config.load_kube_config( # runs locally
config_file=os.getenv("KUBECONFIG", "~/.kube/config")
)
return client.CoreV1Api()
def get_custom_client() -> client.CustomObjectsApi:
return client.CustomObjectsApi()