-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
installconfig.go
190 lines (154 loc) · 5.56 KB
/
installconfig.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
package types
import (
"net"
"github.com/openshift/installer/pkg/ipnet"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// InstallConfig is the configuration for an OpenShift install.
type InstallConfig struct {
// +optional
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
// ClusterID is the ID of the cluster.
ClusterID string `json:"clusterID"`
// Admin is the configuration for the admin user.
Admin Admin `json:"admin"`
// BaseDomain is the base domain to which the cluster should belong.
BaseDomain string `json:"baseDomain"`
// Networking defines the pod network provider in the cluster.
Networking `json:"networking"`
// Machines is the list of MachinePools that need to be installed.
Machines []MachinePool `json:"machines"`
// Platform is the configuration for the specific platform upon which to
// perform the installation.
Platform `json:"platform"`
// PullSecret is the secret to use when pulling images.
PullSecret string `json:"pullSecret"`
}
// MasterCount returns the number of replicas in the master machine pool,
// defaulting to one if no machine pool was found.
func (c *InstallConfig) MasterCount() int {
for _, m := range c.Machines {
if m.Name == "master" && m.Replicas != nil {
return int(*m.Replicas)
}
}
return 1
}
// Admin is the configuration for the admin user.
type Admin struct {
// Email is the email address of the admin user.
Email string `json:"email"`
// Password is the password of the admin user.
Password string `json:"password"`
// SSHKey to use for the access to compute instances.
SSHKey string `json:"sshKey,omitempty"`
}
// Platform is the configuration for the specific platform upon which to perform
// the installation. Only one of the platform configuration should be set.
type Platform struct {
// AWS is the configuration used when installing on AWS.
AWS *AWSPlatform `json:"aws,omitempty"`
// Libvirt is the configuration used when installing on libvirt.
Libvirt *LibvirtPlatform `json:"libvirt,omitempty"`
// OpenStack is the configuration used when installing on OpenStack.
OpenStack *OpenStackPlatform `json:"openstack,omitempty"`
}
// Name returns a string representation of the platform (e.g. "aws" if
// AWS is non-nil). It returns an empty string if no platform is
// configured.
func (p *Platform) Name() string {
if p == nil {
return ""
}
if p.AWS != nil {
return "aws"
}
if p.Libvirt != nil {
return "libvirt"
}
if p.OpenStack != nil {
return "openstack"
}
return ""
}
// Networking defines the pod network provider in the cluster.
type Networking struct {
Type NetworkType `json:"type"`
ServiceCIDR ipnet.IPNet `json:"serviceCIDR"`
PodCIDR ipnet.IPNet `json:"podCIDR"`
}
// NetworkType defines the pod network provider in the cluster.
type NetworkType string
const (
// NetworkTypeOpenshiftSDN is used to install with SDN.
NetworkTypeOpenshiftSDN NetworkType = "openshift-sdn"
// NetworkTypeOpenshiftOVN is used to install with OVN.
NetworkTypeOpenshiftOVN NetworkType = "openshift-ovn"
)
// AWSPlatform stores all the global configuration that
// all machinesets use.
type AWSPlatform struct {
// Region specifies the AWS region where the cluster will be created.
Region string `json:"region"`
// UserTags specifies additional tags for AWS resources created for the cluster.
UserTags map[string]string `json:"userTags,omitempty"`
// DefaultMachinePlatform is the default configuration used when
// installing on AWS for machine pools which do not define their own
// platform configuration.
DefaultMachinePlatform *AWSMachinePoolPlatform `json:"defaultMachinePlatform,omitempty"`
// VPCID specifies the vpc to associate with the cluster.
// If empty, new vpc will be created.
// +optional
VPCID string `json:"vpcID"`
// VPCCIDRBlock
// +optional
VPCCIDRBlock string `json:"vpcCIDRBlock"`
}
// OpenStackPlatform stores all the global configuration that
// all machinesets use.
type OpenStackPlatform struct {
// Region specifies the OpenStack region where the cluster will be created.
Region string `json:"region"`
// VPCID specifies the vpc to associate with the cluster.
// If empty, new vpc will be created.
// +optional
VPCID string `json:"vpcID"`
// NetworkCIDRBlock
// +optional
NetworkCIDRBlock string `json:"NetworkCIDRBlock"`
// BaseImage
// Name of image to use from OpenStack cloud
BaseImage string `json:"baseImage"`
// Cloud
// Name of OpenStack cloud to use from clouds.yaml
Cloud string `json:"cloud"`
// ExternalNetwork
// The OpenStack external network to be used for installation.
ExternalNetwork string `json:"externalNetwork"`
}
// LibvirtPlatform stores all the global configuration that
// all machinesets use.
type LibvirtPlatform struct {
// URI is the identifier for the libvirtd connection. It must be
// reachable from both the host (where the installer is run) and the
// cluster (where the cluster-API controller pod will be running).
URI string `json:"URI"`
// DefaultMachinePlatform is the default configuration used when
// installing on AWS for machine pools which do not define their own
// platform configuration.
DefaultMachinePlatform *LibvirtMachinePoolPlatform `json:"defaultMachinePlatform,omitempty"`
// Network
Network LibvirtNetwork `json:"network"`
// MasterIPs
MasterIPs []net.IP `json:"masterIPs"`
}
// LibvirtNetwork is the configuration of the libvirt network.
type LibvirtNetwork struct {
// Name is the name of the nework.
Name string `json:"name"`
// IfName is the name of the network interface.
IfName string `json:"if"`
// IPRange is the range of IPs to use.
IPRange string `json:"ipRange"`
}