Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API changes to support infra creation #1485

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

Karthik-K-N
Copy link
Contributor

@Karthik-K-N Karthik-K-N commented Nov 9, 2023

What this PR does / why we need it:

Contains the API changes to infra creation as a part of Power VS cluster creation

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

/area provider/ibmcloud

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

Release note:

New fields are added to IBMPowerVSCluster resources to support infrastructure creation
  • Squash commits before merge

Partially fixes: #1450

@k8s-ci-robot k8s-ci-robot added the area/provider/ibmcloud Issues or PRs related to ibmcloud provider label Nov 9, 2023
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Nov 9, 2023
Copy link

netlify bot commented Nov 9, 2023

Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!

Name Link
🔨 Latest commit 8f8ed21
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/65b0dacb603db10008b7b7e7
😎 Deploy Preview https://deploy-preview-1485--kubernetes-sigs-cluster-api-ibmcloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 9, 2023
@Karthik-K-N
Copy link
Contributor Author

/cc @dharaneeshvrd @Amulyam24

@Karthik-K-N Karthik-K-N marked this pull request as draft November 9, 2023 13:50
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 9, 2023
Comment on lines 55 to 84
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"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO everything should be optional and can have some default values if not supplied to have backward compatibility

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, I think we can make use of webhooks to handle it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a discussion about this, like what fields can be default set and what values.

// 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why just ID? there are other fields like name, regex

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intention was to refer ServiceInstanceID to ServiceInstance.ID, But yes we can use anything out of Name, ID, Regex, Update it accrodingly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense

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"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in status we can have just the id

ServiceInstance IBMPowerVSResourceReference `json:"serviceInstance,omitempty"`

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, lets have only id here

Network IBMPowerVSResourceReference `json:"network,omitempty"`

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again lets use only id in the status

Subnet Subnet `json:"subnet"`

// TransitGateway holds the resource details of TransitGateway
TransitGateway TransitGateway `json:"transitGateway"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe TransitGateway itself is a different component and works like connector between the vpc and classic n/w, so wondering if we need to define outside the vpc data structures

type VPCLoadBalancerStatus struct {
// Name of the VPC load balancer.
// +optional
Name string `json:"name,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the status we shouldn't be mentioning the name

@Karthik-K-N
Copy link
Contributor Author

Addressed first set of review comments.

@Karthik-K-N Karthik-K-N marked this pull request as ready for review November 13, 2023 06:35
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 13, 2023
api/v1beta2/ibmpowervscluster_types.go Show resolved Hide resolved
api/v1beta2/ibmpowervscluster_types.go Outdated Show resolved Hide resolved
api/v1beta2/ibmpowervscluster_types.go Outdated Show resolved Hide resolved
api/v1beta2/ibmpowervscluster_types.go Outdated Show resolved Hide resolved
@Karthik-K-N
Copy link
Contributor Author

Karthik-K-N commented Nov 13, 2023

Addressed all the review comments

api/v1beta2/ibmpowervscluster_types.go Outdated Show resolved Hide resolved
api/v1beta2/ibmpowervscluster_types.go Show resolved Hide resolved
api/v1beta2/ibmpowervscluster_types.go Outdated Show resolved Hide resolved
api/v1beta2/ibmpowervscluster_types.go Outdated Show resolved Hide resolved
Zone string `json:"zone"`

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets have this as optional and use the default resource group when not supplied

ServiceInstance IBMPowerVSResourceReference `json:"serviceInstance"`

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need have this as an optional to have a backward compatibility, lets also had a link which talks about all the possible values - https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-creating-power-virtual-server

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should be the default zone to use. Also I think we can validate this filed to have value when ServiceInstance info is not provided.

