Skip to content

Commit

Permalink
Merge pull request kubernetes#114038 from princepereira/automated-che…
Browse files Browse the repository at this point in the history
…rry-pick-of-#113742-upstream-release-1.26

[1.26.1] Automated cherry pick of kubernetes#113742: Introducing LoadbalancerPortMapping flags for VipExternalIP
  • Loading branch information
k8s-ci-robot authored Dec 16, 2022
2 parents 61835ac + a9241b1 commit c7118d9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions pkg/proxy/winkernel/hns.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ type hns struct{}
var (
// LoadBalancerFlagsIPv6 enables IPV6.
LoadBalancerFlagsIPv6 hcn.LoadBalancerFlags = 2
// LoadBalancerPortMappingFlagsVipExternalIP enables VipExternalIP.
LoadBalancerPortMappingFlagsVipExternalIP hcn.LoadBalancerPortMappingFlags = 16
)

func (hns hns) getNetworkByName(name string) (*hnsNetworkInfo, error) {
Expand Down Expand Up @@ -319,6 +321,9 @@ func (hns hns) getLoadBalancer(endpoints []endpointsInfo, flags loadBalancerFlag
if flags.localRoutedVIP {
lbPortMappingFlags |= hcn.LoadBalancerPortMappingFlagsLocalRoutedVIP
}
if flags.isVipExternalIP {
lbPortMappingFlags |= LoadBalancerPortMappingFlagsVipExternalIP
}

lbFlags := hcn.LoadBalancerFlagsNone
if flags.isDSR {
Expand Down
7 changes: 4 additions & 3 deletions pkg/proxy/winkernel/proxier.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ type loadBalancerIdentifier struct {
type loadBalancerFlags struct {
isILB bool
isDSR bool
isVipExternalIP bool
localRoutedVIP bool
useMUX bool
preserveDIP bool
Expand Down Expand Up @@ -1495,7 +1496,7 @@ func (proxier *Proxier) syncProxyRules() {
// If all endpoints are in terminating stage, then no need to create Node Port LoadBalancer
hnsLoadBalancer, err := hns.getLoadBalancer(
nodePortEndpoints,
loadBalancerFlags{isDSR: svcInfo.localTrafficDSR, localRoutedVIP: true, sessionAffinity: sessionAffinityClientIP, isIPv6: proxier.isIPv6Mode},
loadBalancerFlags{isVipExternalIP: true, isDSR: svcInfo.localTrafficDSR, localRoutedVIP: true, sessionAffinity: sessionAffinityClientIP, isIPv6: proxier.isIPv6Mode},
sourceVip,
"",
Enum(svcInfo.Protocol()),
Expand Down Expand Up @@ -1530,7 +1531,7 @@ func (proxier *Proxier) syncProxyRules() {
// Try loading existing policies, if already available
hnsLoadBalancer, err = hns.getLoadBalancer(
externalIPEndpoints,
loadBalancerFlags{isDSR: svcInfo.localTrafficDSR, sessionAffinity: sessionAffinityClientIP, isIPv6: proxier.isIPv6Mode},
loadBalancerFlags{isVipExternalIP: true, isDSR: svcInfo.localTrafficDSR, sessionAffinity: sessionAffinityClientIP, isIPv6: proxier.isIPv6Mode},
sourceVip,
externalIP.ip,
Enum(svcInfo.Protocol()),
Expand Down Expand Up @@ -1561,7 +1562,7 @@ func (proxier *Proxier) syncProxyRules() {
if len(lbIngressEndpoints) > 0 {
hnsLoadBalancer, err := hns.getLoadBalancer(
lbIngressEndpoints,
loadBalancerFlags{isDSR: svcInfo.preserveDIP || svcInfo.localTrafficDSR, useMUX: svcInfo.preserveDIP, preserveDIP: svcInfo.preserveDIP, sessionAffinity: sessionAffinityClientIP, isIPv6: proxier.isIPv6Mode},
loadBalancerFlags{isVipExternalIP: true, isDSR: svcInfo.preserveDIP || svcInfo.localTrafficDSR, useMUX: svcInfo.preserveDIP, preserveDIP: svcInfo.preserveDIP, sessionAffinity: sessionAffinityClientIP, isIPv6: proxier.isIPv6Mode},
sourceVip,
lbIngressIP.ip,
Enum(svcInfo.Protocol()),
Expand Down

0 comments on commit c7118d9

Please sign in to comment.