Skip to content

Commit

Permalink
Update loadbalancer api spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthik-K-N committed Mar 13, 2024
1 parent 1cc2bc3 commit cf6572a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion api/v1beta2/ibmvpccluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type VPCLoadBalancerSpec struct {
// public indicates that load balancer is public or private
// +kubebuilder:default=true
// +optional
Public bool `json:"public,omitempty"`
Public *bool `json:"public,omitempty"`

// AdditionalListeners sets the additional listeners for the control plane load balancer.
// +listType=map
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions cloud/scope/powervs_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,11 @@ func (s *PowerVSClusterScope) PublicLoadBalancer() *infrav1beta2.VPCLoadBalancer
if len(s.IBMPowerVSCluster.Spec.LoadBalancers) == 0 {
return &infrav1beta2.VPCLoadBalancerSpec{
Name: *s.GetServiceName(infrav1beta2.ResourceTypeLoadBalancer),
Public: true,
Public: pointer.Bool(true),
}
}
for _, lb := range s.IBMPowerVSCluster.Spec.LoadBalancers {
if lb.Public {
if lb.Public != nil && *lb.Public {
return &lb
}
}
Expand Down Expand Up @@ -1213,7 +1213,7 @@ func (s *PowerVSClusterScope) ReconcileLoadBalancer() error {
if len(s.IBMPowerVSCluster.Spec.LoadBalancers) == 0 {
loadBalancer := infrav1beta2.VPCLoadBalancerSpec{
Name: *s.GetServiceName(infrav1beta2.ResourceTypeLoadBalancer),
Public: true,
Public: pointer.Bool(true),
}
loadBalancers = append(loadBalancers, loadBalancer)
}
Expand Down Expand Up @@ -1296,8 +1296,12 @@ func (s *PowerVSClusterScope) createLoadBalancer(lb infrav1beta2.VPCLoadBalancer
return nil, fmt.Errorf("error getting resource group id for resource group %v, id is empty", s.ResourceGroup())
}

var isPublic bool
if lb.Public != nil && *lb.Public {
isPublic = true
}
options.SetIsPublic(isPublic)
options.SetName(lb.Name)
options.SetIsPublic(lb.Public)
options.SetResourceGroup(&vpcv1.ResourceGroupIdentity{
ID: &resourceGroupID,
})
Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/powervs_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ func (m *PowerVSMachineScope) CreateVPCLoadBalancerPoolMember() (*vpcv1.LoadBala
if len(m.IBMPowerVSCluster.Spec.LoadBalancers) == 0 {
loadBalancer := infrav1beta2.VPCLoadBalancerSpec{
Name: fmt.Sprintf("%s-loadbalancer", m.IBMPowerVSCluster.Name),
Public: true,
Public: pointer.Bool(true),
}
loadBalancers = append(loadBalancers, loadBalancer)
}
Expand Down

0 comments on commit cf6572a

Please sign in to comment.