issues/115. fix endpoint creation for services with selectors when servicesMetadata is specified for tenant (#116)

apply review notes

Co-authored-by: Maksim Fedotov <m_fedotov@wargaming.net>
This commit is contained in:
Maxim Fedotov
2020-10-31 15:10:08 +03:00
committed by GitHub
co-authored by Maksim Fedotov
parent 39d6638669
commit 7ae1c0ae32
+7 -2
View File
@@ -47,8 +47,13 @@ type Endpoints struct {
*corev1.Endpoints
}
func (ep Endpoints) Namespace() string {
return ep.GetNamespace()
func (ep Endpoints) Namespace() (namespace string) {
namespace = ep.GetNamespace()
// For ep, which are created automatically using service selector namespace will always be empty, so we had to take it from TargetRef
if len(namespace) == 0 {
namespace = ep.Subsets[0].Addresses[0].TargetRef.Namespace
}
return
}
func (ep Endpoints) Labels() map[string]string {