aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2024-02-12 14:40:48 +0000
committerGravatar Chris Lovering <[email protected]>2024-02-12 14:40:48 +0000
commitc7af39282441326a56d3510253fa9423a268afee (patch)
tree2c476f27376e6f5a5a691dfd154b8fe84f7f7e59
parentRevert to updated KUBECONFIG secret for deployment (diff)
Use KUBECONFIG env var to determine where to look for kube config file
The const var we're importing here uses os.environ.get('KUBECONFIG', '~/.kube/config') to get the path, which allows us to set the path using the env var.
-rw-r--r--arthur/bot.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/arthur/bot.py b/arthur/bot.py
index 8db850d..8acf6fe 100644
--- a/arthur/bot.py
+++ b/arthur/bot.py
@@ -6,6 +6,7 @@ from typing import Any
from discord import Interaction, Member, User
from discord.ext import commands
from kubernetes_asyncio import config
+from kubernetes_asyncio.config.kube_config import KUBE_CONFIG_DEFAULT_LOCATION
from pydis_core import BotBase
from arthur import exts, logger
@@ -41,7 +42,7 @@ class KingArthur(BotBase):
await super().setup_hook()
# Authenticate with Kubernetes
- if (Path.home() / ".kube/config").exists():
+ if Path(KUBE_CONFIG_DEFAULT_LOCATION).exists():
await config.load_kube_config()
else:
config.load_incluster_config()