Skip to content

Conversation

@Karthik-K-N
Copy link
Member

This PR adds LoadBalancers filed to Power VS spec.
Usage:

  1. Installer will set the loadbalaner name in machine spec for control-plane machines
  2. Power VS machine api provider will use it to add or remove created/deleted instance to loadbalancer pool
  3. This will help us in providing support for cluster-control-plane-machine-set-operator

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 1, 2023

Hello @Karthik-K-N! Some important instructions when contributing to openshift/api:
API design plays an important part in the user experience of OpenShift and as such API PRs are subject to a high level of scrutiny to ensure they follow our best practices. If you haven't already done so, please review the OpenShift API Conventions and ensure that your proposed changes are compliant. Following these conventions will help expedite the api review process for your PR.

@openshift-ci openshift-ci bot requested review from mandre and soltysh March 1, 2023 14:31
@Karthik-K-N
Copy link
Member Author

@mkumatag @JoelSpeed could you please take a look and help in reviewing this.

@Karthik-K-N Karthik-K-N force-pushed the add_loadbalancer branch 2 times, most recently from c55273d to bf2a83b Compare March 7, 2023 10:07
Comment on lines 210 to 218
// Name of the LoadBalancer in IBM Cloud VPC
// It is a reference to existing LoadBalancer created by openshift installer component.
// +kubebuilder:validation:Required
Name string `json:"name"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should start with the json tag name not the Go field name, is there any way to restrict this? For example can we explain what character set, minimum/maximum lengths are required for this field?

Suggested change
// Name of the LoadBalancer in IBM Cloud VPC
// It is a reference to existing LoadBalancer created by openshift installer component.
// +kubebuilder:validation:Required
Name string `json:"name"`
// name of the LoadBalancer in IBM Cloud VPC
// It is a reference to existing LoadBalancer created by openshift installer component.
// +kubebuilder:validation:Required
Name string `json:"name"`

Copy link
Member Author

Choose a reason for hiding this comment

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

sure , not sure how can we restrict it, Currently the loadbalancer name will be of format "{cluster-id}-loadbalancer" for public and "{cluster-id}-loadbalancer-int" for internal loadbalancer

Copy link
Contributor

Choose a reason for hiding this comment

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

Is cluster-id restricted at all by the installer? We can probably restrict this to alphanumeric characters, hyphens and underscores, but we should check what restrictions are imposed by the installer

Copy link
Member Author

Choose a reason for hiding this comment

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

Apologies we are using infraID not clusterid, Infra ID is generated like this: https://github.com/Karthik-K-N/installer/blob/e91df626c10e569e7613249053b7b9b264db42df/pkg/asset/installconfig/clusterid.go#L60-L79

I think we can add validation for alphanumeric with hyphen,

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah looks like it can be limited to alphanum and hyphen, great!

Comment on lines 215 to 222
// Currently only Application LoadBalancer is supported
// More details about Application LoadBalancer
// https://cloud.ibm.com/docs/vpc?topic=vpc-load-balancers-about&interface=ui
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Currently only Application LoadBalancer is supported
// More details about Application LoadBalancer
// https://cloud.ibm.com/docs/vpc?topic=vpc-load-balancers-about&interface=ui
// Currently only the Application LoadBalancer is supported.
// More details about Application LoadBalancer
// https://cloud.ibm.com/docs/vpc?topic=vpc-load-balancers-about&interface=ui.
// Supported values are Application.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated.

// name of the LoadBalancer in IBM Cloud VPC.
// It is a reference to existing LoadBalancer created by openshift installer component.
// +kubebuilder:validation:Required
Name string `json:"name"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Lets add a kubebuilder validation for the alpha numeric characters and hyphen, then we will want to explain this limitation within the godoc, and also, we should probably set a maximum length, is there anything in IBM that limits the length or the characters?

Copy link
Contributor

@JoelSpeed JoelSpeed Mar 10, 2023

Choose a reason for hiding this comment

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

I found the following in the docs, how wil we handle this? Convert any hyphen to an underscore internally? How will we limit the name length given the infra-id may be 27 characters, any thoughts?

Names may not be empty. A valid load balancer name starts with a letter, followed by letters, digits, or underscores. The length of the name may not exceed 40 characters.

Copy link
Member Author

Choose a reason for hiding this comment

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

Loadbalancer name may contain hyphens, Currently this is how the installer creates the loadbalancer rdr-kn08031125-vhwtg-loadbalancer.
From api doc I can see this description for name

The globally unique name for this load balancer profile

Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$

Example: network-fixed

Copy link
Contributor

Choose a reason for hiding this comment

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

Great, thanks for finding that, can you explain this in prose within the godoc please? We need to say something along the lines of

// The name should be between 1 and 63 characters long and may consist of lowercase alphanumeric characters and hyphens only.
// The value must not end with a hyphen and integer values are not allowed.

I think I've understood that regex correctly anyway

Copy link
Member Author

Choose a reason for hiding this comment

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

If we can just add a touch more documentation to this name field as per my suggestion I think this is good to go

Updated accordingly, Please take a look. Thank you.

@Karthik-K-N Karthik-K-N force-pushed the add_loadbalancer branch 2 times, most recently from 846eb18 to 4c5aebe Compare March 10, 2023 17:39
Copy link
Contributor

@JoelSpeed JoelSpeed left a comment

Choose a reason for hiding this comment

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

If we can just add a touch more documentation to this name field as per my suggestion I think this is good to go

// name of the LoadBalancer in IBM Cloud VPC.
// It is a reference to existing LoadBalancer created by openshift installer component.
// +kubebuilder:validation:Required
Name string `json:"name"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Great, thanks for finding that, can you explain this in prose within the godoc please? We need to say something along the lines of

// The name should be between 1 and 63 characters long and may consist of lowercase alphanumeric characters and hyphens only.
// The value must not end with a hyphen and integer values are not allowed.

I think I've understood that regex correctly anyway

@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 5, 2023
@JoelSpeed
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 5, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 5, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoelSpeed, Karthik-K-N

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

The pull request process is described here

Details 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 5, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Apr 5, 2023

@Karthik-K-N: all tests passed!

Full PR test history. Your PR dashboard.

Details

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/test-infra repository. I understand the commands that are listed here.

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. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants