test/config/k8s/objects/k8s_config.py
croy 82d417b9e6 New StarlingX Automation Framework
Fresh start for the StarlingX automation framework.

Change-Id: Ie265e0791024f45f71faad6315c2b91b022934d1
2024-11-29 16:01:57 -05:00

25 lines
591 B
Python

import json5
class K8sConfig:
"""
Class to hold configuration of the Cloud Platform's K8s Cluster
"""
def __init__(self, config):
try:
json_data = open(config)
except FileNotFoundError:
print(f"Could not find the k8s config file: {config}")
raise
k8s_dict = json5.load(json_data)
self.kubeconfig = k8s_dict['kubeconfig']
def get_kubeconfig(self) -> str:
"""
Getter for the KUBECONFIG environment variable on the lab where we want to run.
"""
return self.kubeconfig