Skip to content

Commit a2d2a73

Browse files
committed
API changes to support infra creation
1 parent d027371 commit a2d2a73

16 files changed

+1175
-91
lines changed

api/v1beta1/ibmpowervs_conversion.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,18 @@ 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+
}
207+
208+
func Convert_v1beta2_IBMPowerVSImageSpec_To_v1beta1_IBMPowerVSImageSpec(in *infrav1beta2.IBMPowerVSImageSpec, out *IBMPowerVSImageSpec, s apiconversion.Scope) error {
209+
return autoConvert_v1beta2_IBMPowerVSImageSpec_To_v1beta1_IBMPowerVSImageSpec(in, out, s)
210+
}

api/v1beta1/ibmvpc_conversion.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,7 @@ func Convert_Slice_Pointer_v1beta2_IBMVPCResourceReference_To_Slice_Pointer_stri
215215
}
216216
return nil
217217
}
218+
219+
func Convert_v1beta2_VPCLoadBalancerSpec_To_v1beta1_VPCLoadBalancerSpec(in *infrav1beta2.VPCLoadBalancerSpec, out *VPCLoadBalancerSpec, s apiconversion.Scope) error {
220+
return autoConvert_v1beta2_VPCLoadBalancerSpec_To_v1beta1_VPCLoadBalancerSpec(in, out, s)
221+
}

api/v1beta1/zz_generated.conversion.go

Lines changed: 147 additions & 50 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: 145 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,104 @@ 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.
39-
// +kubebuilder:validation:MinLength=1
36+
// Deprecated: use ServiceInstance instead
4037
ServiceInstanceID string `json:"serviceInstanceID"`
4138

4239
// 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 service instance and its private network will be used.
4341
Network IBMPowerVSResourceReference `json:"network"`
4442

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,omitempty"`
56+
57+
// zone is the name of Power VS zone where the cluster will be created
58+
// possible values can be found here https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server.
59+
// when value for serviceInstance is omitted its required to set the value for zone.
60+
// +optional
61+
Zone *string `json:"zone,omitempty"`
62+
63+
// resourceGroup name under which the resources will be created.
64+
// when omitted Default resource group will be used.
65+
// +optional
66+
ResourceGroup *string `json:"resourceGroup,omitempty"`
67+
68+
// vpc contains information about IBM Cloud VPC resources
69+
// +optional
70+
VPC *VPCResourceReference `json:"vpc,omitempty"`
71+
72+
// vpcSubnets contains information about IBM Cloud VPC Subnet resources
73+
// +optional
74+
VPCSubnets []Subnet `json:"vpcSubnets,omitempty"`
75+
76+
// transitGateway contains information about IBM Cloud TransitGateway.
77+
// +optional
78+
TransitGateway *TransitGateway `json:"transitGateway,omitempty"`
79+
80+
// loadBalancers is optional configuration for configuring loadbalancers to control plane or data plane nodes.
81+
// +optional
82+
LoadBalancers []VPCLoadBalancerSpec `json:"loadBalancers,omitempty"`
83+
84+
// cosInstance contains options to configure a supporting IBM Cloud COS bucket for this
85+
// cluster - currently used for nodes requiring Ignition
86+
// (https://coreos.github.io/ignition/) for bootstrapping (requires
87+
// BootstrapFormatIgnition feature flag to be enabled).
88+
// +optional
89+
CosInstance *CosInstance `json:"cosInstance,omitempty"`
90+
}
91+
92+
// ResourceReference identifies a resource with id.
93+
type ResourceReference struct {
94+
// id represents the id of the resource.
95+
ID *string `json:"id,omitempty"`
96+
// +kubebuilder:default=false
97+
// controllerCreated indicates whether the resource is created by the controller.
98+
ControllerCreated *bool `json:"controllerCreated,omitempty"`
4899
}
49100

