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

VPC: Extend VPC Machine API's #1978

Merged

Conversation

cjschaef
Copy link
Contributor

Extend the VPC Machine API's to include additional fields and types for more VPC Machine configuration support.

Related: #1977

What this PR does / why we need it:

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:

Extend VPCMachine APIs to allow for more configuration and supported features. These are intended to be used with the extended VPC Cluster Infrastructure support.

@k8s-ci-robot k8s-ci-robot added area/provider/ibmcloud Issues or PRs related to ibmcloud provider cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 27, 2024
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 27, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @cjschaef. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 27, 2024
Copy link

netlify bot commented Sep 27, 2024

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

Name Link
🔨 Latest commit d606bba
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/67000107b05c50000870d696
😎 Deploy Preview https://deploy-preview-1978--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.

// CatalogOffering is the Catalog Offering OS image which would be installed on the instance.
// An OfferingCRN or VersionCRN is required, the PlanCRN is optional.
// +optional
CatalogOffering *IBMCloudCatalogOffering `json:"catalogOffering,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

For my understanding, how would this respective image would be imported to VPC or the global catalog images are generally available to all the VPC?

Copy link
Contributor

Choose a reason for hiding this comment

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

Alos since this catalogOffering is specific to os image should we rename the member to indicate that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can rename it.
In the cases I have used, this documentation provides details on creating a Private Catalog: https://cloud.ibm.com/docs/account?topic=account-restrict-by-user&interface=ui
And details on creating a sharable VPC Custom Image: https://cloud.ibm.com/docs/vpc?topic=vpc-custom-image-cloud-private-catalog&interface=ui

// Image is the OS image which would be install on the instance.
// ID will take higher precedence over Name if both specified.
Image *IBMVPCResourceReference `json:"image"`

// LoadBalancerPoolMembers is the set of IBM Cloud VPC Load Balancer Backend Pools the machine should be added to as a member.
// +optional
LoadBalancerPoolMembers []VPCLoadBalancerBackendPoolMember `json:"loadBalancerPoolMembers,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

We used to attach the machine to all the loadbalancers defined in cluster.Loadbalancer, Do you plan to avoid that and register to only loadbalancers set here?

What will happen when this is omitted?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The current code has some hardcoded values and expectations on attaching Machines to LB's.
I am trying to avoid doing that, especially since it is currently hardcoded to one LB.
I would expect that all machines CAPI creates then would be added into LB pools then, if we rely on Cluster definitions, which I do not expect is valid. Is that a fair assumption, if we rely on the Cluster resource?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can do this way as well, but my point is eventually the lb referred by VPCLoadBalancerBackendPoolMember.Loadbalancer is created by cluster reconciler, So why can't we directly use it.


// DedicatedHost is the name of the underlying provisioned host in the VPC on which the instance will be created.
// +optional
DedicatedHost *VPCResource `json:"dedicatedHost,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

For optional field for our better understanding lets mention what will happen when the field is omited.

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 update.

// LoadBalancerPoolMembers is the status of IBM Cloud VPC Load Balancer Backend Pools the machine is a member.
// +optional
// +k8s:conversion-gen=false
LoadBalancerPoolMembers []VPCLoadBalancerBackendPoolMember `json:"loadBalancerPoolMembers,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it required here? Is it just to verify that the machine is already registered to LB?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is the intention, to track and make sure the Machine is in the required pools.


// Port defines the Port the Load Balancer Pool Member listens for traffic.
// +required
Port int64 `json:"port"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reasons for defining Port as int64 and wieght as pointer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, Port is required for LB member creation, for which we do not expect to always use 6443.
And weight is not required, hence it is made optional.

@@ -36,10 +39,23 @@ type IBMVPCMachineSpec struct {
// Name of the instance.
Name string `json:"name,omitempty"`

// CatalogOffering is the Catalog Offering OS image which would be installed on the instance.
// An OfferingCRN or VersionCRN is required, the PlanCRN is optional.
Copy link
Member

Choose a reason for hiding this comment

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

I don't see lot of information how we are consuming this in the create instance API, it will be great if you can point all the details in this PR which talks about how user will be using this field in the create flow.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I provided what details are available (not many) in regard to using an offering in place of a Custom Image
This is what I had to piece together to create VSI's (instances) with an offering instead
#1978 (comment)


// DedicatedHost is the name of the underlying provisioned host in the VPC on which the instance will be created.
// +optional
DedicatedHost *VPCResource `json:"dedicatedHost,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

