From ff1c142e437d5c463103b00c81123cb6cbdef5cf Mon Sep 17 00:00:00 2001 From: Jakob Gray <20209054+JakobGray@users.noreply.github.com> Date: Fri, 2 Feb 2024 10:43:12 -0500 Subject: [PATCH] Display only platform-relevant field in cluster describe Hide AWS-specific fields from GCP cluster describe and vice versa. --- pkg/cluster/describe.go | 45 +++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/pkg/cluster/describe.go b/pkg/cluster/describe.go index 0d29f691..294e934b 100644 --- a/pkg/cluster/describe.go +++ b/pkg/cluster/describe.go @@ -219,16 +219,35 @@ func PrintClusterDescription(connection *sdk.Connection, cluster *cmv1.Cluster) cluster.MultiAZ(), ) - // secureboot - if cluster.GCP().Security().SecureBoot() { - fmt.Printf("SecureBoot: %t\n", cluster.GCP().Security().SecureBoot()) + // AWS-specific info + if cluster.CloudProvider().ID() == ProviderAWS { + fmt.Printf("PrivateLink: %t\n"+ + "STS: %t\n"+ + "Subnet IDs: %s\n", + privateLinkEnabled, + stsEnabled, + cluster.AWS().SubnetIDs(), + ) + } + + // GCP-specific info + if cluster.CloudProvider().ID() == ProviderGCP { + if cluster.GCP().Security().SecureBoot() { + fmt.Printf("SecureBoot: %t\n", cluster.GCP().Security().SecureBoot()) + } + if cluster.GCPNetwork().VPCName() != "" { + fmt.Printf("VPC-Name: %s\n", cluster.GCPNetwork().VPCName()) + } + if cluster.GCPNetwork().ControlPlaneSubnet() != "" { + fmt.Printf("Control-Plane-Subnet: %s\n", cluster.GCPNetwork().ControlPlaneSubnet()) + } + if cluster.GCPNetwork().ComputeSubnet() != "" { + fmt.Printf("Compute-Subnet: %s\n", cluster.GCPNetwork().ComputeSubnet()) + } } fmt.Printf("CCS: %t\n"+ "HCP: %t\n"+ - "Subnet IDs: %s\n"+ - "PrivateLink: %t\n"+ - "STS: %t\n"+ "Existing VPC: %s\n"+ "Channel Group: %v\n"+ "Cluster Admin: %t\n"+ @@ -239,9 +258,6 @@ func PrintClusterDescription(connection *sdk.Connection, cluster *cmv1.Cluster) "Created: %v\n", cluster.CCS().Enabled(), cluster.Hypershift().Enabled(), - cluster.AWS().SubnetIDs(), - privateLinkEnabled, - stsEnabled, isExistingVPC, cluster.Version().ChannelGroup(), clusterAdminEnabled, @@ -284,17 +300,6 @@ func PrintClusterDescription(connection *sdk.Connection, cluster *cmv1.Cluster) fmt.Printf("AdditionalTrustBundle: %s\n", cluster.AdditionalTrustBundle()) } - // GCP - if cluster.GCPNetwork().VPCName() != "" { - fmt.Printf("VPC-Name: %s\n", cluster.GCPNetwork().VPCName()) - } - if cluster.GCPNetwork().ControlPlaneSubnet() != "" { - fmt.Printf("Control-Plane-Subnet: %s\n", cluster.GCPNetwork().ControlPlaneSubnet()) - } - if cluster.GCPNetwork().ComputeSubnet() != "" { - fmt.Printf("Compute-Subnet: %s\n", cluster.GCPNetwork().ComputeSubnet()) - } - // Limited Support Status if cluster.Status().LimitedSupportReasonCount() > 0 { fmt.Printf("Limited Support: %t\n", cluster.Status().LimitedSupportReasonCount() > 0)