mirror of
https://github.com/Rainyy21/k3s-health-dashboard.git
synced 2026-10-10 23:00:19 -04:00
16 lines
428 B
Python
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()
|
|
|