diff --git a/main.go b/main.go index b07250e..58c1d6a 100644 --- a/main.go +++ b/main.go @@ -503,15 +503,14 @@ func (c *controller) populate(hashrings []receive.HashringConfig, statefulsets m var endpoints []string for i := 0; i < int(*sts.Spec.Replicas); i++ { endpoints = append(endpoints, - fmt.Sprintf("%s://%s-%d.%s.%s.svc.%s:%d/%s", - c.options.scheme, + fmt.Sprintf("%s-%d.%s.%s.svc.%s:%d", sts.Name, i, sts.Spec.ServiceName, c.options.namespace, c.options.clusterDomain, c.options.port, - strings.TrimPrefix(c.options.path, "/")), + ), ) } hashrings[i].Endpoints = endpoints diff --git a/main_test.go b/main_test.go index 556ab1e..35c9a02 100644 --- a/main_test.go +++ b/main_test.go @@ -84,9 +84,9 @@ func TestController(t *testing.T) { Hashring: "hashring0", Tenants: []string{"foo", "bar"}, Endpoints: []string{ - "http://thanos-receive-hashring0-0.h0.namespace.svc.cluster.local:19291/api/v1/receive", - "http://thanos-receive-hashring0-1.h0.namespace.svc.cluster.local:19291/api/v1/receive", - "http://thanos-receive-hashring0-2.h0.namespace.svc.cluster.local:19291/api/v1/receive", + "thanos-receive-hashring0-0.h0.namespace.svc.cluster.local:19291", + "thanos-receive-hashring0-1.h0.namespace.svc.cluster.local:19291", + "thanos-receive-hashring0-2.h0.namespace.svc.cluster.local:19291", }, }}, }, @@ -128,9 +128,9 @@ func TestController(t *testing.T) { Hashring: "hashring0", Tenants: []string{"foo", "bar"}, Endpoints: []string{ - "http://hashring0-0.h0.namespace.svc.cluster.local:19291/api/v1/receive", - "http://hashring0-1.h0.namespace.svc.cluster.local:19291/api/v1/receive", - "http://hashring0-2.h0.namespace.svc.cluster.local:19291/api/v1/receive", + "hashring0-0.h0.namespace.svc.cluster.local:19291", + "hashring0-1.h0.namespace.svc.cluster.local:19291", + "hashring0-2.h0.namespace.svc.cluster.local:19291", }, }}, }, @@ -174,15 +174,15 @@ func TestController(t *testing.T) { Hashring: "hashring0", Tenants: []string{"foo", "bar"}, Endpoints: []string{ - "http://hashring0-0.h0.namespace.svc.cluster.local:19291/api/v1/receive", - "http://hashring0-1.h0.namespace.svc.cluster.local:19291/api/v1/receive", - "http://hashring0-2.h0.namespace.svc.cluster.local:19291/api/v1/receive", + "hashring0-0.h0.namespace.svc.cluster.local:19291", + "hashring0-1.h0.namespace.svc.cluster.local:19291", + "hashring0-2.h0.namespace.svc.cluster.local:19291", }, }, { Hashring: "hashring1", Endpoints: []string{ - "http://hashring1-0.h1.namespace.svc.cluster.local:19291/api/v1/receive", - "http://hashring1-1.h1.namespace.svc.cluster.local:19291/api/v1/receive", + "hashring1-0.h1.namespace.svc.cluster.local:19291", + "hashring1-1.h1.namespace.svc.cluster.local:19291", }, }}, }, @@ -200,7 +200,7 @@ func TestController(t *testing.T) { configMapName: "original", configMapGeneratedName: "generated", namespace: "namespace", - path: "/api/v1/receive", + path: "", port: 19291, scheme: "http", } @@ -234,9 +234,9 @@ func TestControllerConfigmapUpdate(t *testing.T) { Hashring: "hashring0", Tenants: []string{"foo", "bar"}, Endpoints: []string{ - "http://thanos-receive-hashring0-0.h0.namespace.svc.cluster.local:19291/api/v1/receive", - "http://thanos-receive-hashring0-1.h0.namespace.svc.cluster.local:19291/api/v1/receive", - "http://thanos-receive-hashring0-2.h0.namespace.svc.cluster.local:19291/api/v1/receive", + "thanos-receive-hashring0-0.h0.namespace.svc.cluster.local:19291", + "thanos-receive-hashring0-1.h0.namespace.svc.cluster.local:19291", + "thanos-receive-hashring0-2.h0.namespace.svc.cluster.local:19291", }, }} intendedLabels := map[string]string{ @@ -278,7 +278,7 @@ func TestControllerConfigmapUpdate(t *testing.T) { configMapName: "original", configMapGeneratedName: "generated", namespace: "namespace", - path: "/api/v1/receive", + path: "", port: 19291, scheme: "http", }