From 2b6cfeee5f02c982d5b27e33e97b96522b114c5d Mon Sep 17 00:00:00 2001 From: Gary Brown Date: Tue, 23 Oct 2018 17:15:15 +0100 Subject: [PATCH] Remove zipkin service Signed-off-by: Gary Brown --- pkg/controller/all-in-one_test.go | 5 ++-- pkg/controller/controller_test.go | 2 +- pkg/controller/production_test.go | 5 ++-- pkg/deployment/all-in-one.go | 1 - pkg/deployment/all-in-one_test.go | 2 +- pkg/deployment/collector.go | 1 - pkg/deployment/collector_test.go | 2 +- pkg/service/zipkin.go | 46 ------------------------------- pkg/service/zipkin_test.go | 22 --------------- 9 files changed, 7 insertions(+), 79 deletions(-) delete mode 100644 pkg/service/zipkin.go delete mode 100644 pkg/service/zipkin_test.go diff --git a/pkg/controller/all-in-one_test.go b/pkg/controller/all-in-one_test.go index 799c97ec3..8c6960604 100644 --- a/pkg/controller/all-in-one_test.go +++ b/pkg/controller/all-in-one_test.go @@ -50,9 +50,9 @@ func TestDelegateAllInOneDepedencies(t *testing.T) { func assertDeploymentsAndServicesForAllInOne(t *testing.T, name string, objs []sdk.Object, hasDaemonSet bool) { if hasDaemonSet { - assert.Len(t, objs, 7) - } else { assert.Len(t, objs, 6) + } else { + assert.Len(t, objs, 5) } // we should have one deployment, named after the Jaeger's name (ObjectMeta.Name) @@ -69,7 +69,6 @@ func assertDeploymentsAndServicesForAllInOne(t *testing.T, name string, objs []s fmt.Sprintf("%s-agent", name): false, fmt.Sprintf("%s-collector", name): false, fmt.Sprintf("%s-query", name): false, - fmt.Sprintf("%s-zipkin", name): false, } // and the ingress rule diff --git a/pkg/controller/controller_test.go b/pkg/controller/controller_test.go index 57f7ea8c5..0a8f9ab72 100644 --- a/pkg/controller/controller_test.go +++ b/pkg/controller/controller_test.go @@ -44,7 +44,7 @@ func TestNewControllerForProduction(t *testing.T) { ctrl := NewController(context.TODO(), jaeger) ds := ctrl.Create() - assert.Len(t, ds, 6) + assert.Len(t, ds, 5) } func TestUnknownStorage(t *testing.T) { diff --git a/pkg/controller/production_test.go b/pkg/controller/production_test.go index 83d6ccf73..989a84277 100644 --- a/pkg/controller/production_test.go +++ b/pkg/controller/production_test.go @@ -86,9 +86,9 @@ func TestDelegateProductionDepedencies(t *testing.T) { func assertDeploymentsAndServicesForProduction(t *testing.T, name string, objs []sdk.Object, hasDaemonSet bool) { if hasDaemonSet { - assert.Len(t, objs, 7) - } else { assert.Len(t, objs, 6) + } else { + assert.Len(t, objs, 5) } deployments := map[string]bool{ @@ -103,7 +103,6 @@ func assertDeploymentsAndServicesForProduction(t *testing.T, name string, objs [ services := map[string]bool{ fmt.Sprintf("%s-collector", name): false, fmt.Sprintf("%s-query", name): false, - fmt.Sprintf("%s-zipkin", name): false, } ingresses := map[string]bool{ diff --git a/pkg/deployment/all-in-one.go b/pkg/deployment/all-in-one.go index b9ae5b9f7..7b64182b9 100644 --- a/pkg/deployment/all-in-one.go +++ b/pkg/deployment/all-in-one.go @@ -143,7 +143,6 @@ func (a *AllInOne) Services() []*v1.Service { service.NewCollectorService(a.jaeger, selector), service.NewQueryService(a.jaeger, selector), service.NewAgentService(a.jaeger, selector), - service.NewZipkinService(a.jaeger, selector), } } diff --git a/pkg/deployment/all-in-one_test.go b/pkg/deployment/all-in-one_test.go index 19fadc250..818db045c 100644 --- a/pkg/deployment/all-in-one_test.go +++ b/pkg/deployment/all-in-one_test.go @@ -49,7 +49,7 @@ func TestAllInOneHasOwner(t *testing.T) { func TestAllInOneNumberOfServices(t *testing.T) { name := "TestNumberOfServices" services := NewAllInOne(v1alpha1.NewJaeger(name)).Services() - assert.Len(t, services, 4) // collector, query, agent,zipkin + assert.Len(t, services, 3) // collector, query, agent for _, svc := range services { owners := svc.ObjectMeta.OwnerReferences diff --git a/pkg/deployment/collector.go b/pkg/deployment/collector.go index 5a8347803..b0e59047f 100644 --- a/pkg/deployment/collector.go +++ b/pkg/deployment/collector.go @@ -123,7 +123,6 @@ func (c *Collector) Services() []*v1.Service { selector := c.selector() return []*v1.Service{ service.NewCollectorService(c.jaeger, selector), - service.NewZipkinService(c.jaeger, selector), } } diff --git a/pkg/deployment/collector_test.go b/pkg/deployment/collector_test.go index 79a6f722f..fc0d88e5a 100644 --- a/pkg/deployment/collector_test.go +++ b/pkg/deployment/collector_test.go @@ -42,7 +42,7 @@ func TestName(t *testing.T) { func TestCollectorServices(t *testing.T) { collector := NewCollector(v1alpha1.NewJaeger("TestName")) svcs := collector.Services() - assert.Len(t, svcs, 2) + assert.Len(t, svcs, 1) } func TestDefaultCollectorImage(t *testing.T) { diff --git a/pkg/service/zipkin.go b/pkg/service/zipkin.go deleted file mode 100644 index 06567adfe..000000000 --- a/pkg/service/zipkin.go +++ /dev/null @@ -1,46 +0,0 @@ -package service - -import ( - "fmt" - - "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - - "github.com/jaegertracing/jaeger-operator/pkg/apis/io/v1alpha1" -) - -// NewZipkinService returns a new Kubernetes service for Jaeger Collector's Zipkin port backed by the pods matching the selector -func NewZipkinService(jaeger *v1alpha1.Jaeger, selector map[string]string) *v1.Service { - trueVar := true - - return &v1.Service{ - TypeMeta: metav1.TypeMeta{ - Kind: "Service", - APIVersion: "v1", - }, - ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("%s-zipkin", jaeger.Name), - Namespace: jaeger.Namespace, - Labels: selector, - OwnerReferences: []metav1.OwnerReference{ - metav1.OwnerReference{ - APIVersion: jaeger.APIVersion, - Kind: jaeger.Kind, - Name: jaeger.Name, - UID: jaeger.UID, - Controller: &trueVar, - }, - }, - }, - Spec: v1.ServiceSpec{ - Selector: selector, - ClusterIP: "None", - Ports: []v1.ServicePort{ - { - Name: "zipkin", - Port: 9411, - }, - }, - }, - } -} diff --git a/pkg/service/zipkin_test.go b/pkg/service/zipkin_test.go deleted file mode 100644 index 1a7eac76b..000000000 --- a/pkg/service/zipkin_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package service - -import ( - "fmt" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/jaegertracing/jaeger-operator/pkg/apis/io/v1alpha1" -) - -func TestZipkinServiceNameAndPort(t *testing.T) { - name := "TestZipkinServiceNameAndPort" - selector := map[string]string{"app": "myapp", "jaeger": name, "jaeger-component": "zipkin"} - - jaeger := v1alpha1.NewJaeger(name) - svc := NewZipkinService(jaeger, selector) - - assert.Equal(t, fmt.Sprintf("%s-zipkin", name), svc.ObjectMeta.Name) - assert.Len(t, svc.Spec.Ports, 1) - assert.Equal(t, int32(9411), svc.Spec.Ports[0].Port) -}