is this related to placement_target field name in the create flow or something else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that is the expected field. We will need to keep parity for allowing DedicateHostIdentities to be supported for Machines (VSI's).

Copy link
Member

Choose a reason for hiding this comment

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

well, this is not limited to Host right, I see following combinations -

  • dedicated host
  • dedicated host group
  • placement group

So instead of making this field just to host, lets make it more generic so that user can consume for any of the above options..

Correct me if I'm missing something 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.

I refactored to support the three options for placement target now.

@cjschaef cjschaef force-pushed the vpc_extended_machine_apis branch 2 times, most recently from 2f0692e to eac62b0 Compare October 2, 2024 14:41
@mkumatag
Copy link
Member

mkumatag commented Oct 4, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 4, 2024
type VPCMachinePlacementTarget struct {
// DedicatedHost defines the Dedicated Host to place a VPC Machine (Instance) on.
// +optional
DedicatedHost *VPCResource `json:"dedicatedHost,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure if VPCResource is a right option here because I see following fields for the value used for this field:

	// The unique identifier for this dedicated host.
	ID *string `json:"id,omitempty"`

	// The CRN for this dedicated host.
	CRN *string `json:"crn,omitempty"`

	// The URL for this dedicated host.
	Href *string `json:"href,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.

The expectation is that the user would provide an ID or a name of the existing resource, and a lookup would be performed for those resources (to retrieve the ID if not supplied) and use that in the API calls, for whichever of the 3 was provided. Each of these three options has a Name or ID field, which the user could provide, simplifying the user experience.

// CatalogOfferingImage is the Catalog Offering OS image which would be installed on the instance.
// An OfferingCRN or VersionCRN is required, the PlanCRN is optional.
// +optional
CatalogOfferingImage *IBMCloudCatalogOffering `json:"catalogOfferingImage,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

https://cloud.ibm.com/docs/account?topic=account-restrict-by-user&interface=ui looking at this it is not just to do with image, I think its better to remove the Image from the fieldname.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have remove Image from the field.

// InstanceStatus is the status of the GCP instance for this machine.
// Conditions deefines current service state of the IBMVPCMachine.
// +optional
// +k8s:conversion-gen=false
Copy link
Member

Choose a reason for hiding this comment

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

any reason for adding +k8s:conversion-gen=false marker?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The generator could not perform conversion on this field. I added this field instead.

However, I retried the manual conversion this type and it appears it made linting and everything happy this time.
Hopefully this actually works in the CI checks.

// SecurityGroups defines a set of IBM Cloud VPC Security Groups to attach to the network interface.
// +optional
// +k8s:conversion-gen=false
SecurityGroups []VPCResource `json:"securityGroups,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Per comment above, I retried the manual conversion, so hopefully that resolves this failure now.

Extend the VPC Machine API's to include additional fields
and types for more VPC Machine configuration support.

Related: kubernetes-sigs#1977
@cjschaef cjschaef force-pushed the vpc_extended_machine_apis branch from eac62b0 to d606bba Compare October 4, 2024 14:51
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

/hold

@Karthik-K-N unhold when you are okay

@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 Oct 7, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 7, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cjschaef, mkumatag

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 added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 7, 2024
Copy link
Contributor

@Karthik-K-N Karthik-K-N left a comment

Choose a reason for hiding this comment

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

/lgtm

/hold cancel

@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 Oct 7, 2024
@k8s-ci-robot k8s-ci-robot merged commit 959867b into kubernetes-sigs:main Oct 7, 2024
13 checks passed
@cjschaef cjschaef deleted the vpc_extended_machine_apis branch October 7, 2024 13:59
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants