Skip to content

Commit 5f202fe

Browse files
committed
API changes to support infra creation
1 parent 7f4aef3 commit 5f202fe

9 files changed

+508
-46
lines changed

api/v1beta1/ibmpowervs_conversion.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,14 @@ func Convert_v1beta2_IBMPowerVSMachineSpec_To_v1beta1_IBMPowerVSMachineSpec(in *
193193

194194
return autoConvert_v1beta2_IBMPowerVSMachineSpec_To_v1beta1_IBMPowerVSMachineSpec(in, out, s)
195195
}
196+
197+
func Convert_v1beta2_IBMPowerVSClusterSpec_To_v1beta1_IBMPowerVSClusterSpec(in *infrav1beta2.IBMPowerVSClusterSpec, out *IBMPowerVSClusterSpec, s apiconversion.Scope) error {
198+
if in.ServiceInstance.ID != nil {
199+
out.ServiceInstanceID = *in.ServiceInstance.ID
200+
}
201+
return autoConvert_v1beta2_IBMPowerVSClusterSpec_To_v1beta1_IBMPowerVSClusterSpec(in, out, s)
202+
}
203+
204+
func Convert_v1beta2_IBMPowerVSClusterStatus_To_v1beta1_IBMPowerVSClusterStatus(in *infrav1beta2.IBMPowerVSClusterStatus, out *IBMPowerVSClusterStatus, s apiconversion.Scope) error {
205+
return autoConvert_v1beta2_IBMPowerVSClusterStatus_To_v1beta1_IBMPowerVSClusterStatus(in, out, s)
206+
}

api/v1beta1/zz_generated.conversion.go

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

api/v1beta2/ibmpowervscluster_types.go

Lines changed: 71 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ const (
3232

3333
// IBMPowerVSClusterSpec defines the desired state of IBMPowerVSCluster.
3434
type IBMPowerVSClusterSpec struct {
35-
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
36-
// Important: Run "make" to regenerate code after modifying this file
37-
3835
// ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed.
3936
// +kubebuilder:validation:MinLength=1
37+
// Deprecated: use ServiceInstance instead
4038
ServiceInstanceID string `json:"serviceInstanceID"`
4139

4240
// Network is the reference to the Network to use for this cluster.
@@ -45,13 +43,61 @@ type IBMPowerVSClusterSpec struct {
4543
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
4644
// +optional
4745
ControlPlaneEndpoint capiv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
46+
47+
// serviceInstance is the reference to the Power VS service on which the server instance(VM) will be created.
48+
// Power VS service is a container for all Power VS instances at a specific geographic region.
49+
// serviceInstance can be created via IBM Cloud catalog or CLI.
50+
// supported serviceInstance identifier in PowerVSResource are Name and ID and that can be obtained from IBM Cloud UI or IBM Cloud cli.
51+
// More detail about Power VS service instance.
52+
// https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server
53+
// when omitted system will dynamically create the service instance
54+
// +optional
55+
ServiceInstance IBMPowerVSResourceReference `json:"serviceInstance"`
56+
57+
// zone is the name of Power VS zone where the cluster will be created
58+
Zone string `json:"zone"`
59+
60+
// resourceGroup name under which the resources will be created.
61+
ResourceGroup string `json:"resourceGroup"`
62+
63+
// vpc contains information about IBM Cloud VPC resources
64+
// +optional
65+
VPC VPCResource `json:"vpc,omitempty"`
66+
67+
// transitGateway contains information about IBM Cloud TransitGateway.
68+
// +optional
69+
TransitGateway TransitGateway `json:"transitGateway,omitempty"`
70+
71+
// controlPlaneLoadBalancer is optional configuration for customizing control plane behavior.
72+
// +optional
73+
ControlPlaneLoadBalancer *VPCLoadBalancerSpec `json:"controlPlaneLoadBalancer,omitempty"`
4874
}
4975

5076
// IBMPowerVSClusterStatus defines the observed state of IBMPowerVSCluster.
5177
type IBMPowerVSClusterStatus struct {
52-
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
53-
// Important: Run "make" to regenerate code after modifying this file
78+
// ready is true when the provider resource is ready.
5479
Ready bool `json:"ready"`
80+
81+
// serviceInstanceID is the reference to the Power VS service on which the server instance(VM) will be created.
82+
ServiceInstanceID *string `json:"serviceInstanceID,omitempty"`
83+
84+
// networkID is the reference to the Power VS network to use for this cluster.
85+
NetworkID *string `json:"networkID,omitempty"`
86+
87+
// vpcID is reference to IBM Cloud VPC resources.
88+
VpcID *string `json:"vpcID,omitempty"`
89+
90+
// vpcSubnetID is reference to IBM Cloud VPC subnet.
91+
VPCSubnetID *string `json:"vpcSubnetID,omitempty"`
92+
93+
// transitGatewayID is reference to IBM Cloud TransitGateway.
94+
TransitGatewayID *string `json:"transitGatewayID,omitempty"`
95+
96+
// ControlPlaneLoadBalancer reference to IBM Cloud VPC Loadbalancer.
97+
ControlPlaneLoadBalancer *VPCLoadBalancerStatus `json:"controlPlaneLoadBalancer,omitempty"`
98+
99+
// Conditions defines current service state of the IBMPowerVSCluster.
100+
Conditions capiv1beta1.Conditions `json:"conditions,omitempty"`
55101
}
56102

57103
// +kubebuilder:object:root=true
@@ -81,6 +127,26 @@ type IBMPowerVSClusterList struct {
81127
Items []IBMPowerVSCluster `json:"items"`
82128
}
83129

130+
// VPCResource holds the VPC information.
131+
type VPCResource struct {
132+
// Name of VPC
133+
// +optional
134+
Name string `json:"name,omitempty"`
135+
136+
// IBM Cloud VPC zone where the cluster's loadbalancers will be created
137+
Zone string `json:"vpcZone"`
138+
139+
// Subnet contains the details about subnet
140+
// +optional
141+
Subnet Subnet `json:"subnet,omitempty"`
142+
}
143+
144+
// TransitGateway holds the TransitGateway information
145+
type TransitGateway struct {
146+
Name *string `json:"name,omitempty"`
147+
ID *string `json:"id,omitempty"`
148+
}
149+
84150
func init() {
85151
SchemeBuilder.Register(&IBMPowerVSCluster{}, &IBMPowerVSClusterList{})
86152
}

api/v1beta2/ibmvpccluster_types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ type VPCLoadBalancerSpec struct {
6565
Name string `json:"name,omitempty"`
6666
}
6767

68+
// VPCLoadBalancerStatus defines the status VPC load balancer.
69+
type VPCLoadBalancerStatus struct {
70+
// ID of VPC load balancer.
71+
// +optional
72+
ID *string `json:"id,omitempty"`
73+
// State is the status of the load balancer.
74+
State VPCLoadBalancerState `json:"state,omitempty"`
75+
}
76+
6877
// IBMVPCClusterStatus defines the observed state of IBMVPCCluster.
6978
type IBMVPCClusterStatus struct {
7079
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster

api/v1beta2/types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ type NetworkInterface struct {
8383

8484
// Subnet describes a subnet.
8585
type Subnet struct {
86-
Ipv4CidrBlock *string `json:"cidr"`
87-
Name *string `json:"name"`
88-
ID *string `json:"id"`
89-
Zone *string `json:"zone"`
86+
Ipv4CidrBlock *string `json:"cidr,omitempty"`
87+
Name *string `json:"name,omitempty"`
88+
ID *string `json:"id,omitempty"`
89+
Zone *string `json:"zone,omitempty"`
9090
}
9191

9292
// VPCEndpoint describes a VPCEndpoint.

0 commit comments

Comments
 (0)