Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Azure MC name as parameter because of kubectl context #35

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions libs/platforms/azure/hypershiftcli/hypershiftcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def __init__(self, arguments, logging, utils, es):
self.environment["workers"] = arguments["workers"]
self.environment["mc_kubeconfig"] = arguments["mc_kubeconfig"]
self.environment["mc_resource_group"] = arguments["mc_az_resource_group"]
self.environment['mgmt_cluster_name'] = arguments["mc_cluster_name"]

def initialize(self):
super().initialize()
Expand All @@ -44,14 +45,6 @@ def initialize(self):
self.logging.error(f"Failed to list hosted clusters using {self.environment['mc_kubeconfig']} file")
sys.exit("Exiting...")
else:
cluster_info_code, cluster_info_out, cluster_info_err = self.utils.subprocess_exec("kubectl config view -o json", extra_params={"env": myenv, "universal_newlines": True}, log_output=False)
try:
cluster_info_json = json.loads(cluster_info_out)
except Exception as err:
self.logging.debug(f"Cannot load cluster info using {self.environment['mc_kubeconfig']} file")
sys.exit("Exiting...")
self.logging.debug(err)
self.environment['mgmt_cluster_name'] = cluster_info_json['current-context']
self.logging.info(f"Access to MC cluster {self.environment['mgmt_cluster_name']} verified using {self.environment['mc_kubeconfig']} file")

def platform_cleanup(self):
Expand Down Expand Up @@ -533,6 +526,7 @@ def __init__(self, parser, config_file, environment):
super().__init__(parser, config_file, environment)
EnvDefault = self.EnvDefault

parser.add_argument("--mc-cluster-name", action=EnvDefault, env=environment, envvar="HCP_BURNER_AZURE_MC_CLUSTER_NAME", default='aro-hcp-mgmt-cluster', help="Azure cluster name of the MC Cluster")
parser.add_argument("--mc-kubeconfig", action=EnvDefault, env=environment, envvar="HCP_BURNER_AZURE_MC_KUBECONFIG", help="Kubeconfig file for the MC Cluster")
parser.add_argument("--mc-az-resource-group", action=EnvDefault, env=environment, envvar="HCP_BURNER_AZURE_MC_RESOURCE_GROUP", help="Azure Resource group where MC is installed")

Expand Down
Loading