@@ -52,9 +52,14 @@ type IBMVPCClusterSpec struct {
52
52
ControlPlaneEndpoint capiv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
53
53
54
54
// ControlPlaneLoadBalancer is optional configuration for customizing control plane behavior.
55
+ // Use this for legacy support, use Network.LoadBalancers for the extended VPC support.
55
56
// +optional
56
57
ControlPlaneLoadBalancer * VPCLoadBalancerSpec `json:"controlPlaneLoadBalancer,omitempty"`
57
58
59
+ // image represents the Image details used for the cluster.
60
+ // +optional
61
+ Image * ImageSpec `json:"image,omitempty"`
62
+
58
63
// network represents the VPC network to use for the cluster.
59
64
// +optional
60
65
Network * VPCNetworkSpec `json:"network,omitempty"`
@@ -87,37 +92,168 @@ type VPCLoadBalancerSpec struct {
87
92
// +optional
88
93
// ++kubebuilder:validation:UniqueItems=true
89
94
AdditionalListeners []AdditionalListenerSpec `json:"additionalListeners,omitempty"`
95
+
96
+ // backendPools defines the load balancer's backend pools.
97
+ // +optional
98
+ BackendPools []VPCLoadBalancerBackendPoolSpec `json:"backendPools,omitempty"`
99
+
100
+ // securityGroups defines the Security Groups to attach to the load balancer.
101
+ // Security Groups defined here are expected to already exist when the load balancer is reconciled (these do not get created when reconciling the load balancer).
102
+ // +optional
103
+ SecurityGroups []VPCResource `json:"securityGroups,omitempty"`
104
+
105
+ // subnets defines the VPC Subnets to attach to the load balancer.
106
+ // Subnets defiens here are expected to already exist when the load balancer is reconciled (these do not get created when reconciling the load balancer).
107
+ // +optional
108
+ Subnets []VPCResource `json:"subnets,omitempty"`
90
109
}
91
110
92
111
// AdditionalListenerSpec defines the desired state of an
93
112
// additional listener on an VPC load balancer.
94
113
type AdditionalListenerSpec struct {
114
+ // defaultPoolName defines the name of a VPC Load Balancer Backend Pool to use for the VPC Load Balancer Listener.
115
+ // +kubebuilder:validation:MinLength:=1
116
+ // +kubebuilder:validation:MaxLength:=63
117
+ // +kubebuilder:validation:Pattern=`^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$`
118
+ // +optional
119
+ DefaultPoolName * string `json:"defaultPoolName,omitempty"`
120
+
95
121
// Port sets the port for the additional listener.
96
122
// +kubebuilder:validation:Minimum=1
97
123
// +kubebuilder:validation:Maximum=65535
98
124
Port int64 `json:"port"`
125
+
126
+ // protocol defines the protocol to use for the VPC Load Balancer Listener.
127
+ // Will default to TCP protocol if not specified.
128
+ // +optional
129
+ Protocol * VPCLoadBalancerListenerProtocol `json:"protocol,omitempty"`
99
130
}
100
131
101
- // VPCNetworkSpec defines the desired state of the network resources for the cluster for extended VPC Infrastructure support.
102
- type VPCNetworkSpec struct {
103
- // workerSubnets is a set of Subnet's which define the Worker subnets.
132
+ // VPCLoadBalancerBackendPoolSpec defines the desired configuration of a VPC Load Balancer Backend Pool.
133
+ type VPCLoadBalancerBackendPoolSpec struct {
134
+ // name defines the name of the Backend Pool.
135
+ // +kubebuilder:validation:MinLength:=1
136
+ // +kubebuilder:validation:MaxLength:=63
137
+ // +kubebuilder:validation:Pattern=`^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$`
104
138
// +optional
105
- WorkerSubnets []Subnet `json:"workerSubnets,omitempty"`
139
+ Name * string `json:"name,omitempty"`
140
+
141
+ // algorithm defines the load balancing algorithm to use.
142
+ // +required
143
+ Algorithm VPCLoadBalancerBackendPoolAlgorithm `json:"algorithm"`
144
+
145
+ // healthMonitor defines the backend pool's health monitor.
146
+ // +required
147
+ HealthMonitor VPCLoadBalancerHealthMonitorSpec `json:"healthMonitor"`
148
+
149
+ // protocol defines the protocol to use for the Backend Pool.
150
+ // +required
151
+ Protocol VPCLoadBalancerBackendPoolProtocol `json:"protocol"`
152
+ }
153
+
154
+ // VPCLoadBalancerHealthMonitorSpec defines the desired state of a Health Monitor resource for a VPC Load Balancer Backend Pool.
155
+ // kubebuilder:validation:XValidation:rule="self.dely > self.timeout",message="health monitor's delay must be greater than the timeout"
156
+ type VPCLoadBalancerHealthMonitorSpec struct {
157
+ // delay defines the seconds to wait between health checks.
158
+ // +kubebuilder:validation:Minimum=2
159
+ // +kubebuilder:validation:Maximum=60
160
+ // +required
161
+ Delay int64 `json:"delay"`
162
+
163
+ // retries defines the max retries for health check.
164
+ // +kubebuilder:validation:Minimum=1
165
+ // +kubebuilder:validation:Maximum=10
166
+ // +required
167
+ Retries int64 `json:"retries"`
168
+
169
+ // port defines the port to perform health monitoring on.
170
+ // +kubebuilder:validation:Minimum=1
171
+ // +kubebuilder:validation:Maximum=65535
172
+ // +optional
173
+ Port * int64 `json:"port,omitempty"`
174
+
175
+ // timeout defines the seconds to wait for a health check response.
176
+ // +kubebuilder:validation:Minimum=1
177
+ // +kubebuilder:validation:Maximum=59
178
+ // +required
179
+ Timeout int64 `json:"timeout"`
180
+
181
+ // type defines the protocol used for health checks.
182
+ // +required
183
+ Type VPCLoadBalancerBackendPoolHealthMonitorType `json:"type"`
106
184
185
+ // urlPath defines the URL to use for health monitoring.
186
+ // +kubebuilder:validation:Pattern=`^\/(([a-zA-Z0-9-._~!$&'()*+,;=:@]|%[a-fA-F0-9]{2})+(\/([a-zA-Z0-9-._~!$&'()*+,;=:@]|%[a-fA-F0-9]{2})*)*)?(\\?([a-zA-Z0-9-._~!$&'()*+,;=:@\/?]|%[a-fA-F0-9]{2})*)?$`
187
+ // +optional
188
+ URLPath * string `json:"urlPath,omitempty"`
189
+ }
190
+
191
+ // ImageSpec defines the desired state of the VPC Custom Image resources for the cluster.
192
+ // +kubebuilder:validation:XValidation:rule="(!has(self.cosInstance) && !has(self.cosBucket) && !has(self.cosObject)) || (has(self.cosInstance) && has(self.cosBucket) && has(self.cosObject))",message="if any of cosInstance, cosBucket, or cosObject are specified, all must be specified"
193
+ // +kubebuilder:validation:XValidation:rule="has(self.name) || has(self.crn) || (has(self.cosInstance) && has(self.cosBucket) && has(self.cosObject))",message="an existing image name or crn must be provided, or to create a new image the cos resources must be provided, with or without a name"
194
+ type ImageSpec struct {
195
+ // name is the name of the desired VPC Custom Image.
196
+ // +kubebuilder:validation:MinLength:=1
197
+ // +kubebuilder:validation:MaxLength:=63
198
+ // +kubebuilder:validation:Pattern='/^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$/'
199
+ // +optional
200
+ Name * string `json:"name,omitempty"`
201
+
202
+ // crn is the IBM Cloud CRN of the existing VPC Custom Image.
203
+ // +optional
204
+ CRN * string `json:"crn,omitempty"`
205
+
206
+ // cosInstance is the name of the IBM Cloud COS Instance containing the source of the image, if necessary.
207
+ // +optional
208
+ COSInstance * string `json:"cosInstance,omitempty"`
209
+
210
+ // cosBucket is the name of the IBM Cloud COS Bucket containing the source of the image, if necessary.
211
+ // +optional
212
+ COSBucket * string `json:"cosBucket,omitempty"`
213
+
214
+ // cosBucketRegion is the COS region the bucket is in.
215
+ // +optional
216
+ COSBucketRegion * string `json:"cosBucketRegion,omitempty"`
217
+
218
+ // cosObject is the name of a IBM Cloud COS Object used as the source of the image, if necessary.
219
+ // +optional
220
+ COSObject * string `json:"cosObject,omitempty"`
221
+
222
+ // operatingSystem is the Custom Image's Operating System name.
223
+ // +optional
224
+ OperatingSystem * string `json:"operatingSystem,omitempty"`
225
+
226
+ // resourceGroup is the Resource Group to create the Custom Image in.
227
+ // +optional
228
+ ResourceGroup * IBMCloudResourceReference `json:"resourceGroup,omitempty"`
229
+ }
230
+
231
+ // VPCNetworkSpec defines the desired state of the network resources for the cluster for extended VPC Infrastructure support.
232
+ type VPCNetworkSpec struct {
107
233
// controlPlaneSubnets is a set of Subnet's which define the Control Plane subnets.
108
234
// +optional
109
235
ControlPlaneSubnets []Subnet `json:"controlPlaneSubnets,omitempty"`
110
236
111
- // resourceGroup is the name of the Resource Group containing all of the newtork resources.
237
+ // loadBalancers is a set of VPC Load Balancer definitions to use for the cluster.
238
+ // +optional
239
+ LoadBalancers []VPCLoadBalancerSpec `json:"loadBalancers,omitempty"`
240
+
241
+ // resourceGroup is the Resource Group containing all of the newtork resources.
112
242
// This can be different than the Resource Group containing the remaining cluster resources.
113
243
// +optional
114
- ResourceGroup * string `json:"resourceGroup,omitempty"`
244
+ ResourceGroup * IBMCloudResourceReference `json:"resourceGroup,omitempty"`
245
+
246
+ // securityGroups is a set of VPCSecurityGroup's which define the VPC Security Groups that manage traffic within and out of the VPC.
247
+ // +optional
248
+ SecurityGroups []VPCSecurityGroup `json:"securityGroups,omitempty"`
249
+
250
+ // workerSubnets is a set of Subnet's which define the Worker subnets.
251
+ // +optional
252
+ WorkerSubnets []Subnet `json:"workerSubnets,omitempty"`
115
253
116
254
// vpc defines the IBM Cloud VPC for extended VPC Infrastructure support.
117
255
// +optional
118
256
VPC * VPCResource `json:"vpc,omitempty"`
119
-
120
- // TODO(cjschaef): Complete spec definition (SecurityGroups, etc.)
121
257
}
122
258
123
259
// VPCSecurityGroupStatus defines a vpc security group resource status with its id and respective rule's ids.
@@ -148,11 +284,14 @@ type VPCLoadBalancerStatus struct {
148
284
149
285
// IBMVPCClusterStatus defines the observed state of IBMVPCCluster.
150
286
type IBMVPCClusterStatus struct {
151
- // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
152
287
// Important: Run "make" to regenerate code after modifying this file
153
288
// dep: rely on Network instead.
154
289
VPC VPC `json:"vpc,omitempty"`
155
290
291
+ // image is the status of the VPC Custom Image.
292
+ // +optional
293
+ Image * ResourceStatus `json:"image,omitempty"`
294
+
156
295
// network is the status of the VPC network resources for extended VPC Infrastructure support.
157
296
// +optional
158
297
Network * VPCNetworkStatus `json:"network,omitempty"`
@@ -180,11 +319,36 @@ type IBMVPCClusterStatus struct {
180
319
181
320
// VPCNetworkStatus provides details on the status of VPC network resources for extended VPC Infrastructure support.
182
321
type VPCNetworkStatus struct {
322
+ // controlPlaneSubnets references the VPC Subnets for the cluster's Control Plane.
323
+ // The map simplifies lookups.
324
+ // +optional
325
+ ControlPlaneSubnets map [string ]* ResourceStatus `json:"controlPlaneSubnets,omitempty"`
326
+
327
+ // loadBalancers references the VPC Load Balancer's for the cluster.
328
+ // The map simplifies lookups.
329
+ // +optional
330
+ LoadBalancers map [string ]* VPCLoadBalancerStatus `json:"loadBalancers,omitempty"`
331
+
332
+ // publicGateways references the VPC Public Gateways for the cluster.
333
+ // The map simplifies lookups.
334
+ // +optional
335
+ PublicGateways map [string ]* ResourceStatus `json:"publicGateways,omitempty"`
336
+
183
337
// resourceGroup references the Resource Group for Network resources for the cluster.
184
338
// This can be the same or unique from the cluster's Resource Group.
185
339
// +optional
186
340
ResourceGroup * ResourceStatus `json:"resourceGroup,omitempty"`
187
341
342
+ // securityGroups references the VPC Security Groups for the cluster.
343
+ // The map simplifies lookups.
344
+ // +optional
345
+ SecurityGroups map [string ]* ResourceStatus `json:"securityGroups,omitempty"`
346
+
347
+ // workerSubnets references the VPC Subnets for the cluster's Data Plane.
348
+ // The map simplifies lookups.
349
+ // +optional
350
+ WorkerSubnets map [string ]* ResourceStatus `json:"workerSubnets,omitempty"`
351
+
188
352
// vpc references the status of the IBM Cloud VPC as part of the extended VPC Infrastructure support.
189
353
// +optional
190
354
VPC * ResourceStatus `json:"vpc,omitempty"`
0 commit comments