Skip to content

Conversation

@apricote
Copy link
Member

What this PR does / why we need it:

Modify the v1beta1 CRD and move the loadbalancer fields OpenStackClusterSpec.{ManagedAPIServerLoadBalancer,APIServerLoadBalancerAdditionalPorts} into a struct at OpenStackClusterSpec.APIServerLoadBalancer to enable adding further customizations. This was previously discussed in #1105.

Which issue(s) this PR fixes:
Related to #1105

Special notes for your reviewer:

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • if necessary:
    • includes documentation
    • adds unit tests

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 31, 2022
@netlify
Copy link

netlify bot commented Mar 31, 2022

Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!

Name Link
🔨 Latest commit 8c4352c
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/62458df4a98a9b000823df58
😎 Deploy Preview https://deploy-preview-1187--kubernetes-sigs-cluster-api-openstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 31, 2022
@jichenjc
Copy link
Contributor

Thanks for the PR, I assume you need update templates/*.yaml (e.g cluster-template.yaml) and maybe e2e settings
in order to honor the new things introduced?

@apricote
Copy link
Member Author

I just pushed an update that contains:

  • Unit tests for the conversions
  • Fixed OpenStackCluster manifests in templates/ and test/data/infrastructure-openstack
  • updated generated conversions (make generate)

@jichenjc
Copy link
Contributor

jichenjc commented Apr 1, 2022

/lgtm

thanks for the fix ~

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 1, 2022
@mdbooth
Copy link
Contributor

mdbooth commented Apr 1, 2022

This is a really nice cleanup.

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: apricote, mdbooth

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 1, 2022
@apricote
Copy link
Member Author

apricote commented Apr 1, 2022

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 1, 2022
@apricote
Copy link
Member Author

apricote commented Apr 1, 2022

Looks like a flaky test, was previously successful on the same commit.

/retest

}
out.APIServerLoadBalancer = infrav1.APIServerLoadBalancer{
Enabled: in.ManagedAPIServerLoadBalancer,
AdditionalPorts: *(*[]int)(unsafe.Pointer(&in.APIServerLoadBalancerAdditionalPorts)),
Copy link
Member

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?:

Suggested change
AdditionalPorts: *(*[]int)(unsafe.Pointer(&in.APIServerLoadBalancerAdditionalPorts)),
AdditionalPorts: in.APIServerLoadBalancerAdditionalPorts,

}

out.ManagedAPIServerLoadBalancer = in.APIServerLoadBalancer.Enabled
out.APIServerLoadBalancerAdditionalPorts = *(*[]int)(unsafe.Pointer(&in.APIServerLoadBalancer.AdditionalPorts))
Copy link
Member

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?:

Suggested change
out.APIServerLoadBalancerAdditionalPorts = *(*[]int)(unsafe.Pointer(&in.APIServerLoadBalancer.AdditionalPorts))
out.APIServerLoadBalancerAdditionalPorts = in.APIServerLoadBalancer.AdditionalPorts

Copy link
Member Author

Choose a reason for hiding this comment

The 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 conversion-gen: https://github.com/kubernetes/code-generator/blob/7e38d5771c5636f13555f0058e5936c521d2fe13/cmd/conversion-gen/generators/conversion.go#L929

Copy link
Member

Choose a reason for hiding this comment

The 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 :-)

Copy link
Member Author

Choose a reason for hiding this comment

The 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 unsafe.Pointer logic provided by conversion-gen.

@k8s-ci-robot k8s-ci-robot merged commit d9be9d0 into kubernetes-sigs:main Apr 1, 2022
@apricote apricote deleted the loadbalancer-struct branch April 1, 2022 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants