Skip to content
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

feat: add configurable loadbalancer network #1922

Merged
merged 1 commit into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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