@@ -37,9 +37,21 @@ type IBMPowerVSClusterSpec struct {
37
37
ServiceInstanceID string `json:"serviceInstanceID"`
38
38
39
39
// Network is the reference to the Network to use for this cluster.
40
- // when the field is omitted, A DHCP service will be created in the Power VS server workspace and its private network will be used.
40
+ // when the field is omitted, A DHCP service will be created in the Power VS workspace and its private network will be used.
41
+ // the DHCP service created network will have the following name format
42
+ // 1. in the case of DHCPServer.Name is not set the name will be DHCPSERVER<CLUSTER_NAME>_Private.
43
+ // 2. if DHCPServer.Name is set the name will be DHCPSERVER<DHCPServer.Name>_Private.
44
+ // when Network.ID is set, its expected that there exist a network in PowerVS workspace with id or else system will give error.
45
+ // when Network.Name is set, system will first check for network with Name in PowerVS workspace, if not exist network will be created by DHCP service.
46
+ // Network.RegEx is not yet supported and system will ignore the value.
41
47
Network IBMPowerVSResourceReference `json:"network"`
42
48
49
+ // dhcpServer is contains the configuration to be used while creating a new DHCP server in PowerVS workspace.
50
+ // when the field is omitted, CLUSTER_NAME will be used as DHCPServer.Name and DHCP server will be created.
51
+ // it will automatically create network with name DHCPSERVER<DHCPServer.Name>_Private in PowerVS workspace.
52
+ // +optional
53
+ DHCPServer * DHCPServer `json:"dhcpServer,omitempty"`
54
+
43
55
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
44
56
// +optional
45
57
ControlPlaneEndpoint capiv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
@@ -50,48 +62,108 @@ type IBMPowerVSClusterSpec struct {
50
62
// supported serviceInstance identifier in PowerVSResource are Name and ID and that can be obtained from IBM Cloud UI or IBM Cloud cli.
51
63
// More detail about Power VS service instance.
52
64
// https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server
53
- // when omitted system will dynamically create the service instance
65
+ // when omitted system will dynamically create the service instance with name CLUSTER_NAME-serviceInstance.
66
+ // when ServiceInstance.ID is set, its expected that there exist a service instance in PowerVS workspace with id or else system will give error.
67
+ // when ServiceInstance.Name is set, system will first check for service instance with Name in PowerVS workspace, if not exist system will create new instance.
68
+ // ServiceInstance.Regex is not yet supported not yet supported and system will ignore the value.
54
69
// +optional
55
70
ServiceInstance * IBMPowerVSResourceReference `json:"serviceInstance,omitempty"`
56
71
57
72
// zone is the name of Power VS zone where the cluster will be created
58
73
// possible values can be found here https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server.
59
- // when omitted syd04 will be set as default zone.
60
- // +kubebuilder:default=dal10
74
+ // when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource,
75
+ // 1. it is expected to set the zone, not setting will result in webhook error.
76
+ // 2. the zone should have PER capabilities, or else system will give error.
61
77
// +optional
62
78
Zone * string `json:"zone,omitempty"`
63
79
64
80
// resourceGroup name under which the resources will be created.
65
- // when omitted default resource group of the account will be used.
81
+ // when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource,
82
+ // 1. it is expected to set the ResourceGroup.Name, not setting will result in webhook error.
83
+ // ServiceInstance.ID and ServiceInstance.Regex is not yet supported and system will ignore the value.
66
84
// +optional
67
- ResourceGroup * string `json:"resourceGroup,omitempty"`
85
+ ResourceGroup * IBMPowerVSResourceReference `json:"resourceGroup,omitempty"`
68
86
69
87
// vpc contains information about IBM Cloud VPC resources.
88
+ // when omitted system will dynamically create the VPC with name CLUSTER_NAME-vpc.
89
+ // when VPC.ID is set, its expected that there exist a VPC with ID or else system will give error.
90
+ // when VPC.Name is set, system will first check for VPC with Name, if not exist system will create new VPC.
91
+ // when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource,
92
+ // 1. it is expected to set the VPC.Region, not setting will result in webhook error.
70
93
// +optional
71
94
VPC * VPCResourceReference `json:"vpc,omitempty"`
72
95
73
96
// vpcSubnets contains information about IBM Cloud VPC Subnet resources.
97
+ // when omitted system will create the subnets in all the zone corresponding to VPC.Region, with name CLUSTER_NAME-vpcsubnet-ZONE_NAME.
98
+ // possible values can be found here https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server.
99
+ // when VPCSubnets[].ID is set, its expected that there exist a subnet with ID or else system will give error.
100
+ // when VPCSubnets[].Zone is not set, a random zone is picked from available zones of VPC.Region.
101
+ // when VPCSubnets[].Name is not set, system will set name as CLUSTER_NAME-vpcsubnet-INDEX.
102
+ // if subnet with name VPCSubnets[].Name not found, system will create new subnet in VPCSubnets[].Zone.
74
103
// +optional
75
104
VPCSubnets []Subnet `json:"vpcSubnets,omitempty"`
76
105
77
106
// transitGateway contains information about IBM Cloud TransitGateway
78
107
// IBM Cloud TransitGateway helps in establishing network connectivity between IBM Cloud Power VS and VPC infrastructure
79
108
// more information about TransitGateway can be found here https://www.ibm.com/products/transit-gateway.
109
+ // when TransitGateway.ID is set, its expected that there exist a TransitGateway with ID or else system will give error.
110
+ // when TransitGateway.Name is set, system will first check for TransitGateway with Name, if not exist system will create new TransitGateway.
80
111
// +optional
81
112
TransitGateway * TransitGateway `json:"transitGateway,omitempty"`
82
113
83
- // loadBalancers is optional configuration for configuring loadbalancers to control plane or data plane nodes
114
+ // loadBalancers is optional configuration for configuring loadbalancers to control plane or data plane nodes.
115
+ // when omitted system will create a public loadbalancer with name CLUSTER_NAME-loadbalancer.
84
116
// when specified a vpc loadbalancer will be created and controlPlaneEndpoint will be set with associated hostname of loadbalancer.
85
- // when omitted user is expected to set controlPlaneEndpoint.
117
+ // ControlPlaneEndpoint will be set with associated hostname of public loadbalancer.
118
+ // when LoadBalancers[].ID is set, its expected that there exist a loadbalancer with ID or else system will give error.
119
+ // when LoadBalancers[].Name is set, system will first check for loadbalancer with Name, if not exist system will create new loadbalancer.
86
120
// +optional
87
121
LoadBalancers []VPCLoadBalancerSpec `json:"loadBalancers,omitempty"`
88
122
89
123
// cosInstance contains options to configure a supporting IBM Cloud COS bucket for this
90
124
// cluster - currently used for nodes requiring Ignition
91
125
// (https://coreos.github.io/ignition/) for bootstrapping (requires
92
126
// BootstrapFormatIgnition feature flag to be enabled).
127
+ // when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource and Ignition is set, then
128
+ // 1. CosInstance.Name should be set not setting will result in webhook error.
129
+ // 2. CosInstance.BucketName should be set not setting will result in webhook error.
130
+ // 3. CosInstance.BucketRegion should be set not setting will result in webhook error.
93
131
// +optional
94
132
CosInstance * CosInstance `json:"cosInstance,omitempty"`
133
+
134
+ // Ignition defined options related to the bootstrapping systems where Ignition is used.
135
+ // +optional
136
+ Ignition * Ignition `json:"ignition,omitempty"`
137
+ }
138
+
139
+ // Ignition defines options related to the bootstrapping systems where Ignition is used.
140
+ type Ignition struct {
141
+ // Version defines which version of Ignition will be used to generate bootstrap data.
142
+ //
143
+ // +optional
144
+ // +kubebuilder:default="2.3"
145
+ // +kubebuilder:validation:Enum="2.3";"2.4";"3.0";"3.1";"3.2";"3.3";"3.4"
146
+ Version string `json:"version,omitempty"`
147
+ }
148
+
149
+ // DHCPServer contains the DHCP server configurations.
150
+ type DHCPServer struct {
151
+ // Optional cidr for DHCP private network
152
+ Cidr * string `json:"cidr,omitempty"`
153
+
154
+ // Optional DNS Server for DHCP service
155
+ // +kubebuilder:default="1.1.1.1"
156
+ DNSServer * string `json:"dnsServer,omitempty"`
157
+
158
+ // Optional name of DHCP Service. Only alphanumeric characters and dashes are allowed.
159
+ Name * string `json:"name,omitempty"`
160
+
161
+ // Optional id of the existing DHCPServer
162
+ ID * string `json:"id,omitempty"`
163
+
164
+ // Optional indicates if SNAT will be enabled for DHCP service
165
+ // +kubebuilder:default=true
166
+ Snat * bool `json:"snat,omitempty"`
95
167
}
96
168
97
169
// ResourceReference identifies a resource with id.
@@ -109,6 +181,9 @@ type IBMPowerVSClusterStatus struct {
109
181
// +kubebuilder:default=false
110
182
Ready bool `json:"ready"`
111
183
184
+ // ResourceGroup is the reference to the Power VS resource group under which the resources will be created.
185
+ ResourceGroup * ResourceReference `json:"resourceGroupID,omitempty"`
186
+
112
187
// serviceInstance is the reference to the Power VS service on which the server instance(VM) will be created.
113
188
ServiceInstance * ResourceReference `json:"serviceInstance,omitempty"`
114
189
@@ -166,40 +241,38 @@ type IBMPowerVSClusterList struct {
166
241
167
242
// TransitGateway holds the TransitGateway information.
168
243
type TransitGateway struct {
244
+ // name of resource.
245
+ // +optional
169
246
Name * string `json:"name,omitempty"`
170
- ID * string `json:"id,omitempty"`
247
+ // id of resource.
248
+ // +optional
249
+ ID * string `json:"id,omitempty"`
171
250
}
172
251
173
252
// VPCResourceReference is a reference to a specific VPC resource by ID or Name
174
253
// Only one of ID or Name may be specified. Specifying more than one will result in
175
254
// a validation error.
176
255
type VPCResourceReference struct {
177
- // ID of resource
256
+ // id of resource.
178
257
// +kubebuilder:validation:MinLength=1
179
258
// +optional
180
259
ID * string `json:"id,omitempty"`
181
260
182
- // Name of resource
261
+ // name of resource.
183
262
// +kubebuilder:validation:MinLength=1
184
263
// +optional
185
264
Name * string `json:"name,omitempty"`
186
265
187
- // IBM Cloud VPC region
266
+ // region of IBM Cloud VPC.
267
+ // when powervs.cluster.x-k8s.io/create-infra=true annotation is set on IBMPowerVSCluster resource,
268
+ // it is expected to set the region, not setting will result in webhook error.
188
269
Region * string `json:"region,omitempty"`
189
270
}
190
271
191
272
// CosInstance represents IBM Cloud COS instance.
192
273
type CosInstance struct {
193
- // PresignedURLDuration defines the duration for which presigned URLs are valid.
194
- //
195
- // This is used to generate presigned URLs for S3 Bucket objects, which are used by
196
- // control-plane and worker nodes to fetch bootstrap data.
197
- //
198
- // When enabled, the IAM instance profiles specified are not used.
199
- // +optional
200
- PresignedURLDuration * metav1.Duration `json:"presignedURLDuration,omitempty"`
201
-
202
- // Name defines name of IBM cloud COS instance to be created.
274
+ // name defines name of IBM cloud COS instance to be created.
275
+ // when IBMPowerVSCluster.Ignition is set
203
276
// +kubebuilder:validation:MinLength:=3
204
277
// +kubebuilder:validation:MaxLength:=63
205
278
// +kubebuilder:validation:Pattern=`^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$`
@@ -222,6 +295,14 @@ func (r *IBMPowerVSCluster) SetConditions(conditions capiv1beta1.Conditions) {
222
295
r .Status .Conditions = conditions
223
296
}
224
297
298
+ // Set sets the details of the resource.
299
+ func (rf * ResourceReference ) Set (resource ResourceReference ) {
300
+ rf .ID = resource .ID
301
+ if ! * rf .ControllerCreated {
302
+ rf .ControllerCreated = resource .ControllerCreated
303
+ }
304
+ }
305
+
225
306
func init () {
226
307
SchemeBuilder .Register (& IBMPowerVSCluster {}, & IBMPowerVSClusterList {})
227
308
}
0 commit comments