Skip to content

Commit

Permalink
Add field for Management Cluster in describe cluster for hypershift c…
Browse files Browse the repository at this point in the history
…lusters
  • Loading branch information
fahlmant committed Dec 16, 2022
1 parent 6a7ce27 commit 683aa63
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkg/cluster/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"+
Expand Down Expand Up @@ -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())
}
Expand Down

0 comments on commit 683aa63

Please sign in to comment.