Skip to content

Commit

Permalink
feat: migrating kubernetes auth logic to library
Browse files Browse the repository at this point in the history
  • Loading branch information
venkatamutyala authored Nov 9, 2023
1 parent b3161a6 commit d1323d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
17 changes: 3 additions & 14 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import requests
from glueops.setup_logging import configure as go_configure_logging
from kubernetes import client, config
import glueops.setup_kubernetes

from src.get_github_api_token import get_github_api_token

Expand All @@ -14,19 +14,8 @@
)

# setting cluster config
try:
config.load_incluster_config()
except Exception as e:
logger.warning(f'Error loading in-cluster k8s config: {e}')
try:
logger.info('Using local Kubeconfig (not in-cluster)')
config.load_kube_config()
except Exception:
logger.exception('Failed to load Kubeconfig from cluster, local file')

# configure kubernetes api clients
v1 = client.CoreV1Api()
custom_api = client.CustomObjectsApi()
v1, custom_api = glueops.setup_kubernetes.load_kubernetes_config(logger)


# set app constants
NAMESPACE = os.getenv(
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
jwt==1.3.1
kubernetes==27.2.0
requests==2.31.0
glueops-helpers @ https://github.com/GlueOps/python-glueops-helpers-library/archive/refs/tags/v0.2.0.zip
glueops-helpers @ https://github.com/GlueOps/python-glueops-helpers-library/archive/refs/tags/v0.3.0.zip

0 comments on commit d1323d5

Please sign in to comment.