Skip to content

Commit d9fc54c

Browse files
committed
2 parents 29511df + 9b07704 commit d9fc54c

35 files changed

+4439
-795
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ cmd/clusterctl/examples/ibmcloud/provider-component/user-data/ubuntu/worker-user
2222

2323
# test coverage out
2424
cover.out
25+
cover.html
26+
cover.txt
2527

2628
# JUnit test output from ginkgo unit tests
2729
junit*.xml

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ RELEASE_DIR := out
6363
OUTPUT_TYPE ?= type=registry
6464

6565
# Go
66-
GO_VERSION ?=1.22.7
66+
GO_VERSION ?=1.22.8
6767
GO_CONTAINER_IMAGE ?= golang:$(GO_VERSION)
6868

6969
# kind

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ This provider's versions are compatible with the following versions of Cluster A
6161
If you have questions or want to get the latest project news, you can connect with us in the following ways:
6262

6363
- Chat with us on the Kubernetes [Slack](http://slack.k8s.io/) in the [#cluster-api-ibmcloud][slack] channel
64-
- Subscribe to the [SIG Cluster Lifecycle](https://groups.google.com/forum/#!forum/kubernetes-sig-cluster-lifecycle) Google Group for access to documents and calendars
65-
- Join our Weekly meeting sessions where we share the latest project news, demos, answer questions, and triage issues
66-
- Biweekly on Friday @ 09:00 IST on [Zoom][zoomMeeting]
64+
- Subscribe to the [SIG Cluster Lifecycle](https://groups.google.com/a/kubernetes.io/g/sig-cluster-lifecycle) Google Group for access to documents and calendars
65+
- Join our Bi-Weekly meeting sessions where we share the latest project news, demos, answer questions, and triage issues
66+
- Biweekly on Tuesday @ 10:00 IST on [Zoom][zoomMeeting]. ([Convert to your timezone][convert-time-zone])
6767
- Previous meetings: \[ [notes][notes] \]
6868

6969
Pull Requests and feedback on issues are very welcome!
@@ -73,13 +73,14 @@ also feel free to reach out to discuss.
7373
See also our [contributor guide](CONTRIBUTING.md) and the Kubernetes [community page] for more details on how to get involved.
7474

7575
[slack]: https://kubernetes.slack.com/messages/C02F4CX3ALF
76-
[zoomMeeting]: https://zoom.us/j/9392903494
77-
[notes]: https://docs.google.com/document/d/1oWnqXy1VFv0E3kovQoZfS6IlVP0L4eaQsN-2HYC_6_A/edit
76+
[zoomMeeting]: https://zoom.us/j/508079177
77+
[notes]: https://cluster-api-ibmcloud.sigs.k8s.io/agenda
7878
[issue tracker]: https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/issues
7979
[Good first issue]: https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22
8080
[Help wanted]: https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22+
8181
[community page]: https://kubernetes.io/community
8282
[cluster-api-supported-v]: https://cluster-api.sigs.k8s.io/reference/versions.html
83+
[convert-time-zone]: http://www.thetimezoneconverter.com/?t=10%3A00&tz=IST
8384

8485
### Code of conduct
8586

api/v1beta1/ibmvpc_conversion.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,11 @@ func Convert_v1beta2_IBMVPCClusterSpec_To_v1beta1_IBMVPCClusterSpec(in *infrav1b
231231
func Convert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus(in *infrav1beta2.IBMVPCClusterStatus, out *IBMVPCClusterStatus, s apiconversion.Scope) error {
232232
return autoConvert_v1beta2_IBMVPCClusterStatus_To_v1beta1_IBMVPCClusterStatus(in, out, s)
233233
}
234+
235+
func Convert_v1beta2_IBMVPCMachineStatus_To_v1beta1_IBMVPCMachineStatus(in *infrav1beta2.IBMVPCMachineStatus, out *IBMVPCMachineStatus, s apiconversion.Scope) error {
236+
return autoConvert_v1beta2_IBMVPCMachineStatus_To_v1beta1_IBMVPCMachineStatus(in, out, s)
237+
}
238+
239+
func Convert_v1beta2_NetworkInterface_To_v1beta1_NetworkInterface(in *infrav1beta2.NetworkInterface, out *NetworkInterface, s apiconversion.Scope) error {
240+
return autoConvert_v1beta2_NetworkInterface_To_v1beta1_NetworkInterface(in, out, s)
241+
}

api/v1beta1/zz_generated.conversion.go

Lines changed: 18 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1beta2/ibmpowervscluster_webhook.go

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,34 @@ func (r *IBMPowerVSCluster) validateIBMPowerVSClusterNetwork() *field.Error {
102102
return nil
103103
}
104104

105+
func (r *IBMPowerVSCluster) validateIBMPowerVSClusterLoadBalancers() (allErrs field.ErrorList) {
106+
if err := r.validateIBMPowerVSClusterLoadBalancerNames(); err != nil {
107+
allErrs = append(allErrs, err...)
108+
}
109+
110+
if len(r.Spec.LoadBalancers) == 0 {
111+
return allErrs
112+
}
113+
114+
for _, loadbalancer := range r.Spec.LoadBalancers {
115+
if *loadbalancer.Public {
116+
return allErrs
117+
}
118+
}
119+
120+
return append(allErrs, field.Invalid(field.NewPath("spec.LoadBalancers"), r.Spec.LoadBalancers, "Expect atleast one of the load balancer to be public"))
121+
}
122+
105123
func (r *IBMPowerVSCluster) validateIBMPowerVSClusterLoadBalancerNames() (allErrs field.ErrorList) {
106124
found := make(map[string]bool)
107125
for i, loadbalancer := range r.Spec.LoadBalancers {
126+
if loadbalancer.Name == "" {
127+
continue
128+
}
129+
108130
if found[loadbalancer.Name] {
109131
allErrs = append(allErrs, field.Duplicate(field.NewPath("spec", fmt.Sprintf("loadbalancers[%d]", i)), map[string]interface{}{"Name": loadbalancer.Name}))
132+
continue
110133
}
111134
found[loadbalancer.Name] = true
112135
}
@@ -117,8 +140,12 @@ func (r *IBMPowerVSCluster) validateIBMPowerVSClusterLoadBalancerNames() (allErr
117140
func (r *IBMPowerVSCluster) validateIBMPowerVSClusterVPCSubnetNames() (allErrs field.ErrorList) {
118141
found := make(map[string]bool)
119142
for i, subnet := range r.Spec.VPCSubnets {
143+
if subnet.Name == nil {
144+
continue
145+
}
120146
if found[*subnet.Name] {
121147
allErrs = append(allErrs, field.Duplicate(field.NewPath("spec", fmt.Sprintf("vpcSubnets[%d]", i)), map[string]interface{}{"Name": *subnet.Name}))
148+
continue
122149
}
123150
found[*subnet.Name] = true
124151
}
@@ -130,6 +157,9 @@ func (r *IBMPowerVSCluster) validateIBMPowerVSClusterTransitGateway() *field.Err
130157
if r.Spec.Zone == nil && r.Spec.VPC == nil {
131158
return nil
132159
}
160+
if r.Spec.TransitGateway == nil {
161+
return nil
162+
}
133163
if _, globalRouting, _ := genUtil.GetTransitGatewayLocationAndRouting(r.Spec.Zone, r.Spec.VPC.Region); r.Spec.TransitGateway.GlobalRouting != nil && !*r.Spec.TransitGateway.GlobalRouting && globalRouting != nil && *globalRouting {
134164
return field.Invalid(field.NewPath("spec.transitGateway.globalRouting"), r.Spec.TransitGateway.GlobalRouting, "global routing is required since PowerVS and VPC region are from different region")
135165
}
@@ -183,7 +213,7 @@ func (r *IBMPowerVSCluster) validateIBMPowerVSClusterCreateInfraPrereq() (allErr
183213
allErrs = append(allErrs, err...)
184214
}
185215

186-
if err := r.validateIBMPowerVSClusterLoadBalancerNames(); err != nil {
216+
if err := r.validateIBMPowerVSClusterLoadBalancers(); err != nil {
187217
allErrs = append(allErrs, err...)
188218
}
189219

api/v1beta2/ibmvpcmachine_types.go

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ package v1beta2
1919
import (
2020
corev1 "k8s.io/api/core/v1"
2121
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
22+
23+
capiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
24+
"sigs.k8s.io/cluster-api/errors"
2225
)
2326

2427
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
@@ -30,16 +33,29 @@ const (
3033

3134
// IBMVPCMachineSpec defines the desired state of IBMVPCMachine.
3235
type IBMVPCMachineSpec struct {
33-
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
36+
// INSERT ADDITIONAL SPEC FIELDS - desired state of machine.
3437
// Important: Run "make" to regenerate code after modifying this file
3538

3639
// Name of the instance.
3740
Name string `json:"name,omitempty"`
3841

42+
// CatalogOffering is the Catalog Offering OS image which would be installed on the instance.
43+
// An OfferingCRN or VersionCRN is required, the PlanCRN is optional.
44+
// +optional
45+
CatalogOffering *IBMCloudCatalogOffering `json:"catalogOffering,omitempty"`
46+
47+
// PlacementTarget is the placement restrictions to use for the virtual server instance. No restrictions are used when this field is not defined.
48+
// +optional
49+
PlacementTarget *VPCMachinePlacementTarget `json:"placementTarget,omitempty"`
50+
3951
// Image is the OS image which would be install on the instance.
4052
// ID will take higher precedence over Name if both specified.
4153
Image *IBMVPCResourceReference `json:"image"`
4254

55+
// LoadBalancerPoolMembers is the set of IBM Cloud VPC Load Balancer Backend Pools the machine should be added to as a member.
56+
// +optional
57+
LoadBalancerPoolMembers []VPCLoadBalancerBackendPoolMember `json:"loadBalancerPoolMembers,omitempty"`
58+
4359
// Zone is the place where the instance should be created. Example: us-south-3
4460
// TODO: Actually zone is transparent to user. The field user can access is location. Example: Dallas 2
4561
Zone string `json:"zone"`
@@ -126,18 +142,40 @@ type IBMVPCMachineStatus struct {
126142
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
127143
// Important: Run "make" to regenerate code after modifying this file
128144

145+
// InstanceID defines the IBM Cloud VPC Instance UUID.
146+
// +optional
129147
InstanceID string `json:"instanceID,omitempty"`
130148

131149
// Ready is true when the provider resource is ready.
132150
// +optional
133151
Ready bool `json:"ready"`
134152

135-
// Addresses contains the GCP instance associated addresses.
153+
// Addresses contains the IBM Cloud instance associated addresses.
136154
Addresses []corev1.NodeAddress `json:"addresses,omitempty"`
137155

138-
// InstanceStatus is the status of the GCP instance for this machine.
156+
// Conditions deefines current service state of the IBMVPCMachine.
157+
// +optional
158+
Conditions capiv1beta1.Conditions `json:"conditions,omitempty"`
159+
160+
// FailureReason will be set in the event that there is a terminal problem
161+
// reconciling the Machine and will contain a succinct value suitable
162+
// for machine interpretation.
163+
// +optional
164+
FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"`
165+
166+
// FailureMessage will be set in the event that there is a terminal problem
167+
// reconciling the Machine and will contain a more verbose string suitable
168+
// for logging and human consumption.
169+
// +optional
170+
FailureMessage *string `json:"failureMessage,omitempty"`
171+
172+
// InstanceStatus is the status of the IBM Cloud instance for this machine.
139173
// +optional
140174
InstanceStatus string `json:"instanceState,omitempty"`
175+
176+
// LoadBalancerPoolMembers is the status of IBM Cloud VPC Load Balancer Backend Pools the machine is a member.
177+
// +optional
178+
LoadBalancerPoolMembers []VPCLoadBalancerBackendPoolMember `json:"loadBalancerPoolMembers,omitempty"`
141179
}
142180

143181
// +kubebuilder:object:root=true

api/v1beta2/types.go

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ var (
258258
ResourceTypeVPC = ResourceType("vpc")
259259
// ResourceTypeSubnet is VPC subnet resource.
260260
ResourceTypeSubnet = ResourceType("subnet")
261-
// ResourceTypeComputeSubnet is a VPC subnet resource designated for the Compute (Data) Plane.
262-
ResourceTypeComputeSubnet = ResourceType("computeSubnet")
263261
// ResourceTypeControlPlaneSubnet is a VPC subnet resource designated for the Control Plane.
264262
ResourceTypeControlPlaneSubnet = ResourceType("controlPlaneSubnet")
263+
// ResourceTypeWorkerSubnet is a VPC subnet resource designated for the Worker (Data) Plane.
264+
ResourceTypeWorkerSubnet = ResourceType("workerSubnet")
265265
// ResourceTypeSecurityGroup is a VPC Security Group resource.
266266
ResourceTypeSecurityGroup = ResourceType("securityGroup")
267267
// ResourceTypeCOSInstance is IBM COS instance resource.
@@ -356,12 +356,67 @@ type IBMCloudResourceReference struct {
356356
Name *string `json:"name,omitempty"`
357357
}
358358

359+
// IBMCloudCatalogOffering represents an IBM Cloud Catalog Offering resource.
360+
// +kubebuilder:validation:XValidation:rule="(has(self.offeringCRN) && !has(self.versionCRN)) || (!has(self.offeringCRN) && has(self.versionCRN))",message="either offeringCRN or version CRN must be provided, not both"
361+
type IBMCloudCatalogOffering struct {
362+
// OfferingCRN defines the IBM Cloud Catalog Offering CRN. Using the OfferingCRN expects that the latest version of the Offering will be used.
363+
// If a specific version should be used instead, rely on VersionCRN.
364+
// +optional
365+
OfferingCRN *string `json:"offeringCRN,omitempty"`
366+
367+
// PlanCRN defines the IBM Cloud Catalog Offering Plan CRN to use for the Offering.
368+
// +optional
369+
PlanCRN *string `json:"planCRN,omitempty"`
370+
371+
// VersionCRN defines the IBM Cloud Catalog Offering Version CRN. A specific version of the Catalog Offering will be used, as defined by this CRN.
372+
// +optional
373+
VersionCRN *string `json:"versionCRN,omitempty"`
374+
}
375+
359376
// NetworkInterface holds the network interface information like subnet id.
360377
type NetworkInterface struct {
378+
// SecurityGroups defines a set of IBM Cloud VPC Security Groups to attach to the network interface.
379+
// +optional
380+
SecurityGroups []VPCResource `json:"securityGroups,omitempty"`
381+
361382
// Subnet ID of the network interface.
362383
Subnet string `json:"subnet,omitempty"`
363384
}
364385

386+
// VPCLoadBalancerBackendPoolMember represents a VPC Load Balancer Backend Pool Member.
387+
type VPCLoadBalancerBackendPoolMember struct {
388+
// LoadBalancer defines the Load Balancer the Pool Member is for.
389+
// +required
390+
LoadBalancer VPCResource `json:"loadBalancer"`
391+
392+
// Pool defines the Load Balancer Pool the Pool Member should be in.
393+
// +required
394+
Pool VPCResource `json:"pool"`
395+
396+
// Port defines the Port the Load Balancer Pool Member listens for traffic.
397+
// +required
398+
Port int64 `json:"port"`
399+
400+
// Weight of the service member. Only applicable if the pool algorithm is "weighted_round_robin".
401+
// +optional
402+
Weight *int64 `json:"weight,omitempty"`
403+
}
404+
405+
// VPCMachinePlacementTarget represents a VPC Machine's placement restrictions.
406+
// +kubebuilder:validation:XValidation:rule="(has(self.dedicatedHost) && !has(self.dedicatedHostGroup) && !has(self.placementGroup)) || (!has(self.dedicatedHost) && has(self.dedicatedHostGroup) && !has(self.placementGroup)) || (!has(self.dedicatedHost) && !has(self.dedicatedHostGroup) && has(self.placementGroup))",message="only one of dedicatedHost, dedicatedHostGroup, or placementGroup must be defined for machine placement"
407+
type VPCMachinePlacementTarget struct {
408+
// DedicatedHost defines the Dedicated Host to place a VPC Machine (Instance) on.
409+
// +optional
410+
DedicatedHost *VPCResource `json:"dedicatedHost,omitempty"`
411+
412+
// DedicatedHostGroup defines the Dedicated Host Group to use when placing a VPC Machine (Instance).
413+
// +optional
414+
DedicatedHostGroup *VPCResource `json:"dedicatedHostGroup"`
415+
416+
// PlacementGroup defines the Placement Group to use when placing a VPC Machine (Instance).
417+
PlacementGroup *VPCResource `json:"placementGroup,omitempty"`
418+
}
419+
365420
// VPCSecurityGroupPortRange represents a range of ports, minimum to maximum.
366421
// +kubebuilder:validation:XValidation:rule="self.maximumPort >= self.minimumPort",message="maximum port must be greater than or equal to minimum port"
367422
type VPCSecurityGroupPortRange struct {

0 commit comments

Comments
 (0)