Files
test/config/k8s/objects/k8s_config.py
Gabriel Calixto de Paula f6df9c2d6e add k8s_dashboard_access part_6 setup done
setup steps for the dashboard are done:
-setup files are copied to lab
-the yaml files are applied and the HTTPS certificate is created for the
dashboard URL
-URL is working and it's reachable

Change-Id: Id249786c31d46348c2160ec8d627bb22320aa9cf
Signed-off-by: Gabriel Calixto de Paula <gabrielcalixto9@gmail.com>
2025-03-07 13:48:00 -05:00

32 lines
816 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"]
self.dashboard_port = k8s_dict["dashboard_port"]
def get_kubeconfig(self) -> str:
"""
Getter for the KUBECONFIG environment variable on the lab where we want to run.
"""
return self.kubeconfig
def get_dashboard_port(self) -> str:
"""
Getter for the port on which the K8s dashboard is running.
"""
return self.dashboard_port