move ShuffleStrings to pkg/proxy

Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
This commit is contained in:
Yassine TIJANI
2019-08-21 19:33:41 +01:00
parent 5df8781ee3
commit 4d9e4f0b45
8 changed files with 51 additions and 52 deletions

View File

@@ -24,7 +24,7 @@ import (
"sync"
"time"
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/proxy"
@@ -240,7 +240,7 @@ func (lb *LoadBalancerRR) OnEndpointsAdd(endpoints *v1.Endpoints) {
// if one does not already exist. The affinity will be updated
// later, once NewService is called.
state = lb.newServiceInternal(svcPort, v1.ServiceAffinity(""), 0)
state.endpoints = slice.ShuffleStrings(newEndpoints)
state.endpoints = util.ShuffleStrings(newEndpoints)
// Reset the round-robin index.
state.index = 0
@@ -274,7 +274,7 @@ func (lb *LoadBalancerRR) OnEndpointsUpdate(oldEndpoints, endpoints *v1.Endpoint
// if one does not already exist. The affinity will be updated
// later, once NewService is called.
state = lb.newServiceInternal(svcPort, v1.ServiceAffinity(""), 0)
state.endpoints = slice.ShuffleStrings(newEndpoints)
state.endpoints = util.ShuffleStrings(newEndpoints)
// Reset the round-robin index.
state.index = 0