50101
// IBMPowerVSClusterStatus defines the observed state of IBMPowerVSCluster.
51102
type IBMPowerVSClusterStatus struct {
52-
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
53-
// Important: Run "make" to regenerate code after modifying this file
103+
// ready is true when the provider resource is ready.
104+
// +kubebuilder:default=false
54105
Ready bool `json:"ready"`
106+
107+
// serviceInstance is the reference to the Power VS service on which the server instance(VM) will be created.
108+
ServiceInstance *ResourceReference `json:"serviceInstance,omitempty"`
109+
110+
// networkID is the reference to the Power VS network to use for this cluster.
111+
Network *ResourceReference `json:"network,omitempty"`
112+
113+
// dhcpServer is the reference to the Power VS DHCP server.
114+
DHCPServer *ResourceReference `json:"dhcpServer,omitempty"`
115+
116+
// vpc is reference to IBM Cloud VPC resources.
117+
VPC *ResourceReference `json:"vpc,omitempty"`
118+
119+
// vpcSubnet is reference to IBM Cloud VPC subnet.
120+
VPCSubnet map[string]ResourceReference `json:"vpcSubnet,omitempty"`
121+
122+
// transitGateway is reference to IBM Cloud TransitGateway.
123+
TransitGateway *ResourceReference `json:"transitGateway,omitempty"`
124+
125+
// cosBucket is reference to IBM Cloud COS Bucket resource.
126+
COSBucket *ResourceReference `json:"cosBucket,omitempty"`
127+
128+
// loadBalancers reference to IBM Cloud VPC Loadbalancer.
129+
LoadBalancers map[string]VPCLoadBalancerStatus `json:"loadBalancers,omitempty"`
130+
131+
// Conditions defines current service state of the IBMPowerVSCluster.
132+
Conditions capiv1beta1.Conditions `json:"conditions,omitempty"`
55133
}
56134

57135
// +kubebuilder:object:root=true
@@ -81,6 +159,67 @@ type IBMPowerVSClusterList struct {
81159
Items []IBMPowerVSCluster `json:"items"`
82160
}
83161

162+
// TransitGateway holds the TransitGateway information.
163+
type TransitGateway struct {
164+
Name *string `json:"name,omitempty"`
165+
ID *string `json:"id,omitempty"`
166+
}
167+
168+
// VPCResourceReference is a reference to a specific VPC resource by ID or Name
169+
// Only one of ID or Name may be specified. Specifying more than one will result in
170+
// a validation error.
171+
type VPCResourceReference struct {
172+
// ID of resource
173+
// +kubebuilder:validation:MinLength=1
174+
// +optional
175+
ID *string `json:"id,omitempty"`
176+
177+
// Name of resource
178+
// +kubebuilder:validation:MinLength=1
179+
// +optional
180+
Name *string `json:"name,omitempty"`
181+
182+
// IBM Cloud VPC zone
183+
Zone *string `json:"zone,omitempty"`
184+
185+
// IBM Cloud VPC region
186+
Region *string `json:"region,omitempty"`
187+
}
188+
189+
// CosInstance represents IBM Cloud COS instance.
190+
type CosInstance struct {
191+
// PresignedURLDuration defines the duration for which presigned URLs are valid.
192+
//
193+
// This is used to generate presigned URLs for S3 Bucket objects, which are used by
194+
// control-plane and worker nodes to fetch bootstrap data.
195+
//
196+
// When enabled, the IAM instance profiles specified are not used.
197+
// +optional
198+
PresignedURLDuration *metav1.Duration `json:"presignedURLDuration,omitempty"`
199+
200+
// Name defines name of IBM cloud COS instance to be created.
201+
// +kubebuilder:validation:MinLength:=3
202+
// +kubebuilder:validation:MaxLength:=63
203+
// +kubebuilder:validation:Pattern=`^[a-z0-9][a-z0-9.-]{1,61}[a-z0-9]$`
204+
Name string `json:"name,omitempty"`
205+
206+
// bucketName is IBM cloud COS bucket name
207+
BucketName string `json:"bucketName,omitempty"`
208+
209+
// bucketRegion is IBM cloud COS bucket region
210+
BucketRegion string `json:"bucketRegion,omitempty"`
211+
}
212+
213+
// GetConditions returns the observations of the operational state of the IBMPowerVSCluster resource.
214+
func (r *IBMPowerVSCluster) GetConditions() capiv1beta1.Conditions {
215+
return r.Status.Conditions
216+
}
217+
218+
// SetConditions sets the underlying service state of the IBMPowerVSCluster to the predescribed clusterv1.Conditions.
219+
func (r *IBMPowerVSCluster) SetConditions(conditions capiv1beta1.Conditions) {
220+
r.Status.Conditions = conditions
221+
}
222+
84223
func init() {
85224
SchemeBuilder.Register(&IBMPowerVSCluster{}, &IBMPowerVSClusterList{})
86225
}

api/v1beta2/ibmpowervsimage_types.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,19 @@ type IBMPowerVSImageSpec struct {
3838
ClusterName string `json:"clusterName"`
3939

4040
// ServiceInstanceID is the id of the power cloud instance where the image will get imported.
41+
// Deprecated: use ServiceInstance instead
4142
ServiceInstanceID string `json:"serviceInstanceID"`
4243

44+
// serviceInstance is the reference to the Power VS service on which the server instance(VM) will be created.
45+
// Power VS service is a container for all Power VS instances at a specific geographic region.
46+
// serviceInstance can be created via IBM Cloud catalog or CLI.
47+
// supported serviceInstance identifier in PowerVSResource are Name and ID and that can be obtained from IBM Cloud UI or IBM Cloud cli.
48+
// More detail about Power VS service instance.
49+
// https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server
50+
// when omitted system will dynamically create the service instance
51+
// +optional
52+
ServiceInstance *IBMPowerVSResourceReference `json:"serviceInstance,omitempty"`
53+
4354
// Cloud Object Storage bucket name; bucket-name[/optional/folder]
4455
Bucket *string `json:"bucket"`
4556

api/v1beta2/ibmpowervsmachine_types.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,19 @@ type IBMPowerVSMachineSpec struct {
4848
// Important: Run "make" to regenerate code after modifying this file
4949

5050
// ServiceInstanceID is the id of the power cloud instance where the vsi instance will get deployed.
51-
// +kubebuilder:validation:MinLength=1
51+
// Deprecated: use ServiceInstance instead
5252
ServiceInstanceID string `json:"serviceInstanceID"`
5353

54+
// serviceInstance is the reference to the Power VS service on which the server instance(VM) will be created.
55+
// Power VS service is a container for all Power VS instances at a specific geographic region.
56+
// serviceInstance can be created via IBM Cloud catalog or CLI.
57+
// supported serviceInstance identifier in PowerVSResource are Name and ID and that can be obtained from IBM Cloud UI or IBM Cloud cli.
58+
// More detail about Power VS service instance.
59+
// https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server
60+
// when omitted system will dynamically create the service instance
61+
// +optional
62+
ServiceInstance *IBMPowerVSResourceReference `json:"serviceInstance,omitempty"`
63+
5464
// SSHKey is the name of the SSH key pair provided to the vsi for authenticating users.
5565
SSHKey string `json:"sshKey,omitempty"`
5666

@@ -121,6 +131,20 @@ type IBMPowerVSMachineSpec struct {
121131
// ProviderID is the unique identifier as specified by the cloud provider.
122132
// +optional
123133
ProviderID *string `json:"providerID,omitempty"`
134+
135+
// Ignition defined options related to the bootstrapping systems where Ignition is used.
136+
// +optional
137+
Ignition *Ignition `json:"ignition,omitempty"`
138+
}
139+
140+
// Ignition defines options related to the bootstrapping systems where Ignition is used.
141+
type Ignition struct {
142+
// Version defines which version of Ignition will be used to generate bootstrap data.
143+
//
144+
// +optional
145+
// +kubebuilder:default="2.3"
146+
// +kubebuilder:validation:Enum="2.3";"3.0";"3.1";"3.2";"3.3";"3.4"
147+
Version string `json:"version,omitempty"`
124148
}
125149

126150
// IBMPowerVSResourceReference is a reference to a specific PowerVS resource by ID, Name or RegEx

api/v1beta2/ibmvpccluster_types.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,25 @@ type VPCLoadBalancerSpec struct {
6363
// +kubebuilder:validation:Pattern=`^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$`
6464
// +optional
6565
Name string `json:"name,omitempty"`
66+
67+
// public indicates that load balancer is public or private
68+
// +kubebuilder:default=true
69+
// +optional
70+
Public bool `json:"public,omitempty"`
71+
}
72+
73+
// LoadBalancerScheme defines the scheme of a load balancer.
74+
type LoadBalancerScheme string
75+
76+
// VPCLoadBalancerStatus defines the status VPC load balancer.
77+
type VPCLoadBalancerStatus struct {
78+
// ID of VPC load balancer.
79+
// +optional
80+
ID *string `json:"id,omitempty"`
81+
// +optional
82+
Name *string `json:"name,omitempty"`
83+
// State is the status of the load balancer.
84+
State VPCLoadBalancerState `json:"state,omitempty"`
6685
}
6786

6887
// IBMVPCClusterStatus defines the observed state of IBMVPCCluster.

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)