forked from aws-samples/hardeneks
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(scalability): adding generic get_kube_config and getting cluster…
…s to check
- Loading branch information
Joshua Kurz
committed
Mar 1, 2023
1 parent
f2717bc
commit 7a9e94a
Showing
5 changed files
with
57 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from pathlib import Path | ||
import urllib3 | ||
import yaml | ||
|
||
# | ||
# get_kube_config | ||
# returns kube config in json | ||
# | ||
# we need to update this function to take in a config string, so users can pass in kubeconfig as a param | ||
def get_kube_config(): | ||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | ||
# need to fix this, so user can pass in .kube/config as a param (joshkurz) | ||
kube_config_orig = f"{Path.home()}/.kube/config" | ||
|
||
with open(kube_config_orig, "r") as fd: | ||
kubeconfig = yaml.safe_load(fd) | ||
return kubeconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters