Commit efc2989d authored by Nick Sardo's avatar Nick Sardo

Final fixes

parent 3ea26e74
...@@ -55,6 +55,8 @@ func GetLoadBalancerAnnotationType(service *v1.Service) (LoadBalancerType, bool) ...@@ -55,6 +55,8 @@ func GetLoadBalancerAnnotationType(service *v1.Service) (LoadBalancerType, bool)
} }
} }
// GetLoadBalancerAnnotationBackendShare returns whether this service's backend service should be
// shared with other load balancers. Health checks and the healthcheck firewall will be shared regardless.
func GetLoadBalancerAnnotationBackendShare(service *v1.Service) bool { func GetLoadBalancerAnnotationBackendShare(service *v1.Service) bool {
l, exists := service.Annotations[ServiceAnnotationILBBackendShare] l, exists := service.Annotations[ServiceAnnotationILBBackendShare]
if exists && l == "true" { if exists && l == "true" {
......
...@@ -43,7 +43,14 @@ func makeBackendServiceName(loadBalancerName, clusterID string, shared bool, sch ...@@ -43,7 +43,14 @@ func makeBackendServiceName(loadBalancerName, clusterID string, shared bool, sch
hashed := hex.EncodeToString(hash.Sum(nil)) hashed := hex.EncodeToString(hash.Sum(nil))
hashed = hashed[:16] hashed = hashed[:16]
// 3 + 1 + 16 + 1 + 8 + 1 + 3 + 16 // k8s- 4
// {clusterid}- 17
// {scheme}- 9 (internal/external)
// {protocol}- 4 (tcp/udp)
// nmv1- 5 (naming convention version)
// {suffix} 16 (hash of settings)
// -----------------
// 55 characters used
return fmt.Sprintf("k8s-%s-%s-%s-nmv1-%s", clusterID, strings.ToLower(string(scheme)), strings.ToLower(string(protocol)), hashed) return fmt.Sprintf("k8s-%s-%s-%s-nmv1-%s", clusterID, strings.ToLower(string(scheme)), strings.ToLower(string(protocol)), hashed)
} }
return loadBalancerName return loadBalancerName
...@@ -72,7 +79,7 @@ func makeBackendServiceDescription(nm types.NamespacedName, shared bool) string ...@@ -72,7 +79,7 @@ func makeBackendServiceDescription(nm types.NamespacedName, shared bool) string
if shared { if shared {
return "" return ""
} }
return fmt.Sprintf(`{"kubernetes.io/service-name":"%s"`, nm.String()) return fmt.Sprintf(`{"kubernetes.io/service-name":"%s"}`, nm.String())
} }
// External Load Balancer // External Load Balancer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment