Skip to content

Commit 6c7a301

Browse files
committed
API changes to support infra creation
1 parent 7f4aef3 commit 6c7a301

10 files changed

+556
-49
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: 68 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: 85 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,82 @@ 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.
41+
// when the field is omitted, A DHCP service will be created in the service instance and its private network will be used.
4342
Network IBMPowerVSResourceReference `json:"network"`
4443

4544
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
4645
// +optional
4746
ControlPlaneEndpoint capiv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`
47+
48+
// serviceInstance is the reference to the Power VS service on which the server instance(VM) will be created.
49+
// Power VS service is a container for all Power VS instances at a specific geographic region.
50+
// serviceInstance can be created via IBM Cloud catalog or CLI.
51+
// supported serviceInstance identifier in PowerVSResource are Name and ID and that can be obtained from IBM Cloud UI or IBM Cloud cli.
52+
// More detail about Power VS service instance.
53+
// https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server
54+
// when omitted system will dynamically create the service instance
55+
// +optional
56+
ServiceInstance *IBMPowerVSResourceReference `json:"serviceInstance,omitempty"`
57+
58+
// zone is the name of Power VS zone where the cluster will be created
59+
// possible values can be found here https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server.
60+
// when value for serviceInstance is omitted its required to set the value for zone.
61+
// +optional
62+
Zone *string `json:"zone,omitempty"`
63+
64+
// resourceGroup name under which the resources will be created.
65+
// when omitted Default resource group will be used.
66+
// +optional
67+
ResourceGroup *string `json:"resourceGroup,omitempty"`
68+
69+
// vpc contains information about IBM Cloud VPC resources
70+
// +optional
71+
VPC *VPCResourceReference `json:"vpc,omitempty"`
72+
73+
// transitGateway contains information about IBM Cloud TransitGateway.
74+
// +optional
75+
TransitGateway *TransitGateway `json:"transitGateway,omitempty"`
76+
77+
// controlPlaneLoadBalancer is optional configuration for customizing control plane behavior.
78+
// Its name reference to IBM Cloud VPC LoadBalancer service.
79+
// +optional
80+
ControlPlaneLoadBalancer *VPCLoadBalancerSpec `json:"controlPlaneLoadBalancer,omitempty"`
4881
}
4982

5083
// IBMPowerVSClusterStatus defines the observed state of IBMPowerVSCluster.
5184
type IBMPowerVSClusterStatus struct {
52-
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
53-
// Important: Run "make" to regenerate code after modifying this file
85+
// ready is true when the provider resource is ready.
5486
Ready bool `json:"ready"`
87+
88+
// serviceInstanceID is the reference to the Power VS service on which the server instance(VM) will be created.
89+
ServiceInstanceID *string `json:"serviceInstanceID,omitempty"`
90+
91+
// networkID is the reference to the Power VS network to use for this cluster.
92+
NetworkID *string `json:"networkID,omitempty"`
93+
94+
// dhcpServerID is the reference to the Power VS DHCP server.
95+
DHCPServerID *string `json:"dhcpServerID,omitempty"`
96+
97+
// vpcID is reference to IBM Cloud VPC resources.
98+
VPCID *string `json:"vpcID,omitempty"`
99+
100+
// vpcSubnetID is reference to IBM Cloud VPC subnet.
101+
VPCSubnetID *string `json:"vpcSubnetID,omitempty"`
102+
103+
// transitGatewayID is reference to IBM Cloud TransitGateway.
104+
TransitGatewayID *string `json:"transitGatewayID,omitempty"`
105+
106+
// ControlPlaneLoadBalancer reference to IBM Cloud VPC Loadbalancer.
107+
ControlPlaneLoadBalancer *VPCLoadBalancerStatus `json:"controlPlaneLoadBalancer,omitempty"`
108+
109+
// Conditions defines current service state of the IBMPowerVSCluster.
110+
Conditions capiv1beta1.Conditions `json:"conditions,omitempty"`
55111
}
56112

57113
// +kubebuilder:object:root=true
@@ -81,6 +137,30 @@ type IBMPowerVSClusterList struct {
81137
Items []IBMPowerVSCluster `json:"items"`
82138
}
83139

140+
// TransitGateway holds the TransitGateway information.
141+
type TransitGateway struct {
142+
Name *string `json:"name,omitempty"`
143+
ID *string `json:"id,omitempty"`
144+
}
145+
146+
// VPCResourceReference is a reference to a specific VPC resource by ID or Name
147+
// Only one of ID or Name may be specified. Specifying more than one will result in
148+
// a validation error.
149+
type VPCResourceReference struct {
150+
// ID of resource
151+
// +kubebuilder:validation:MinLength=1
152+
// +optional
153+
ID *string `json:"id,omitempty"`
154+
155+
// Name of resource
156+
// +kubebuilder:validation:MinLength=1
157+
// +optional
158+
Name *string `json:"name,omitempty"`
159+
160+
// IBM Cloud VPC zone
161+
Zone *string `json:"zone,omitempty"`
162+
}
163+
84164
func init() {
85165
SchemeBuilder.Register(&IBMPowerVSCluster{}, &IBMPowerVSClusterList{})
86166
}

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)