Skip to content

Commit

Permalink
API changes to support infra creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik-K-N committed Nov 13, 2023
1 parent 7f4aef3 commit 5f202fe
Show file tree
Hide file tree
Showing 9 changed files with 508 additions and 46 deletions.
11 changes: 11 additions & 0 deletions api/v1beta1/ibmpowervs_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,3 +193,14 @@ func Convert_v1beta2_IBMPowerVSMachineSpec_To_v1beta1_IBMPowerVSMachineSpec(in *

return autoConvert_v1beta2_IBMPowerVSMachineSpec_To_v1beta1_IBMPowerVSMachineSpec(in, out, s)
}

func Convert_v1beta2_IBMPowerVSClusterSpec_To_v1beta1_IBMPowerVSClusterSpec(in *infrav1beta2.IBMPowerVSClusterSpec, out *IBMPowerVSClusterSpec, s apiconversion.Scope) error {
if in.ServiceInstance.ID != nil {
out.ServiceInstanceID = *in.ServiceInstance.ID
}
return autoConvert_v1beta2_IBMPowerVSClusterSpec_To_v1beta1_IBMPowerVSClusterSpec(in, out, s)
}

func Convert_v1beta2_IBMPowerVSClusterStatus_To_v1beta1_IBMPowerVSClusterStatus(in *infrav1beta2.IBMPowerVSClusterStatus, out *IBMPowerVSClusterStatus, s apiconversion.Scope) error {
return autoConvert_v1beta2_IBMPowerVSClusterStatus_To_v1beta1_IBMPowerVSClusterStatus(in, out, s)
}
91 changes: 67 additions & 24 deletions api/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 71 additions & 5 deletions api/v1beta2/ibmpowervscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@ const (

// IBMPowerVSClusterSpec defines the desired state of IBMPowerVSCluster.
type IBMPowerVSClusterSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

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

// Network is the reference to the Network to use for this cluster.
Expand All @@ -45,13 +43,61 @@ type IBMPowerVSClusterSpec struct {
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
// +optional
ControlPlaneEndpoint capiv1beta1.APIEndpoint `json:"controlPlaneEndpoint"`

// serviceInstance is the reference to the Power VS service on which the server instance(VM) will be created.
// Power VS service is a container for all Power VS instances at a specific geographic region.
// serviceInstance can be created via IBM Cloud catalog or CLI.
// supported serviceInstance identifier in PowerVSResource are Name and ID and that can be obtained from IBM Cloud UI or IBM Cloud cli.
// More detail about Power VS service instance.
// https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server
// when omitted system will dynamically create the service instance
// +optional
ServiceInstance IBMPowerVSResourceReference `json:"serviceInstance"`

// zone is the name of Power VS zone where the cluster will be created
Zone string `json:"zone"`

// resourceGroup name under which the resources will be created.
ResourceGroup string `json:"resourceGroup"`

// vpc contains information about IBM Cloud VPC resources
// +optional
VPC VPCResource `json:"vpc,omitempty"`

// transitGateway contains information about IBM Cloud TransitGateway.
// +optional
TransitGateway TransitGateway `json:"transitGateway,omitempty"`

// controlPlaneLoadBalancer is optional configuration for customizing control plane behavior.
// +optional
ControlPlaneLoadBalancer *VPCLoadBalancerSpec `json:"controlPlaneLoadBalancer,omitempty"`
}

// IBMPowerVSClusterStatus defines the observed state of IBMPowerVSCluster.
type IBMPowerVSClusterStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
// ready is true when the provider resource is ready.
Ready bool `json:"ready"`

// serviceInstanceID is the reference to the Power VS service on which the server instance(VM) will be created.
ServiceInstanceID *string `json:"serviceInstanceID,omitempty"`

// networkID is the reference to the Power VS network to use for this cluster.
NetworkID *string `json:"networkID,omitempty"`

// vpcID is reference to IBM Cloud VPC resources.
VpcID *string `json:"vpcID,omitempty"`

// vpcSubnetID is reference to IBM Cloud VPC subnet.
VPCSubnetID *string `json:"vpcSubnetID,omitempty"`

// transitGatewayID is reference to IBM Cloud TransitGateway.
TransitGatewayID *string `json:"transitGatewayID,omitempty"`

// ControlPlaneLoadBalancer reference to IBM Cloud VPC Loadbalancer.
ControlPlaneLoadBalancer *VPCLoadBalancerStatus `json:"controlPlaneLoadBalancer,omitempty"`

// Conditions defines current service state of the IBMPowerVSCluster.
Conditions capiv1beta1.Conditions `json:"conditions,omitempty"`
}

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

// VPCResource holds the VPC information.
type VPCResource struct {
// Name of VPC
// +optional
Name string `json:"name,omitempty"`

// IBM Cloud VPC zone where the cluster's loadbalancers will be created
Zone string `json:"vpcZone"`

// Subnet contains the details about subnet
// +optional
Subnet Subnet `json:"subnet,omitempty"`
}

// TransitGateway holds the TransitGateway information
type TransitGateway struct {
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
}

func init() {
SchemeBuilder.Register(&IBMPowerVSCluster{}, &IBMPowerVSClusterList{})
}
9 changes: 9 additions & 0 deletions api/v1beta2/ibmvpccluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ type VPCLoadBalancerSpec struct {
Name string `json:"name,omitempty"`
}

// VPCLoadBalancerStatus defines the status VPC load balancer.
type VPCLoadBalancerStatus struct {
// ID of VPC load balancer.
// +optional
ID *string `json:"id,omitempty"`
// State is the status of the load balancer.
State VPCLoadBalancerState `json:"state,omitempty"`
}

// IBMVPCClusterStatus defines the observed state of IBMVPCCluster.
type IBMVPCClusterStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
Expand Down
8 changes: 4 additions & 4 deletions api/v1beta2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ type NetworkInterface struct {

// Subnet describes a subnet.
type Subnet struct {
Ipv4CidrBlock *string `json:"cidr"`
Name *string `json:"name"`
ID *string `json:"id"`
Zone *string `json:"zone"`
Ipv4CidrBlock *string `json:"cidr,omitempty"`
Name *string `json:"name,omitempty"`
ID *string `json:"id,omitempty"`
Zone *string `json:"zone,omitempty"`
}

// VPCEndpoint describes a VPCEndpoint.
Expand Down
Loading

0 comments on commit 5f202fe

Please sign in to comment.