Skip to content

Commit

Permalink
Merge pull request #1233 from tssurya/bug-2115845
Browse files Browse the repository at this point in the history
Bug 2115845: [release-4.9] OCP CARRY: Add the rules to EXTERNALIPs only for SGW mode
  • Loading branch information
openshift-merge-robot committed Aug 17, 2022
2 parents ce3940a + cfeb277 commit f70c287
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions go-controller/pkg/node/gateway_iptables.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build linux
// +build linux

package node
Expand Down Expand Up @@ -340,11 +341,17 @@ func getGatewayIPTRules(service *kapi.Service, gatewayIPs []string) []iptRule {
}
}
}
externalIPs := make([]string, 0, len(service.Spec.ExternalIPs)+len(service.Status.LoadBalancer.Ingress))
externalIPsCount := len(service.Spec.ExternalIPs)
if config.Gateway.Mode == config.GatewayModeShared {
externalIPsCount += len(service.Status.LoadBalancer.Ingress)
}
externalIPs := make([]string, 0, externalIPsCount)
externalIPs = append(externalIPs, service.Spec.ExternalIPs...)
for _, ingress := range service.Status.LoadBalancer.Ingress {
if len(ingress.IP) > 0 {
externalIPs = append(externalIPs, ingress.IP)
if config.Gateway.Mode == config.GatewayModeShared {
for _, ingress := range service.Status.LoadBalancer.Ingress {
if len(ingress.IP) > 0 {
externalIPs = append(externalIPs, ingress.IP)
}
}
}

Expand Down

0 comments on commit f70c287

Please sign in to comment.