api/v1beta2/ibmpowervscluster_types.go Outdated Show resolved Hide resolved
api/v1beta2/ibmpowervscluster_types.go Outdated Show resolved Hide resolved
@@ -78,6 +78,9 @@ type IBMVPCResourceReference struct {
// +kubebuilder:validation:MinLength=1
// +optional
Name *string `json:"name,omitempty"`

// IBM Cloud VPC zone
Zone *string `json:"vpcZone,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we have already a zone field in the IBMVPCMachineSpec, this entry may create confusion here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove it from here and create new resource VPCResource type with zone.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 29, 2023
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 29, 2023
@Karthik-K-N Karthik-K-N force-pushed the create-infra branch 2 times, most recently from e3a9a29 to 9443ac2 Compare January 17, 2024 09:01

// vpcSubnet contains information about IBM Cloud VPC Subnet resources
// +optional
VPCSubnet *Subnet `json:"vpcSubnet,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
VPCSubnet *Subnet `json:"vpcSubnet,omitempty"`
VPCSubnet []Subnet `json:"vpcSubnet,omitempty"`

// +kubebuilder:default=control-plane
// +kubebuilder:validation:Enum=control-plane
// +optional
Scheme *LoadBalancerScheme `json:"scheme,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change it to Public

COSBucket *ResourceReference `json:"cosBucket,omitempty"`

// loadBalancers reference to IBM Cloud VPC Loadbalancer.
LoadBalancers []VPCLoadBalancerStatus `json:"loadBalancers,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explore on using map instead of slice

Suggested change
LoadBalancers []VPCLoadBalancerStatus `json:"loadBalancers,omitempty"`
LoadBalancers map[string]VPCLoadBalancerStatus `json:"loadBalancers,omitempty"`

// (https://coreos.github.io/ignition/) for bootstrapping (requires
// BootstrapFormatIgnition feature flag to be enabled).
// +optional
CosBucket *CosBucket `json:"cosBucket,omitempty"`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CosBucket *CosBucket `json:"cosBucket,omitempty"`
CosInstance *CosInstance `json:"cosInstance,omitempty"`

@Karthik-K-N
Copy link
Contributor Author

Use annotations to support existing way of creating cluster

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jan 23, 2024
Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets start using this terminology PowerVS workspace instead of service instance

Network IBMPowerVSResourceReference `json:"network"`

// 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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Power VS service is a container for all Power VS instances at a specific geographic region.
// Power Virtual Server workspace is a container for all Power Virtual Server instances at a specific geographic region.

Zone *string `json:"zone,omitempty"`

// resourceGroup name under which the resources will be created.
// when omitted Default resource group will be used.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a Default one by name, IBM cloud can set some other name as well for the default if I'm not wrong, lets modify the message accordingly.

// +optional
VPCSubnets []Subnet `json:"vpcSubnets,omitempty"`

// transitGateway contains information about IBM Cloud TransitGateway.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will be great if you can add a link to the ibm cloud document for more information.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and the purpose of this entity here

// +optional
TransitGateway *TransitGateway `json:"transitGateway,omitempty"`

// loadBalancers is optional configuration for configuring loadbalancers to control plane or data plane nodes.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

information needs to added to to mention why is this optional and what happens user doesn't supply

Name *string `json:"name,omitempty"`

// IBM Cloud VPC zone
Zone *string `json:"zone,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this? can we just create subnets in all the zones by default.?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is reference used for VPC. zone indicates vpc zone and yes as of today only one subnet is created associated to this zone.

// Version defines which version of Ignition will be used to generate bootstrap data.
//
// +optional
// +kubebuilder:default="2.3"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why it is set to 2.3 version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// Ignition defined options related to the bootstrapping systems where Ignition is used.
// +optional
Ignition *Ignition `json:"ignition,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why a struct here? right now I see just a version, do we expect anything else in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took a reference from other provider(aws).

}

// LoadBalancerScheme defines the scheme of a load balancer.
type LoadBalancerScheme string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this used?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not used, will be removed.

@Karthik-K-N Karthik-K-N force-pushed the create-infra branch 2 times, most recently from 2309e2d to 1db1e21 Compare January 24, 2024 09:14
Copy link
Member

@mkumatag mkumatag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm
/approve

/hold

for others to review

/cc @Prajyot-Parab

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 24, 2024
@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 24, 2024
Copy link
Contributor

@Prajyot-Parab Prajyot-Parab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 24, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Karthik-K-N, mkumatag, Prajyot-Parab

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit d89b5ae into kubernetes-sigs:main Jan 24, 2024
13 checks passed
@Karthik-K-N Karthik-K-N deleted the create-infra branch January 25, 2024 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/provider/ibmcloud Issues or PRs related to ibmcloud provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Explore adding PowerVS K8s cluster pre-req infra creation to capibm flow
5 participants