-
Notifications
You must be signed in to change notification settings - Fork 284
⚠️ move loadbalancer opts to struct #1187
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -17,6 +17,8 @@ limitations under the License. | |||||
| package v1alpha3 | ||||||
|
|
||||||
| import ( | ||||||
| unsafe "unsafe" | ||||||
|
|
||||||
| corev1 "k8s.io/api/core/v1" | ||||||
| conversion "k8s.io/apimachinery/pkg/conversion" | ||||||
| ctrlconversion "sigs.k8s.io/controller-runtime/pkg/conversion" | ||||||
|
|
@@ -117,6 +119,10 @@ func Convert_v1alpha3_OpenStackClusterSpec_To_v1beta1_OpenStackClusterSpec(in *O | |||||
| Name: in.CloudsSecret.Name, | ||||||
| } | ||||||
| } | ||||||
| out.APIServerLoadBalancer = infrav1.APIServerLoadBalancer{ | ||||||
| Enabled: in.ManagedAPIServerLoadBalancer, | ||||||
| AdditionalPorts: *(*[]int)(unsafe.Pointer(&in.APIServerLoadBalancerAdditionalPorts)), | ||||||
| } | ||||||
| return autoConvert_v1alpha3_OpenStackClusterSpec_To_v1beta1_OpenStackClusterSpec(in, out, s) | ||||||
| } | ||||||
|
|
||||||
|
|
@@ -139,6 +145,10 @@ func Convert_v1beta1_OpenStackClusterSpec_To_v1alpha3_OpenStackClusterSpec(in *i | |||||
| Name: in.Bastion.Instance.IdentityRef.Name, | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| out.ManagedAPIServerLoadBalancer = in.APIServerLoadBalancer.Enabled | ||||||
| out.APIServerLoadBalancerAdditionalPorts = *(*[]int)(unsafe.Pointer(&in.APIServerLoadBalancer.AdditionalPorts)) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What's the reason for using unsafe here? couldn't it be as easy as the following?:
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was too slow with answering, not its merged :( I copied this from the previous autogenerated conversion. The code is coming from
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So this whole part is auto generated? If so we have to keep it, otherwise I would prefer to clean it up in a follow-up PR :-)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, my changes are not auto-generated, but I did not understand the semantics of the conversion code enough to remove the |
||||||
|
|
||||||
| return autoConvert_v1beta1_OpenStackClusterSpec_To_v1alpha3_OpenStackClusterSpec(in, out, s) | ||||||
| } | ||||||
|
|
||||||
|
|
||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
What's the reason for using unsafe here? couldn't it be as easy as the following?: