blob: c4225356a02b2b6eec03561236ee19712b609330 [file] [log] [blame]
giof6ad2982024-08-23 17:42:49 +04001package cluster
2
3import (
4 "net"
5)
6
7const (
8 whichTailscale = "which tailscale"
9 tailscaleInstallCmd = "curl -fsSL https://tailscale.com/install.sh | sh"
10 tailscaleUpCmd = "sudo tailscale up --login-server=%s --auth-key=%s --hostname=%s --reset"
11)
12
13type Server struct {
14 Name string `json:"name"`
15 IP net.IP `json:"ip"`
16 Port int `json:"port"`
17 HostKey string `json:"hostKey"`
18 User string `json:"user"`
19 Password string `json:"password"`
20 ClientKey string `json:"clientKey"`
21 AuthKey string `json:"authKey"`
22}
23
24type State struct {
25 Name string `json:"name"`
26 IngressClassName string `json:"ingressClassName"`
27 IngressIP net.IP `json:"ingressIP"`
28 ServerAddr string `json:"serverAddr"`
29 ServerToken string `json:"serverToken"`
30 Kubeconfig string `json:"kubeconfig"`
31 Controllers []Server `json:"controllers"`
32 Workers []Server `json:"workers"`
gio8f290322024-09-21 15:37:45 +040033 StorageEnabled bool `json:"storageEnabled"`
giof6ad2982024-08-23 17:42:49 +040034}
35
gio8f290322024-09-21 15:37:45 +040036type ClusterIngressSetupFunc func(name, kubeconfig, ingressClassName string) (net.IP, error)
37type ClusterSetupFunc func(m Manager) error
giof6ad2982024-08-23 17:42:49 +040038
39type Manager interface {
gio8f290322024-09-21 15:37:45 +040040 Init(s Server, setupFn ClusterIngressSetupFunc) (net.IP, error)
giof6ad2982024-08-23 17:42:49 +040041 JoinController(s Server) error
42 JoinWorker(s Server) error
43 RemoveServer(name string) error
44 State() State
gio8f290322024-09-21 15:37:45 +040045 EnableStorage()
giof6ad2982024-08-23 17:42:49 +040046}