Skip to content

Commit

Permalink
Merge pull request #514 from Poorunga/main
Browse files Browse the repository at this point in the history
The nodeName of edgemesh-gateway is added with a -gateway suffix
  • Loading branch information
Poorunga authored Nov 1, 2023
2 parents b347a40 + 9d4f4d9 commit 72e9049
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 3 additions & 0 deletions cmd/edgemesh-gateway/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ func prepareRun(c *v1alpha1.EdgeMeshGatewayConfig) error {
if !exists {
return fmt.Errorf("env NODE_NAME not exist")
}
// In order to prevent the agent and gateway from having the same peerID on the same node,
// you need to add a -gateway suffix to the nodeName.
nodeName += "-gateway"
c.Modules.EdgeGatewayConfig.LoadBalancer.NodeName = nodeName
c.Modules.EdgeTunnelConfig.NodeName = nodeName

Expand Down
6 changes: 1 addition & 5 deletions pkg/tunnel/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,7 @@ func newEdgeTunnel(c *v1alpha1.EdgeTunnelConfig) (*EdgeTunnel, error) {
opts := make([]libp2p.Option, 0) // libp2p options
peerSource := make(chan peer.AddrInfo, c.MaxCandidates)

hostName := c.NodeName
if c.Mode == defaults.ClientMode {
hostName += "-gateway"
}
privKey, err := GenerateKeyPairWithString(hostName)
privKey, err := GenerateKeyPairWithString(c.NodeName)
if err != nil {
return nil, fmt.Errorf("failed to generate private key: %w", err)
}
Expand Down

0 comments on commit 72e9049

Please sign in to comment.