Revert "Revert #7145 now that #7609 is in, and fix the tests that were relying on it"

This commit is contained in:
Quinton Hoole
2015-05-02 23:32:21 -07:00
parent b447dc0c54
commit 83b70c4411
3 changed files with 23 additions and 18 deletions

View File

@@ -18,6 +18,7 @@ package cloudprovider
import (
"net"
"strings"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
)
@@ -42,8 +43,17 @@ type Clusters interface {
Master(clusterName string) (string, error)
}
func GetLoadBalancerName(clusterName, serviceNamespace, serviceName string) string {
return clusterName + "-" + serviceNamespace + "-" + serviceName
// TODO(#6812): Use a shorter name that's less likely to be longer than cloud
// providers' name length limits.
func GetLoadBalancerName(service *api.Service) string {
//GCE requires that the name of a load balancer starts with a lower case letter.
ret := "a" + string(service.UID)
ret = strings.Replace(ret, "-", "", -1)
//AWS requires that the name of a load balancer is shorter than 32 bytes.
if len(ret) > 32 {
ret = ret[:32]
}
return ret
}
// TCPLoadBalancer is an abstract, pluggable interface for TCP load balancers.