Skip to content

Commit

Permalink
Merge pull request #123 from srl-labs/fix/svc-selector-for-non-prefix…
Browse files Browse the repository at this point in the history
…ed-deployments

fix: update the deployment selector for services for non-prefixed topos
  • Loading branch information
carlmontanari authored Feb 22, 2024
2 parents 720d6ce + 01ce602 commit 3fcbac8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions controllers/topology/serviceexpose.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions controllers/topology/servicefabric.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
},
Expand Down

0 comments on commit 3fcbac8

Please sign in to comment.