Skip to content

Commit

Permalink
Merge branch 'main' into brew-readme-update
Browse files Browse the repository at this point in the history
  • Loading branch information
LeaveMyYard authored May 15, 2023
2 parents 222eac8 + 4b1b389 commit 3d19717
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions robusta_krr/core/models/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Any, Literal, Optional, Union

import sys
import pydantic as pd
from kubernetes import config
from kubernetes.config.config_exception import ConfigException
Expand All @@ -9,10 +10,16 @@

try:
config.load_incluster_config()
IN_CLUSTER = True
except ConfigException:
config.load_kube_config()
try:
config.load_kube_config()
except ConfigException:
print("[CRITICAL] Could not load kubernetes configuration. Do you have kubeconfig set up?")
sys.exit(1)

IN_CLUSTER = False
else:
IN_CLUSTER = True


class Config(pd.BaseSettings):
Expand Down

0 comments on commit 3d19717

Please sign in to comment.