Skip to content

Commit

Permalink
Merge pull request #402 from zlabjp/simplify
Browse files Browse the repository at this point in the history
Simplify
  • Loading branch information
tatsuhiro-t authored Sep 30, 2024
2 parents fd399dd + 574a5f3 commit bce48b0
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions pkg/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,7 @@ func (lbc *LoadBalancerController) createIngressUpstreams(ctx context.Context, i
reqPath = reqPath[:idx]
}

if lbc.noDefaultBackendOverride && (rule.Host == "" && (reqPath == "" || reqPath == "/")) {
if lbc.noDefaultBackendOverride && rule.Host == "" && (reqPath == "" || reqPath == "/") {
log.Error(nil, "Ignore rule which overrides default backend")
continue
}
Expand Down Expand Up @@ -3239,19 +3239,16 @@ func (lc *LeaderController) getPodNodeAddress(pod *corev1.Pod) (string, error) {

for i := range node.Status.Addresses {
address := &node.Status.Addresses[i]
if address.Type == corev1.NodeExternalIP {
if address.Address == "" {
continue
switch address.Type {
case corev1.NodeExternalIP:
if address.Address != "" {
return address.Address, nil
}
case corev1.NodeInternalIP:
if externalIP == "" && lc.lbc.allowInternalIP {
// Continue to the next iteration because we may encounter v1.NodeExternalIP later.
externalIP = address.Address
}

externalIP = address.Address

break
}

if externalIP == "" && lc.lbc.allowInternalIP && address.Type == corev1.NodeInternalIP {
// Continue to the next iteration because we may encounter v1.NodeExternalIP later.
externalIP = address.Address
}
}

Expand Down

0 comments on commit bce48b0

Please sign in to comment.