From 4a3d61f9d667d5e95d9c61eb0c2c199f1db2c7a8 Mon Sep 17 00:00:00 2001 From: Vaibhav Date: Fri, 8 May 2020 09:01:58 -0400 Subject: [PATCH] fix: gateway and sensor service name (#651) --- controllers/gateway/resource.go | 4 ++-- controllers/gateway/resource_test.go | 2 +- controllers/sensor/resource.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/controllers/gateway/resource.go b/controllers/gateway/resource.go index 4279ef01a8..bb9ccb5613 100644 --- a/controllers/gateway/resource.go +++ b/controllers/gateway/resource.go @@ -51,7 +51,7 @@ func (ctx *gatewayContext) buildServiceResource() (*corev1.Service, error) { } svc := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("%s-gateway-svc", ctx.gateway.Name), + Name: fmt.Sprintf("%s-gateway", ctx.gateway.Name), }, Spec: corev1.ServiceSpec{ Ports: ctx.gateway.Spec.Service.Ports, @@ -73,7 +73,7 @@ func (ctx *gatewayContext) buildLegacyServiceResource() (*corev1.Service, error) } svc := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("%s-gateway-svc", ctx.gateway.Name), + Name: fmt.Sprintf("%s-gateway", ctx.gateway.Name), }, Spec: *ctx.gateway.Spec.Service.Spec, } diff --git a/controllers/gateway/resource_test.go b/controllers/gateway/resource_test.go index 75b0ee5d55..3e614ddc85 100644 --- a/controllers/gateway/resource_test.go +++ b/controllers/gateway/resource_test.go @@ -97,7 +97,7 @@ func TestResource_BuildServiceResource(t *testing.T) { service, err := opCtx.buildServiceResource() assert.Nil(t, err) assert.NotNil(t, service) - assert.Equal(t, service.Name, gatewayObj.Name+"-gateway-svc") + assert.Equal(t, service.Name, gatewayObj.Name+"-gateway") assert.Equal(t, service.Namespace, opCtx.gateway.Namespace) newSvc, err := controller.k8sClient.CoreV1().Services(service.Namespace).Create(service) diff --git a/controllers/sensor/resource.go b/controllers/sensor/resource.go index addf3c0e98..cc68763c7c 100644 --- a/controllers/sensor/resource.go +++ b/controllers/sensor/resource.go @@ -41,7 +41,7 @@ func (ctx *sensorContext) generateServiceSpec() *corev1.Service { serviceSpec := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ - Name: fmt.Sprintf("%s-sensor-svc", ctx.sensor.Name), + Name: fmt.Sprintf("%s-sensor", ctx.sensor.Name), Labels: ctx.sensor.Spec.ServiceLabels, Annotations: ctx.sensor.Spec.ServiceAnnotations, },