Fix multicluster for EKS (#5159)

`linkerd mc link` wasn't properly setting the `gatewayAddresses` field
when such address had a `Hostname` field instead of `Ip`, like is the
case in EKS services of type LoadBalancer.
This commit is contained in:
Alejandro Pedraza 2020-10-29 16:38:41 -05:00 committed by GitHub
parent 4c106e9c08
commit ee085f7ae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 1 deletions

View File

@ -617,7 +617,14 @@ func newLinkCommand() *cobra.Command {
gatewayAddresses := []string{} gatewayAddresses := []string{}
for _, ingress := range gateway.Status.LoadBalancer.Ingress { for _, ingress := range gateway.Status.LoadBalancer.Ingress {
gatewayAddresses = append(gatewayAddresses, ingress.IP) addr := ingress.IP
if addr == "" {
addr = ingress.Hostname
}
if addr == "" {
continue
}
gatewayAddresses = append(gatewayAddresses, addr)
} }
if len(gatewayAddresses) == 0 { if len(gatewayAddresses) == 0 {
return fmt.Errorf("Gateway %s.%s has no ingress addresses", gateway.Name, gateway.Namespace) return fmt.Errorf("Gateway %s.%s has no ingress addresses", gateway.Name, gateway.Namespace)