diff --git a/controllers/topology/serviceexpose.go b/controllers/topology/serviceexpose.go index ba68efc..dd5f1ae 100644 --- a/controllers/topology/serviceexpose.go +++ b/controllers/topology/serviceexpose.go @@ -119,6 +119,10 @@ func (r *ServiceExposeReconciler) renderServiceBase( deploymentName := fmt.Sprintf("%s-%s", owningTopologyName, nodeName) + if ResolveTopologyRemovePrefix(owningTopology) { + deploymentName = nodeName + } + selectorLabels := map[string]string{ clabernetesconstants.LabelApp: clabernetesconstants.Clabernetes, clabernetesconstants.LabelName: deploymentName, diff --git a/controllers/topology/servicefabric.go b/controllers/topology/servicefabric.go index d5c6b51..b4b328e 100644 --- a/controllers/topology/servicefabric.go +++ b/controllers/topology/servicefabric.go @@ -103,6 +103,10 @@ func (r *ServiceFabricReconciler) renderServiceBase( deploymentName := fmt.Sprintf("%s-%s", owningTopologyName, nodeName) + if ResolveTopologyRemovePrefix(owningTopology) { + deploymentName = nodeName + } + selectorLabels := map[string]string{ clabernetesconstants.LabelApp: clabernetesconstants.Clabernetes, clabernetesconstants.LabelName: deploymentName, diff --git a/controllers/topology/test-fixtures/golden/serviceexpose/render-service/simple-no-prefix.json b/controllers/topology/test-fixtures/golden/serviceexpose/render-service/simple-no-prefix.json index 056d41e..daa7cf9 100755 --- a/controllers/topology/test-fixtures/golden/serviceexpose/render-service/simple-no-prefix.json +++ b/controllers/topology/test-fixtures/golden/serviceexpose/render-service/simple-no-prefix.json @@ -5,7 +5,7 @@ "creationTimestamp": null, "labels": { "clabernetes/app": "clabernetes", - "clabernetes/name": "render-service-expose-test-srl1", + "clabernetes/name": "srl1", "clabernetes/topologyKind": "containerlab", "clabernetes/topologyNode": "srl1", "clabernetes/topologyOwner": "render-service-expose-test", @@ -101,7 +101,7 @@ ], "selector": { "clabernetes/app": "clabernetes", - "clabernetes/name": "render-service-expose-test-srl1", + "clabernetes/name": "srl1", "clabernetes/topologyNode": "srl1", "clabernetes/topologyOwner": "render-service-expose-test" }, diff --git a/controllers/topology/test-fixtures/golden/servicefabric/render-service/simple-no-prefix.json b/controllers/topology/test-fixtures/golden/servicefabric/render-service/simple-no-prefix.json index c6ebde7..9bd76bd 100755 --- a/controllers/topology/test-fixtures/golden/servicefabric/render-service/simple-no-prefix.json +++ b/controllers/topology/test-fixtures/golden/servicefabric/render-service/simple-no-prefix.json @@ -5,7 +5,7 @@ "creationTimestamp": null, "labels": { "clabernetes/app": "clabernetes", - "clabernetes/name": "render-service-fabric-test-srl1", + "clabernetes/name": "srl1", "clabernetes/topologyKind": "containerlab", "clabernetes/topologyNode": "srl1", "clabernetes/topologyOwner": "render-service-fabric-test", @@ -29,7 +29,7 @@ ], "selector": { "clabernetes/app": "clabernetes", - "clabernetes/name": "render-service-fabric-test-srl1", + "clabernetes/name": "srl1", "clabernetes/topologyNode": "srl1", "clabernetes/topologyOwner": "render-service-fabric-test" },