2021-10-13 03:44:19 +08:00
|
|
|
package logic
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
2021-10-20 21:22:05 +08:00
|
|
|
|
2023-01-15 01:00:44 +08:00
|
|
|
"github.com/google/uuid"
|
2021-10-13 03:44:19 +08:00
|
|
|
"github.com/gravitl/netmaker/models"
|
|
|
|
)
|
|
|
|
|
2022-09-22 03:13:17 +08:00
|
|
|
// EnterpriseCheckFuncs - can be set to run functions for EE
|
2022-09-29 21:49:06 +08:00
|
|
|
var EnterpriseCheckFuncs []func()
|
2022-09-15 01:26:31 +08:00
|
|
|
|
2022-09-22 03:13:17 +08:00
|
|
|
// EnterpriseFailoverFunc - interface to control failover funcs
|
2022-12-21 04:29:09 +08:00
|
|
|
var EnterpriseFailoverFunc func(node *models.Node) error
|
2022-09-22 03:13:17 +08:00
|
|
|
|
2022-09-28 02:42:14 +08:00
|
|
|
// EnterpriseResetFailoverFunc - interface to control reset failover funcs
|
2022-09-29 21:49:06 +08:00
|
|
|
var EnterpriseResetFailoverFunc func(network string) error
|
2022-09-28 02:42:14 +08:00
|
|
|
|
2022-09-29 04:17:49 +08:00
|
|
|
// EnterpriseResetAllPeersFailovers - resets all nodes that are considering a node to be failover worthy (inclusive)
|
2023-01-15 01:00:44 +08:00
|
|
|
var EnterpriseResetAllPeersFailovers func(nodeid uuid.UUID, network string) error
|
2022-09-29 04:17:49 +08:00
|
|
|
|
2021-10-13 03:44:19 +08:00
|
|
|
// == Join, Checkin, and Leave for Server ==
|
|
|
|
|
2021-10-16 02:15:32 +08:00
|
|
|
// KUBERNETES_LISTEN_PORT - starting port for Kubernetes in order to use NodePort range
|
|
|
|
const KUBERNETES_LISTEN_PORT = 31821
|
2021-12-11 04:01:10 +08:00
|
|
|
|
|
|
|
// KUBERNETES_SERVER_MTU - ideal mtu for kubernetes deployments right now
|
2021-10-18 03:31:37 +08:00
|
|
|
const KUBERNETES_SERVER_MTU = 1024
|
2021-10-16 02:15:32 +08:00
|
|
|
|
2022-09-15 01:26:31 +08:00
|
|
|
// EnterpriseCheck - Runs enterprise functions if presented
|
|
|
|
func EnterpriseCheck() {
|
|
|
|
for _, check := range EnterpriseCheckFuncs {
|
2022-09-29 21:49:06 +08:00
|
|
|
check()
|
2022-09-15 01:26:31 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-14 03:15:20 +08:00
|
|
|
// == Private ==
|
|
|
|
|
|
|
|
func isDeleteError(err error) bool {
|
|
|
|
return err != nil && strings.Contains(err.Error(), models.NODE_DELETE)
|
|
|
|
}
|