Skip to content

Commit

Permalink
fix: gateway and sensor service name (#651)
Browse files Browse the repository at this point in the history
  • Loading branch information
VaibhavPage authored May 8, 2020
1 parent d47439d commit 4a3d61f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions controllers/gateway/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/gateway/resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion controllers/sensor/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down

0 comments on commit 4a3d61f

Please sign in to comment.