Skip to content

Commit 8f8ed21

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

16 files changed

+1311
-92
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: 148 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: 147 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,109 @@ 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 Power VS server workspace 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 server workspace on which the server instance(VM) will be created.
48+
// Power VS server workspace 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 omitted syd04 will be set as default zone.
60+
// +kubebuilder:default=dal10
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 of the account 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+
// vpcSubnets contains information about IBM Cloud VPC Subnet resources.
74+
// +optional
75+
VPCSubnets []Subnet `json:"vpcSubnets,omitempty"`
76+
77+
// transitGateway contains information about IBM Cloud TransitGateway
78+
// IBM Cloud TransitGateway helps in establishing network connectivity between IBM Cloud Power VS and VPC infrastructure
79+
// more information about TransitGateway can be found here https://www.ibm.com/products/transit-gateway.
80+
// +optional
81+
TransitGateway *TransitGateway `json:"transitGateway,omitempty"`
82+
83+
// loadBalancers is optional configuration for configuring loadbalancers to control plane or data plane nodes
84+
// when specified a vpc loadbalancer will be created and controlPlaneEndpoint will be set with associated hostname of loadbalancer.
85+
// when omitted user is expected to set controlPlaneEndpoint.
86+
// +optional
87+
LoadBalancers []VPCLoadBalancerSpec `json:"loadBalancers,omitempty"`
88+
89+
// cosInstance contains options to configure a supporting IBM Cloud COS bucket for this
90+
// cluster - currently used for nodes requiring Ignition
91+
// (https://coreos.github.io/ignition/) for bootstrapping (requires
92+
// BootstrapFormatIgnition feature flag to be enabled).
93+
// +optional
94+
CosInstance *CosInstance `json:"cosInstance,omitempty"`
95+
}
96+
97+
// ResourceReference identifies a resource with id.
98+
type ResourceReference struct {
99+
// id represents the id of the resource.
100+
ID *string `json:"id,omitempty"`
101+
// +kubebuilder:default=false
102+
// controllerCreated indicates whether the resource is created by the controller.
103+
ControllerCreated *bool `json:"controllerCreated,omitempty"`
48104
}
49105

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

57140
// +kubebuilder:object:root=true
@@ -81,6 +164,64 @@ type IBMPowerVSClusterList struct {
81164
Items []IBMPowerVSCluster `json:"items"`
82165
}
83166

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

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 workspace on which the server instance(VM) will be created.
45+
// Power VS workspace 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 workspace on which the server instance(VM) will be created.
55+
// Power VS workspace 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: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,40 @@ 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+
// AdditionalListeners sets the additional listeners for the control plane load balancer. .
73+
// +listType=map
74+
// +listMapKey=port
75+
// +optional
76+
AdditionalListeners []AdditionalListenerSpec `json:"additionalListeners,omitempty"`
77+
}
78+
79+
// AdditionalListenerSpec defines the desired state of an
80+
// additional listener on an VPC load balancer.
81+
type AdditionalListenerSpec struct {
82+
// Port sets the port for the additional listener.
83+
// +kubebuilder:validation:Minimum=1
84+
// +kubebuilder:validation:Maximum=65535
85+
Port int64 `json:"port"`
86+
}
87+
88+
// VPCLoadBalancerStatus defines the status VPC load balancer.
89+
type VPCLoadBalancerStatus struct {
90+
// id of VPC load balancer.
91+
// +optional
92+
ID *string `json:"id,omitempty"`
93+
// +optional
94+
Name *string `json:"name,omitempty"`
95+
// State is the status of the load balancer.
96+
State VPCLoadBalancerState `json:"state,omitempty"`
97+
// hostname is the hostname of load balancer.
98+
// +optional
99+
Hostname *string `json:"hostname,omitempty"`
66100
}
67101

68102
// 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)