From 205e5e73063a1d98423168d90897cfa6dd0a0b16 Mon Sep 17 00:00:00 2001 From: Karthik K N Date: Tue, 12 Mar 2024 11:16:34 +0530 Subject: [PATCH] Configure private or public loadbalancer --- api/v1beta2/ibmpowervscluster_types.go | 3 ++- api/v1beta2/ibmvpccluster_types.go | 2 +- cloud/scope/powervs_cluster.go | 4 ++-- ...ructure.cluster.x-k8s.io_ibmpowervsclusters.yaml | 8 +++++--- ...cluster.x-k8s.io_ibmpowervsclustertemplates.yaml | 13 +++++++------ ...rastructure.cluster.x-k8s.io_ibmvpcclusters.yaml | 2 +- ...ure.cluster.x-k8s.io_ibmvpcclustertemplates.yaml | 2 +- 7 files changed, 19 insertions(+), 15 deletions(-) diff --git a/api/v1beta2/ibmpowervscluster_types.go b/api/v1beta2/ibmpowervscluster_types.go index 8827b8cfc..b6595098d 100644 --- a/api/v1beta2/ibmpowervscluster_types.go +++ b/api/v1beta2/ibmpowervscluster_types.go @@ -112,11 +112,12 @@ type IBMPowerVSClusterSpec struct { TransitGateway *TransitGateway `json:"transitGateway,omitempty"` // loadBalancers is optional configuration for configuring loadbalancers to control plane or data plane nodes. - // when omitted system will create a public loadbalancer with name CLUSTER_NAME-loadbalancer. + // when omitted system will create a default public loadbalancer with name CLUSTER_NAME-loadbalancer. // when specified a vpc loadbalancer will be created and controlPlaneEndpoint will be set with associated hostname of loadbalancer. // ControlPlaneEndpoint will be set with associated hostname of public loadbalancer. // when LoadBalancers[].ID is set, its expected that there exist a loadbalancer with ID or else system will give error. // when LoadBalancers[].Name is set, system will first check for loadbalancer with Name, if not exist system will create new loadbalancer. + // For each loadbalancer a default backed pool and front listener will be configured with port 6443. // +optional LoadBalancers []VPCLoadBalancerSpec `json:"loadBalancers,omitempty"` diff --git a/api/v1beta2/ibmvpccluster_types.go b/api/v1beta2/ibmvpccluster_types.go index c3b92ea8a..770cc8a7f 100644 --- a/api/v1beta2/ibmvpccluster_types.go +++ b/api/v1beta2/ibmvpccluster_types.go @@ -72,7 +72,7 @@ type VPCLoadBalancerSpec struct { // +optional Public bool `json:"public,omitempty"` - // AdditionalListeners sets the additional listeners for the control plane load balancer. . + // AdditionalListeners sets the additional listeners for the control plane load balancer. // +listType=map // +listMapKey=port // +optional diff --git a/cloud/scope/powervs_cluster.go b/cloud/scope/powervs_cluster.go index 2e81b51c9..b5847bd35 100644 --- a/cloud/scope/powervs_cluster.go +++ b/cloud/scope/powervs_cluster.go @@ -1297,7 +1297,7 @@ func (s *PowerVSClusterScope) createLoadBalancer(lb infrav1beta2.VPCLoadBalancer } options.SetName(lb.Name) - options.SetIsPublic(true) + options.SetIsPublic(lb.Public) options.SetResourceGroup(&vpcv1.ResourceGroupIdentity{ ID: &resourceGroupID, }) @@ -1361,7 +1361,7 @@ func (s *PowerVSClusterScope) createLoadBalancer(lb infrav1beta2.VPCLoadBalancer ID: loadBalancer.ID, State: lbState, Hostname: loadBalancer.Hostname, - ControllerCreated: pointer.Bool(lb.Public), + ControllerCreated: pointer.Bool(true), }, nil } diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml index 04f9abd68..3a8df2d50 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclusters.yaml @@ -247,21 +247,23 @@ spec: loadBalancers: description: loadBalancers is optional configuration for configuring loadbalancers to control plane or data plane nodes. when omitted - system will create a public loadbalancer with name CLUSTER_NAME-loadbalancer. + system will create a default public loadbalancer with name CLUSTER_NAME-loadbalancer. when specified a vpc loadbalancer will be created and controlPlaneEndpoint will be set with associated hostname of loadbalancer. ControlPlaneEndpoint will be set with associated hostname of public loadbalancer. when LoadBalancers[].ID is set, its expected that there exist a loadbalancer with ID or else system will give error. when LoadBalancers[].Name is set, system will first check for loadbalancer with Name, if not - exist system will create new loadbalancer. + exist system will create new loadbalancer. For each loadbalancer + a default backed pool and front listener will be configured with + port 6443. items: description: VPCLoadBalancerSpec defines the desired state of an VPC load balancer. properties: additionalListeners: description: AdditionalListeners sets the additional listeners - for the control plane load balancer. . + for the control plane load balancer. items: description: AdditionalListenerSpec defines the desired state of an additional listener on an VPC load balancer. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclustertemplates.yaml index e0144f505..2a98cdb32 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmpowervsclustertemplates.yaml @@ -274,23 +274,24 @@ spec: loadBalancers: description: loadBalancers is optional configuration for configuring loadbalancers to control plane or data plane nodes. when - omitted system will create a public loadbalancer with name - CLUSTER_NAME-loadbalancer. when specified a vpc loadbalancer - will be created and controlPlaneEndpoint will be set with - associated hostname of loadbalancer. ControlPlaneEndpoint + omitted system will create a default public loadbalancer + with name CLUSTER_NAME-loadbalancer. when specified a vpc + loadbalancer will be created and controlPlaneEndpoint will + be set with associated hostname of loadbalancer. ControlPlaneEndpoint will be set with associated hostname of public loadbalancer. when LoadBalancers[].ID is set, its expected that there exist a loadbalancer with ID or else system will give error. when LoadBalancers[].Name is set, system will first check for loadbalancer with Name, if not exist system will create - new loadbalancer. + new loadbalancer. For each loadbalancer a default backed + pool and front listener will be configured with port 6443. items: description: VPCLoadBalancerSpec defines the desired state of an VPC load balancer. properties: additionalListeners: description: AdditionalListeners sets the additional - listeners for the control plane load balancer. . + listeners for the control plane load balancer. items: description: AdditionalListenerSpec defines the desired state of an additional listener on an VPC load balancer. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml index f30594a95..1bcde6e4d 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclusters.yaml @@ -243,7 +243,7 @@ spec: properties: additionalListeners: description: AdditionalListeners sets the additional listeners - for the control plane load balancer. . + for the control plane load balancer. items: description: AdditionalListenerSpec defines the desired state of an additional listener on an VPC load balancer. diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclustertemplates.yaml index 9bf4b25b3..c19cbe3aa 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_ibmvpcclustertemplates.yaml @@ -93,7 +93,7 @@ spec: properties: additionalListeners: description: AdditionalListeners sets the additional listeners - for the control plane load balancer. . + for the control plane load balancer. items: description: AdditionalListenerSpec defines the desired state of an additional listener on an VPC load balancer.