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 9, 2023
1 parent 7f4aef3 commit 43ebc19
Show file tree
Hide file tree
Showing 6 changed files with 533 additions and 27 deletions.
68 changes: 54 additions & 14 deletions api/v1beta1/zz_generated.conversion.go

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

69 changes: 64 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.ID instead
ServiceInstanceID string `json:"serviceInstanceID"`

// Network is the reference to the Network to use for this cluster.
Expand All @@ -45,13 +43,53 @@ 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"`

// 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"`

// 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"`

// serviceInstance is the reference to the Power VS service on which the server instance(VM) will be created.
ServiceInstance IBMPowerVSResourceReference `json:"serviceInstance,omitempty"`

// Network is the reference to the Network to use for this cluster.
Network IBMPowerVSResourceReference `json:"network,omitempty"`

// VPC holds the status of VPC resources
VPC VPCResource `json:"vpc,omitempty"`

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

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

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

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

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

// Subnet contains the details about subnet
Subnet Subnet `json:"subnet"`

// TransitGateway holds the resource details of TransitGateway
TransitGateway TransitGateway `json:"transitGateway"`
}

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

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

// VPCLoadBalancerStatus defines the status VPC load balancer.
type VPCLoadBalancerStatus struct {
// Name of the VPC load balancer.
// +optional
Name string `json:"name,omitempty"`
// 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
81 changes: 80 additions & 1 deletion api/v1beta2/zz_generated.deepcopy.go

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

Loading

0 comments on commit 43ebc19

Please sign in to comment.