remove unnecessary duplicated calls to NeedsPortForward

pull/15911/head
Steven Powell 2023-02-22 13:59:48 -08:00
parent 3c538f400a
commit ca3bcae87a
1 changed files with 3 additions and 2 deletions

View File

@ -65,12 +65,13 @@ var serviceListCmd = &cobra.Command{
}
// updatePortsAndURLs sets the port name to "No node port" if a service has no URLs and removes the URLs
// if the driver needs port forwarding as the user won't be able to hit the listed URLs which could confuse users
// if the driver needs port forwarding as the user won't be able to hit the listed URLs which could confuse them
func updatePortsAndURLs(serviceURLs service.URLs, co mustload.ClusterController) service.URLs {
needsPortForward := driver.NeedsPortForward(co.Config.Driver)
for i := range serviceURLs {
if len(serviceURLs[i].URLs) == 0 {
serviceURLs[i].PortNames = []string{"No node port"}
} else if driver.NeedsPortForward(co.Config.Driver) {
} else if needsPortForward {
serviceURLs[i].URLs = []string{}
}
}