From 683aa63830e22e809109c755ae294841b073369b Mon Sep 17 00:00:00 2001 From: Taylor Fahlman Date: Fri, 16 Dec 2022 10:15:46 -0500 Subject: [PATCH] Add field for Management Cluster in describe cluster for hypershift clusters --- pkg/cluster/describe.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkg/cluster/describe.go b/pkg/cluster/describe.go index 80b95cd7..719fd8ad 100644 --- a/pkg/cluster/describe.go +++ b/pkg/cluster/describe.go @@ -157,6 +157,18 @@ func PrintClusterDescription(connection *sdk.Connection, cluster *cmv1.Cluster) isExistingVPC = "true" } + // Check Hypershift-related values + mgmtCluster := "" + if cluster.Hypershift().Enabled() { + // Ignorning the error here as this endpoint is behind a specific permissioon + hypershiftResp, _ := connection.ClustersMgmt().V1().Clusters(). + Cluster(cluster.ID()). + Hypershift(). + Get(). + Send() + mgmtCluster = hypershiftResp.Body().ManagementCluster() + } + // Print short cluster description: fmt.Printf("\n"+ "ID: %s\n"+ @@ -226,6 +238,10 @@ func PrintClusterDescription(connection *sdk.Connection, cluster *cmv1.Cluster) if shard != "" { fmt.Printf("Shard: %v\n", shard) } + // This should be mutually exclusive with shard as it's hypershift specific + if mgmtCluster != "" { + fmt.Printf("Management Cluster: %s\n", mgmtCluster) + } if cluster.Proxy().HTTPProxy() != "" { fmt.Printf("HTTPProxy: %s\n", cluster.Proxy().HTTPProxy()) }