Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
multi domain l2s-m
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eclipse Research Labs
NEMO Project
NEMO Infrastructure Management
Federated Meta-Network Cluster Controller
multi domain l2s-m
Commits
b8a0785c
Commit
b8a0785c
authored
3 months ago
by
Alex de Cock Buning
Browse files
Options
Downloads
Patches
Plain Diff
operator: bug fix where dots in the node name broke the app
parent
40f62891
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
internal/controller/overlay_controller.go
+2
-2
2 additions, 2 deletions
internal/controller/overlay_controller.go
internal/utils/utils.go
+9
-0
9 additions, 0 deletions
internal/utils/utils.go
with
11 additions
and
2 deletions
internal/controller/overlay_controller.go
+
2
−
2
View file @
b8a0785c
...
...
@@ -199,7 +199,7 @@ func (r *OverlayReconciler) createExternalResources(ctx context.Context, overlay
for
_
,
nodeName
:=
range
overlay
.
Spec
.
Topology
.
Nodes
{
node
:=
switchv1
.
Node
{
Name
:
nodeName
,
NodeIP
:
fmt
.
Sprintf
(
"l2sm-switch-%s-%s"
,
overlayName
,
nodeName
),
NodeIP
:
utils
.
GenerateServiceName
(
overlayName
,
nodeName
),
}
topologySwitch
.
Nodes
=
append
(
topologySwitch
.
Nodes
,
node
)
}
...
...
@@ -371,7 +371,7 @@ func (r *OverlayReconciler) createExternalResources(ctx context.Context, overlay
// Create a headless service for the ReplicaSet
service
:=
&
corev1
.
Service
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
fmt
.
Sprintf
(
"l2sm-switch-%s-%s"
,
overlay
.
Name
,
node
),
Name
:
utils
.
GenerateServiceName
(
overlay
.
Name
,
node
),
Namespace
:
overlay
.
Namespace
,
Labels
:
map
[
string
]
string
{
"app"
:
name
},
},
...
...
This diff is collapsed.
Click to expand it.
internal/utils/utils.go
+
9
−
0
View file @
b8a0785c
...
...
@@ -20,6 +20,7 @@ import (
"crypto/sha256"
"encoding/hex"
"fmt"
"hash/fnv"
"strings"
"k8s.io/apimachinery/pkg/runtime"
...
...
@@ -133,3 +134,11 @@ func GetBridgeName(params BridgeParams) string {
dpid
:=
hex
.
EncodeToString
(
dpidBytes
)
return
fmt
.
Sprintf
(
"br-%s"
,
dpid
)
}
func
GenerateServiceName
(
overlayName
,
nodeName
string
)
string
{
hash
:=
fnv
.
New32
()
// Using FNV hash for a compact hash, but still 32 bits
hash
.
Write
([]
byte
(
fmt
.
Sprintf
(
"%s%s"
,
overlayName
,
nodeName
)))
sum
:=
hash
.
Sum32
()
// Encode the hash as a base32 string and take the first 4 characters
return
fmt
.
Sprintf
(
"l2sm-switch-%04x"
,
sum
)
// H
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment