Skip to content

Commit

Permalink
Merge pull request #1922 from oblazek/ob-loadbalancer-network
Browse files Browse the repository at this point in the history
feat: add configurable loadbalancer network
  • Loading branch information
k8s-ci-robot authored Apr 9, 2024
2 parents 6c83bc4 + e2897fb commit 9aaf481
Show file tree
Hide file tree
Showing 13 changed files with 738 additions and 74 deletions.
3 changes: 3 additions & 0 deletions api/v1alpha5/zz_generated.conversion.go

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

45 changes: 43 additions & 2 deletions api/v1alpha6/openstackcluster_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ func restorev1beta1ClusterSpec(previous *infrav1.OpenStackClusterSpec, dst *infr
dst.APIServerLoadBalancer.Enabled = previous.APIServerLoadBalancer.Enabled
}
optional.RestoreString(&previous.APIServerLoadBalancer.Provider, &dst.APIServerLoadBalancer.Provider)

if previous.APIServerLoadBalancer.Network != nil {
dst.APIServerLoadBalancer.Network = previous.APIServerLoadBalancer.Network
}
if previous.APIServerLoadBalancer.Subnets != nil {
dst.APIServerLoadBalancer.Subnets = previous.APIServerLoadBalancer.Subnets
}
}
if dst.APIServerLoadBalancer.IsZero() {
dst.APIServerLoadBalancer = previous.APIServerLoadBalancer
Expand Down Expand Up @@ -294,6 +301,18 @@ func Convert_v1alpha6_OpenStackClusterSpec_To_v1beta1_OpenStackClusterSpec(in *O
return nil
}

func Convert_v1beta1_APIServerLoadBalancer_To_v1alpha6_APIServerLoadBalancer(in *infrav1.APIServerLoadBalancer, out *APIServerLoadBalancer, s apiconversion.Scope) error {
return autoConvert_v1beta1_APIServerLoadBalancer_To_v1alpha6_APIServerLoadBalancer(in, out, s)
}

func Convert_v1beta1_LoadBalancer_To_v1alpha6_LoadBalancer(in *infrav1.LoadBalancer, out *LoadBalancer, s apiconversion.Scope) error {
return autoConvert_v1beta1_LoadBalancer_To_v1alpha6_LoadBalancer(in, out, s)
}

func Convert_v1alpha6_APIServerLoadBalancer_To_v1beta1_APIServerLoadBalancer(in *APIServerLoadBalancer, out *infrav1.APIServerLoadBalancer, s apiconversion.Scope) error {
return autoConvert_v1alpha6_APIServerLoadBalancer_To_v1beta1_APIServerLoadBalancer(in, out, s)
}

func Convert_v1beta1_OpenStackClusterSpec_To_v1alpha6_OpenStackClusterSpec(in *infrav1.OpenStackClusterSpec, out *OpenStackClusterSpec, s apiconversion.Scope) error {
err := autoConvert_v1beta1_OpenStackClusterSpec_To_v1alpha6_OpenStackClusterSpec(in, out, s)
if err != nil {
Expand Down Expand Up @@ -375,6 +394,10 @@ func restorev1beta1ClusterStatus(previous *infrav1.OpenStackClusterStatus, dst *
dst.BastionSecurityGroup = previous.BastionSecurityGroup

restorev1beta1BastionStatus(previous.Bastion, dst.Bastion)

if previous.APIServerLoadBalancer != nil {
dst.APIServerLoadBalancer = previous.APIServerLoadBalancer
}
}

func Convert_v1beta1_OpenStackClusterStatus_To_v1alpha6_OpenStackClusterStatus(in *infrav1.OpenStackClusterStatus, out *OpenStackClusterStatus, s apiconversion.Scope) error {
Expand All @@ -390,7 +413,16 @@ func Convert_v1beta1_OpenStackClusterStatus_To_v1alpha6_OpenStackClusterStatus(i
}

out.Network.Router = (*Router)(in.Router)
out.Network.APIServerLoadBalancer = (*LoadBalancer)(in.APIServerLoadBalancer)
if in.APIServerLoadBalancer != nil {
out.Network.APIServerLoadBalancer = &LoadBalancer{
Name: in.APIServerLoadBalancer.Name,
ID: in.APIServerLoadBalancer.ID,
IP: in.APIServerLoadBalancer.IP,
InternalIP: in.APIServerLoadBalancer.InternalIP,
AllowedCIDRs: in.APIServerLoadBalancer.AllowedCIDRs,
Tags: in.APIServerLoadBalancer.Tags,
}
}
}

return nil
Expand All @@ -405,7 +437,16 @@ func Convert_v1alpha6_OpenStackClusterStatus_To_v1beta1_OpenStackClusterStatus(i
// Router and APIServerLoadBalancer have been moved out of Network in v1beta1
if in.Network != nil {
out.Router = (*infrav1.Router)(in.Network.Router)
out.APIServerLoadBalancer = (*infrav1.LoadBalancer)(in.Network.APIServerLoadBalancer)
if in.Network.APIServerLoadBalancer != nil {
out.APIServerLoadBalancer = &infrav1.LoadBalancer{
Name: in.Network.APIServerLoadBalancer.Name,
ID: in.Network.APIServerLoadBalancer.ID,
IP: in.Network.APIServerLoadBalancer.IP,
InternalIP: in.Network.APIServerLoadBalancer.InternalIP,
AllowedCIDRs: in.Network.APIServerLoadBalancer.AllowedCIDRs,
Tags: in.Network.APIServerLoadBalancer.Tags,
}
}
}

return nil
Expand Down
48 changes: 18 additions & 30 deletions api/v1alpha6/zz_generated.conversion.go

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

24 changes: 24 additions & 0 deletions api/v1alpha7/openstackcluster_conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,14 @@ func restorev1beta1ClusterSpec(previous *infrav1.OpenStackClusterSpec, dst *infr
dst.APIServerLoadBalancer.Enabled = previous.APIServerLoadBalancer.Enabled
}
optional.RestoreString(&previous.APIServerLoadBalancer.Provider, &dst.APIServerLoadBalancer.Provider)

if previous.APIServerLoadBalancer.Network != nil {
dst.APIServerLoadBalancer.Network = previous.APIServerLoadBalancer.Network
}

if previous.APIServerLoadBalancer.Subnets != nil {
dst.APIServerLoadBalancer.Subnets = previous.APIServerLoadBalancer.Subnets
}
}
if dst.APIServerLoadBalancer.IsZero() {
dst.APIServerLoadBalancer = previous.APIServerLoadBalancer
Expand Down Expand Up @@ -300,6 +308,18 @@ func Convert_v1alpha7_OpenStackClusterSpec_To_v1beta1_OpenStackClusterSpec(in *O
return nil
}

func Convert_v1beta1_LoadBalancer_To_v1alpha7_LoadBalancer(in *infrav1.LoadBalancer, out *LoadBalancer, s apiconversion.Scope) error {
return autoConvert_v1beta1_LoadBalancer_To_v1alpha7_LoadBalancer(in, out, s)
}

func Convert_v1beta1_APIServerLoadBalancer_To_v1alpha7_APIServerLoadBalancer(in *infrav1.APIServerLoadBalancer, out *APIServerLoadBalancer, s apiconversion.Scope) error {
return autoConvert_v1beta1_APIServerLoadBalancer_To_v1alpha7_APIServerLoadBalancer(in, out, s)
}

func Convert_v1alpha7_APIServerLoadBalancer_To_v1beta1_APIServerLoadBalancer(in *APIServerLoadBalancer, out *infrav1.APIServerLoadBalancer, s apiconversion.Scope) error {
return autoConvert_v1alpha7_APIServerLoadBalancer_To_v1beta1_APIServerLoadBalancer(in, out, s)
}

func Convert_v1beta1_OpenStackClusterSpec_To_v1alpha7_OpenStackClusterSpec(in *infrav1.OpenStackClusterSpec, out *OpenStackClusterSpec, s apiconversion.Scope) error {
err := autoConvert_v1beta1_OpenStackClusterSpec_To_v1alpha7_OpenStackClusterSpec(in, out, s)
if err != nil {
Expand Down Expand Up @@ -362,6 +382,10 @@ func restorev1beta1ClusterStatus(previous *infrav1.OpenStackClusterStatus, dst *
}

restorev1beta1BastionStatus(previous.Bastion, dst.Bastion)

if previous.APIServerLoadBalancer != nil {
dst.APIServerLoadBalancer = previous.APIServerLoadBalancer
}
}

func Convert_v1beta1_OpenStackClusterStatus_To_v1alpha7_OpenStackClusterStatus(in *infrav1.OpenStackClusterStatus, out *OpenStackClusterStatus, s apiconversion.Scope) error {
Expand Down
Loading

0 comments on commit 9aaf481

Please sign in to comment.