Skip to content

Commit

Permalink
chore: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonah Back committed Dec 4, 2023
1 parent ee1ed6b commit 0ec1904
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/adminapi/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ func adminAPIFromEndpoint(
// Format for calling the Admin API. If the port explicitly indicates http as the AppProtocol, use http.
// Otherwise, default to HTTPS as a best practice. Consumers may want to use HTTP if they have a service mesh in place which
// is already handling TLS authentication for them.
format := "https://%s:%d"
if port.AppProtocol != nil && strings.Compare(*port.AppProtocol, "http") == 0 {
format = "http://%s:%d"
adminAPIAddressFormat := "https://%s:%d"
if port.AppProtocol != nil && *port.AppProtocol == "http" {
adminAPIAddressFormat = "http://%s:%d"
}

// NOTE: Endpoint's addresses are assumed to be fungible, therefore we pick
Expand All @@ -188,7 +188,7 @@ func adminAPIFromEndpoint(
address := fmt.Sprintf("%s.%s.%s.svc", ipAddr, service.Name, service.Namespace)

return DiscoveredAdminAPI{
Address: fmt.Sprintf(format, address, *port.Port),
Address: fmt.Sprintf(adminAPIAddressFormat, address, *port.Port),
PodRef: podNN,
}, nil

Expand All @@ -197,7 +197,7 @@ func adminAPIFromEndpoint(
address := fmt.Sprintf("%s.%s.pod", ipAddr, service.Namespace)

return DiscoveredAdminAPI{
Address: fmt.Sprintf(format, address, *port.Port),
Address: fmt.Sprintf(adminAPIAddressFormat, address, *port.Port),
PodRef: podNN,
}, nil

Expand All @@ -207,7 +207,7 @@ func adminAPIFromEndpoint(
bounded = fmt.Sprintf("[%s]", bounded)
}
return DiscoveredAdminAPI{
Address: fmt.Sprintf(format, bounded, *port.Port),
Address: fmt.Sprintf(adminAPIAddressFormat, bounded, *port.Port),
PodRef: podNN,
}, nil

Expand Down

0 comments on commit 0ec1904

Please sign in to comment.