Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change behaviour gateway addressess override in Link command #11564

Merged
merged 2 commits into from Nov 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 6 additions & 8 deletions multicluster/cmd/link.go
Expand Up @@ -232,7 +232,6 @@ A full list of configurable values can be found at https://github.com/linkerd/li
return err
}

gatewayAddresses := ""
gwAddresses := []string{}
for _, ingress := range gateway.Status.LoadBalancer.Ingress {
addr := ingress.IP
Expand All @@ -244,15 +243,14 @@ A full list of configurable values can be found at https://github.com/linkerd/li
}
gwAddresses = append(gwAddresses, addr)
}
if len(gwAddresses) == 0 && opts.gatewayAddresses == "" {
return fmt.Errorf("Gateway %s.%s has no ingress addresses", gateway.Name, gateway.Namespace)
}
if len(gwAddresses) > 0 {
gatewayAddresses = strings.Join(gwAddresses, ",")

if opts.gatewayAddresses != "" {
link.GatewayAddress = opts.gatewayAddresses
} else if len(gwAddresses) > 0 {
link.GatewayAddress = strings.Join(gwAddresses, ",")
} else {
gatewayAddresses = opts.gatewayAddresses
return fmt.Errorf("Gateway %s.%s has no ingress addresses", gateway.Name, gateway.Namespace)
}
link.GatewayAddress = gatewayAddresses

gatewayIdentity, ok := gateway.Annotations[k8s.GatewayIdentity]
if !ok || gatewayIdentity == "" {
Expand Down