Skip to content

Commit

Permalink
Merge pull request #416 from fahlmant/hypershift-describe-mgmt-cluster
Browse files Browse the repository at this point in the history
Adds Management Cluster field for Hypershift Clusters describe
  • Loading branch information
vkareh authored Dec 16, 2022
2 parents 243caa8 + 683aa63 commit 0f4fd21
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ require (
github.com/nwidger/jsoncolor v0.3.1
github.com/onsi/ginkgo/v2 v2.2.0
github.com/onsi/gomega v1.20.2
github.com/openshift-online/ocm-sdk-go v0.1.287
github.com/openshift/rosa v1.2.7
github.com/openshift-online/ocm-sdk-go v0.1.301
github.com/openshift/rosa v1.2.10
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/spf13/cobra v1.5.0
github.com/spf13/pflag v1.0.5
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,14 @@ github.com/onsi/gomega v1.20.2 h1:8uQq0zMgLEfa0vRrrBgaJF2gyW9Da9BmfGV+OyUzfkY=
github.com/onsi/gomega v1.20.2/go.mod h1:iYAIXgPSaDHak0LCMA+AWBpIKBr8WZicMxnE8luStNc=
github.com/openshift-online/ocm-sdk-go v0.1.287 h1:b8WqqXXZPl5GeUXhbxzQlf5IVjbZFdQbnr9q6b1MKXQ=
github.com/openshift-online/ocm-sdk-go v0.1.287/go.mod h1:KYOw8kAKAHyPrJcQoVR82CneQ4ofC02Na4cXXaTq4Nw=
github.com/openshift-online/ocm-sdk-go v0.1.299 h1:R39Uebs+p32YlBnf+3gVgkbfAs1FC7zz0b84cO9uxmc=
github.com/openshift-online/ocm-sdk-go v0.1.299/go.mod h1:KYOw8kAKAHyPrJcQoVR82CneQ4ofC02Na4cXXaTq4Nw=
github.com/openshift-online/ocm-sdk-go v0.1.301 h1:lfj7d9AIRoCPNSYZ0hTqd74IeuQwFzYRkC0pBdJkjw8=
github.com/openshift-online/ocm-sdk-go v0.1.301/go.mod h1:KYOw8kAKAHyPrJcQoVR82CneQ4ofC02Na4cXXaTq4Nw=
github.com/openshift/rosa v1.2.7 h1:Fgi3RTjlbPPV1HBum92Eag5zYj/vW6qOJaFVtrSQ3bQ=
github.com/openshift/rosa v1.2.7/go.mod h1:ysof8Saj5l6Jv/4Hm4XOukIUQhK4GyOc8gYw0rlCKko=
github.com/openshift/rosa v1.2.10 h1:GJdy55Ypjk6rBOs6Cps8IbAreTmQE0pGLAT74roeoM8=
github.com/openshift/rosa v1.2.10/go.mod h1:oAduttUs4MTqPKXVxHS11T+m514rfY5f7JSBV4U2kqg=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
Expand Down
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 0f4fd21

Please sign in to comment.