/
cluster_spec.go
113 lines (93 loc) · 3.59 KB
/
cluster_spec.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package model
import (
"github.com/KubeOperator/KubeOperator/pkg/model/common"
uuid "github.com/satori/go.uuid"
)
type ClusterSpecNetwork struct {
common.BaseModel
ID string `json:"-"`
ClusterID string `json:"-"`
NetworkType string `json:"networkType"`
CiliumVersion string `json:"ciliumVersion"`
CiliumTunnelMode string `json:"ciliumTunnelMode"`
CiliumNativeRoutingCidr string `json:"ciliumNativeRoutingCidr"`
FlannelBackend string `json:"flannelBackend"`
CalicoIpv4PoolIpip string `json:"calicoIpv4PoolIpip"`
NetworkInterface string `json:"networkInterface"`
NetworkCidr string `json:"networkCidr"`
Status string `json:"status"`
Message string `json:"message" gorm:"type:text(65535)"`
}
type ClusterSpecRuntime struct {
common.BaseModel
ID string `json:"-"`
ClusterID string `json:"-"`
RuntimeType string `json:"runtimeType"`
DockerMirrorRegistry string `json:"dockerMirrorRegistry"`
DockerRemoteApi string `json:"dockerRemoteApi"`
DockerStorageDir string `json:"dockerStorageDir"`
ContainerdStorageDir string `json:"containerdStorageDir"`
DockerSubnet string `json:"dockerSubnet"`
HelmVersion string `json:"helmVersion"`
Status string `json:"status"`
Message string `json:"message" gorm:"type:text(65535)"`
}
type ClusterSpecConf struct {
common.BaseModel
ID string `json:"-"`
ClusterID string `json:"-"`
YumOperate string `json:"yumOperate"`
MaxNodeNum int `json:"maxNodeNum"`
WorkerAmount int `json:"workerAmount"`
KubeMaxPods int `json:"kubeMaxPods"`
KubeNetworkNodePrefix int `json:"kubeNetworkNodePrefix"`
KubePodSubnet string `json:"kubePodSubnet"`
KubeServiceSubnet string `json:"kubeServiceSubnet"`
KubeProxyMode string `json:"kubeProxyMode"`
CgroupDriver string `json:"cgroupDriver"`
KubeDnsDomain string `json:"kubeDnsDomain"`
KubernetesAudit string `json:"kubernetesAudit"`
NodeportAddress string `json:"nodeportAddress"`
KubeServiceNodePortRange string `json:"kubeServiceNodePortRange"`
EtcdDataDir string `json:"etcdDataDir"`
EtcdSnapshotCount int `json:"etcdSnapshotCount"`
EtcdCompactionRetention int `json:"etcdCompactionRetention"`
EtcdMaxRequest int `json:"etcdMaxRequest"`
EtcdQuotaBackend int `json:"etcdQuotaBackend"`
MasterScheduleType string `json:"masterScheduleType"`
LbMode string `json:"lbMode"`
LbKubeApiserverIp string `json:"lbKubeApiserverIp"`
KubeApiServerPort int `json:"kubeApiServerPort"`
KubeRouter string `json:"kubeRouter"`
AuthenticationMode string `json:"authenticationMode"`
Status string `json:"status"`
Message string `json:"message" gorm:"type:text(65535)"`
}
type ClusterSpecComponent struct {
common.BaseModel
ID string `json:"-"`
ClusterID string `json:"-"`
Name string `json:"name"`
Type string `json:"type"`
Version string `json:"version"`
Describe string `json:"describe"`
Vars string `json:"-" gorm:"type:text(65535)"`
Status string `json:"status"`
Message string `json:"message" gorm:"type:text(65535)"`
}
func (s *ClusterSpecConf) BeforeCreate() (err error) {
s.ID = uuid.NewV4().String()
return nil
}
func (s *ClusterSpecRuntime) BeforeCreate() (err error) {
s.ID = uuid.NewV4().String()
return nil
}
func (s *ClusterSpecNetwork) BeforeCreate() (err error) {
s.ID = uuid.NewV4().String()
return nil
}
func (s *ClusterSpecComponent) BeforeCreate() (err error) {
s.ID = uuid.NewV4().String()
return nil
}