Browse Source

added kubernetes listen port

afeiszli 3 years ago
parent
commit
a39ef16394
1 changed files with 7 additions and 1 deletions
  1. 7 1
      logic/server.go

+ 7 - 1
logic/server.go

@@ -8,7 +8,7 @@ import (
 	"strconv"
 	"strings"
 	"time"
-
+	"github.com/gravitl/netmaker/servercfg"
 	"github.com/gravitl/netmaker/models"
 	"github.com/gravitl/netmaker/netclient/ncutils"
 	"golang.zx2c4.com/wireguard/wgctrl/wgtypes"
@@ -16,6 +16,9 @@ import (
 
 // == Join, Checkin, and Leave for Server ==
 
+// KUBERNETES_LISTEN_PORT - starting port for Kubernetes in order to use NodePort range
+const KUBERNETES_LISTEN_PORT = 31821
+
 // ServerJoin - responsible for joining a server to a network
 func ServerJoin(network string, serverID string, privateKey string) error {
 
@@ -33,6 +36,9 @@ func ServerJoin(network string, serverID string, privateKey string) error {
 		MacAddress:   serverID,
 		UDPHolePunch: "no",
 	}
+	if servercfg.GetPlatform() == "Kubernetes" {
+		node.ListenPort = KUBERNETES_LISTEN_PORT
+	}
 	node.SetDefaults()
 
 	if node.LocalRange != "" && node.LocalAddress == "" {