-
Notifications
You must be signed in to change notification settings - Fork 375
/
sysconf.go
131 lines (117 loc) · 4.21 KB
/
sysconf.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Copyright (c) 2021 Terminus, Inc.
//
// This program is free software: you can use, redistribute, and/or modify
// it under the terms of the GNU Affero General Public License, version 3
// or later ("AGPL"), as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package sysconf
// Cluster 集群配置
type Cluster struct {
Name string `json:"name"`
Type string `json:"type"` // dcos, k8s
Nameservers []string `json:"nameservers"`
ContainerSubnet string `json:"containerSubnet"`
VirtualSubnet string `json:"virtualSubnet"`
MasterVIP string `json:"masterVIP,omitempty"`
Offline bool `json:"offline"`
}
// SSH 远程登录配置
type SSH struct {
Port int `json:"port"`
User string `json:"user"`
Password string `json:"password,omitempty"`
Account string `json:"account"`
PrivateKey string `json:"privateKey,omitempty"`
PublicKey string `json:"publicKey,omitempty"`
}
const (
RootUser = "root"
)
// FPS 文件代理服务器配置
type FPS struct {
Host string `json:"host"`
Port int `json:"port"`
Proxy bool `json:"proxy"`
}
// Gluster GlusterFS 配置
type Gluster struct {
Version string `json:"version"`
Hosts []string `json:"hosts"`
Server bool `json:"server"`
Replica int `json:"replica"`
Brick string `json:"brick"`
}
// Storage 共享存储配置
type Storage struct {
MountPoint string `json:"mountPoint"`
NAS string `json:"nas"`
Gluster Gluster `json:"gluster"`
GittarDataPath string `json:"gittarDataPath"`
}
// Docker Docker 配置
type Docker struct {
DataRoot string `json:"dataRoot"`
ExecRoot string `json:"execRoot"`
BIP string `json:"bip"`
FixedCIDR string `json:"fixedCIDR"`
}
// Node 节点配置
type Node struct {
IP string `json:"ip"`
Type string `json:"type"` // master, lb, app
Tag string `json:"tag"`
}
// Nodes 节点列表
type Nodes []Node
// MySQL 平台数据库配置
type MySQL struct {
Host string `json:"host,omitempty"`
Port int `json:"port,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
DiceDB string `json:"diceDB,omitempty"`
PandoraDB string `json:"pandoraDB,omitempty"`
SonarDB string `json:"sonarDB,omitempty"`
}
// OpenVPN 平台 VPN 配置
type OpenVPN struct {
PeerSubnet string `json:"peerSubnet,omitempty"`
Subnets []string `json:"subnets,omitempty"`
ConfigOPVN string `json:"configOPVN,omitempty"`
}
// Platform 平台配置
type Platform struct {
Environment string `json:"environment,omitempty"`
WildcardDomain string `json:"wildcardDomain"`
AssignDomains map[string]string `json:"assignDomains"`
AssignNodes map[string]string `json:"assignNodes,omitempty"`
MySQL MySQL `json:"mysql,omitempty"`
AcceptMaster bool `json:"acceptMaster,omitempty"`
AcceptLB bool `json:"acceptLB,omitempty"`
DataDiskDevice string `json:"dataDiskDevice,omitempty"`
DataRoot string `json:"dataRoot,omitempty"`
Scheme string `json:"scheme"`
Port int `json:"port"`
RegistryHost string `json:"registryHost,omitempty"`
OpenVPN OpenVPN `json:"openvpn,omitempty"`
}
// Sysconf dice installer 配置
type Sysconf struct {
Cluster Cluster `json:"cluster"`
SSH SSH `json:"ssh"`
FPS FPS `json:"fps"`
Storage Storage `json:"storage"`
Docker Docker `json:"docker"`
Nodes Nodes `json:"nodes"`
NewNodes Nodes `json:"-"` // TODO
Platform Platform `json:"platform"`
MainPlatform *Platform `json:"mainPlatform,omitempty"`
Envs map[string]string `json:"envs,omitempty"`
OrgID int `json:"orgID,omitempty"`
}