Skip to content

Commit

Permalink
specify kubeconfig file
Browse files Browse the repository at this point in the history
When running createrapidk8s.py, you can now specify the kubeconfig file
to be used. Check the help option for this parameter. The parameter is
optional.

Signed-off-by: Luc Provoost <[email protected]>
Change-Id: Ic4b5fcb68cfda1cf39651600d7d40311ffe56c72
  • Loading branch information
LucProvoost committed Nov 25, 2024
1 parent 19d12dd commit c971649
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion VNFs/DPPD-PROX/helper-scripts/rapid/createrapidk8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@
def main():
# Parse command line arguments
argparser = argparse.ArgumentParser()
argparser.add_argument("-k", "--kubeconfig", type = str, required = False,
default = None,
help = "Specify the kubeconfig to be used")

argparser.add_argument("-c", "--clean", action = "store_true",
help = "Terminate pod-rapid-* PODs. "
"Clean up cluster before or after the testing.")
args = argparser.parse_args()

# Create a new deployment
deployment = K8sDeployment()
deployment = K8sDeployment(kubeconfig = args.kubeconfig)

# Load config file with test environment description
deployment.load_create_config(CREATE_CONFIG_FILE_NAME)
Expand Down
4 changes: 2 additions & 2 deletions VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class K8sDeployment:
_namespace = "rapid-testing"
_pods = []

def __init__(self):
def __init__(self, kubeconfig = None):
# Configure logger
self._log = logging.getLogger("k8srapid")
self._log.setLevel(logging.DEBUG)
Expand All @@ -66,7 +66,7 @@ def __init__(self):

# Initialize k8s plugin
try:
config.load_kube_config()
config.load_kube_config(config_file = kubeconfig)
except:
config.load_incluster_config()

Expand Down

0 comments on commit c971649

Please sign in to comment.