Skip to content

Commit

Permalink
Display only platform-relevant field in cluster describe
Browse files Browse the repository at this point in the history
Hide AWS-specific fields from GCP cluster describe and vice versa.
  • Loading branch information
JakobGray committed Feb 5, 2024
1 parent 2114ef6 commit ff1c142
Showing 1 changed file with 25 additions and 20 deletions.
45 changes: 25 additions & 20 deletions pkg/cluster/describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"+
Expand All @@ -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,
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit ff1c142

Please sign in to comment.