mirror of
https://github.com/Rainyy21/k3s-health-dashboard.git
synced 2026-10-11 00:50:20 -04:00
finish the main code
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
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()
|
||||
|
||||
Reference in New Issue
Block a user