-
Notifications
You must be signed in to change notification settings - Fork 93
Vpc extended apis #1895
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 extended apis #1895
Conversation
|
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 Once the patch is verified, the new status will be reflected by the 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. |
✅ Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
|
/cc @Karthik-K-N |
|
/ok-to-test |
|
|
||
| // securityGroups defines the load balancer's security groups. | ||
| // +optional | ||
| SecurityGroups []VPCResource `json:"securityGroups,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are planing to have SG seperatly for LB as well as VPC, do you have any use case in mind?
Also we recently implemented it for PowerVS see if it helps
| VPCSecurityGroups []VPCSecurityGroup `json:"vpcSecurityGroups,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SG's listed for the LB merely list the SecurityGroups the LB expects to have attached during LB creation.
The SecurityGroup (VPCSecurityGroup) reconciliation occurs separately, so we expect the SG's should already exist by the time we reach LB reconciliation (or error if they do not).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case can you please reframe the description the same for better understanding?
It looks like, you are defining the SG from scratch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added some details that the SG's are expected to exist for LB reconciliation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've also added subnet definitions to LB's, since we don't expect to default to using all subnets.
api/v1beta2/ibmvpccluster_types.go
Outdated
|
|
||
| // backendPools defines the load balancer's backend pools. | ||
| // +optional | ||
| BackendPools []BackendPoolSpec `json:"backendPools,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats the use case you have in mind to expose Backedpool,Do you think user should worry about it? Also what happens if user does not pass anything here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I currently have some default pools implemented in test code. I have not yet decided whether to leave them in, or force the user to have to define pools (no defaults).
|
|
||
| // resourceGroup is the Resource Group to create the Custom Image in. | ||
| // +optional | ||
| ResourceGroup *IBMCloudResourceReference `json:"resourceGroup,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have ResourceGroup at various place. Do you think this option is needed, can't we create image in cluster resource group?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ResourceGroup is imbedded within Power code, I do not wish reuse Power dependent code
cluster-api-provider-ibmcloud/api/v1beta2/ibmpowervscluster_types.go
Lines 175 to 182 in 112f968
| // ResourceReference identifies a resource with id. | |
| type ResourceReference struct { | |
| // id represents the id of the resource. | |
| ID *string `json:"id,omitempty"` | |
| // +kubebuilder:default=false | |
| // controllerCreated indicates whether the resource is created by the controller. | |
| ControllerCreated *bool `json:"controllerCreated,omitempty"` | |
| } |
The ResourceGroup can be used for Image creation, or to retrieve an existing image. So, the RG doesn't have to match the Cluster RG.
api/v1beta2/ibmvpccluster_types.go
Outdated
| // resourceGroup is the name of the Resource Group containing all of the newtork resources. | ||
| // loadBalancers is a set of VPC Load Balancer definitions to use for the cluster. | ||
| // +optional | ||
| LoadBalancers []VPCLoadBalancerSpec `json:"loadbalancers,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are defining here as well, We may need to add proper comment for VPCSpec.ControlplaneLoadbalancer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I can try to add something to the old field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some details about legacy use versus extended support.
5ac1389 to
3b807d2
Compare
|
@dharaneeshvrd please take a look when you get some time. |
|
/cc @dharaneeshvrd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added few comments about adding validation to all the new fields added, lets add validation for all the newly introduced fields referring the apispec from the doc here - https://cloud.ibm.com/apidocs/vpc/latest#create-load-balancer
api/v1beta2/ibmvpccluster_types.go
Outdated
|
|
||
| // algorithm defines the load balancing algorithm to use. | ||
| // +required | ||
| Algorithm string `json:"algorithm"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets add a validation here for the Allowable values: [least_connections,round_robin,weighted_round_robin] and also a default value set when no option mentioned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added an enum
api/v1beta2/ibmvpccluster_types.go
Outdated
|
|
||
| // protocol defines the protocol to use for the Backend Pool. | ||
| // +required | ||
| Protocol string `json:"protocol"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add validation here for the algorithm like Allowable values: [http,https,tcp,udp]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added an enum
| // name defines the name of the Backend Pool. | ||
| // +optional | ||
| WorkerSubnets []Subnet `json:"workerSubnets,omitempty"` | ||
| Name *string `json:"name,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets add a regex for the validation here - Possible values: 1 ≤ length ≤ 63, Value must match regular expression ^([a-z]|[a-z][-a-z0-9]*[a-z0-9])$
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall!
|
|
||
| // securityGroups defines the load balancer's security groups. | ||
| // +optional | ||
| SecurityGroups []VPCResource `json:"securityGroups,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case can you please reframe the description the same for better understanding?
It looks like, you are defining the SG from scratch.
8b2f334 to
ee67c25
Compare
|
Based on further investigation on requirements for Catalog Offerings, I have extended the ImageSpec to include a CatalogOffering resource now as well, to allow user to define whether an existing VPC Image is used, a Catalog Offering, or a new VPC Image gets created during Infrastructure reconciliation. |
ee67c25 to
4f33c89
Compare
api/v1beta2/ibmvpccluster_types.go
Outdated
| type VPCNetworkSpec struct { | ||
| // workerSubnets is a set of Subnet's which define the Worker subnets. | ||
| // BackendPoolSpec defines the desired configuration of a VPC Load Balancer Backend Pool. | ||
| type BackendPoolSpec struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we prefix with VPCLoadBalancer to align with other structs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
api/v1beta2/ibmvpccluster_types.go
Outdated
|
|
||
| // HealthMonitorSpec defines the desired state of a Health Monitor resource for a VPC Load Balancer Backend Pool. | ||
| // kubebuilder:validation:XValidation:rule="self.dely > self.timeout",message="health monitor's delay must be greater than the timeout" | ||
| type HealthMonitorSpec struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as other comment, it would be good to prefix this with VPCLoadBalancer to be more clear IMO.
Also can we keep it as VPCLoadBalancerHealthCheckSpec to align with VPC term and here also I can see you have referred as health check in many places?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the struct name. I was trying to stay aligned with the IBM Cloud API documentation, as it refers to the fields for health checks.
api/v1beta2/types.go
Outdated
| ) | ||
|
|
||
| // CatalogOffering represents an IBM Cloud Catalog Offering resource. | ||
| type CatalogOffering struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| type CatalogOffering struct { | |
| type IBMCloudCatalogOffering struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated.
api/v1beta2/ibmvpccluster_types.go
Outdated
|
|
||
| // catalogOffering defines an existing Catalog Offering Image. | ||
| // +optional | ||
| CatalogOffering *CatalogOffering `json:"catalogOffering,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CatalogOffering's spec looks like to identify generic ibm cloud catalog offering, how are you planning to use that to identify the catalog image?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a Catalog Offering for a VSI "image" requires either a Catalog Offering CRN or Catalog Offering Version CRN (with an optional Catalog Offering Plan CRN for either) per the IBM Cloud VPC API's.
Supplying the catalogOffering field for the ImageSpec, with one of the offeringCRN or versionCRN, with result in the VSI API calls to be made using an InstancePrototypeInstanceByCatalogOffering instead of the ...ByImage for the API calls to create a VSI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dropped the Catalog Offering since we may not have permission to validate the Image as an Offering. We will have to rely on results/errors during Machine creation.
7b0425c to
0e232d8
Compare
|
Rebased to resolve mock generation. |
0e232d8 to
4548245
Compare
|
I dropped the Catalog Offering configuration for the Image definition, as I expect to handle it only within Machine API's and we may not have permission to validate a Catalog Offering, thus providing it in the Infrastructure is not useful. |
|
It seems you need to regenerate the CRD def yamls, otherwise it LGTM! |
|
@dharaneeshvrd Is there something specific I need to run to do that? |
|
|
|
@dharaneeshvrd I have run that prior, I don't think it passes CI tests unless the CRD files are updated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see validations working fine, please fix them.
e.g: I created following spec and it got created without any issues
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: IBMVPCCluster
metadata:
labels:
cluster.x-k8s.io/cluster-name: test-1
name: test-1
spec:
region: us-south
resourceGroup: Default
vpc: vpc-1
zone: us-south-1
controlPlaneLoadBalancer:
name: lb-test
backendPools:
- name: pool-1
algorithm: invalid-algo
healthMonitor:
delay: 2
retries: 1
timeout: 1
type: invalidtype
oc get IBMVPCCluster -A -o=yaml
apiVersion: v1
items:
- apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: IBMVPCCluster
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"infrastructure.cluster.x-k8s.io/v1beta2","kind":"IBMVPCCluster","metadata":{"annotations":{},"labels":{"cluster.x-k8s.io/cluster-name":"test-1"},"name":"test-1","namespace":"default"},"spec":{"controlPlaneLoadBalancer":{"backendPools":[{"algorithm":"invalid-algo","healthMonitor":{"delay":2,"retries":1,"timeout":1,"type":"invalidtype"},"name":"pool-1"}],"name":"lb-test"},"region":"us-south","resourceGroup":"Default","vpc":"vpc-1","zone":"us-south-1"}}
creationTimestamp: "2024-08-16T07:37:55Z"
generation: 1
labels:
cluster.x-k8s.io/cluster-name: test-1
name: test-1
namespace: default
resourceVersion: "2534"
uid: 5147b1a5-2251-484c-b3c4-335b0d6c57f3
spec:
controlPlaneEndpoint:
host: ""
port: 0
controlPlaneLoadBalancer:
backendPools:
- algorithm: invalid-algo
healthMonitor:
delay: 2
retries: 1
timeout: 1
type: invalidtype
name: pool-1
protocol: ""
name: lb-test
public: true
region: us-south
resourceGroup: Default
vpc: vpc-1
zone: us-south-1
kind: List
metadata:
resourceVersion: ""
Extending VPC related Cluster API's in order to provide additional VPC Infrastructure reconciliation support.
4548245 to
4012d7c
Compare
|
@mkumatag I added some enum validation to some of the type fields, but I cannot validate locally to confirm things work as expected (issues with CRD resource creation). Please let me know if you see further issues. |
Getting a proper message now, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
|
[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 |
Extending VPC related Cluster API's in order to provide additional VPC Infrastructure reconciliation support.
What this PR does / why we need it: introduces API's that will be used for extended VPC Cluster (Infrastructure) support
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
Release note: