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

⚠️ API cleanup of PortOpts #1914

Merged
merged 1 commit into from
Feb 29, 2024

Conversation

mdbooth
Copy link
Contributor

@mdbooth mdbooth commented Feb 28, 2024

Internally, all optional fields become pointers. This change has no direct effect on the CRD, but means that unset values and zero values now have different meanings.

SecurityGroupFilters is renamed to SecurityGroups for consistency with other filter fields used throughout the API. Note that this change thoroughly confuses conversion-gen. Consequently we explicitly disable the conversion of these fields in v1alpha6 and v1alpha5 and do the conversion entirely manually.

/hold

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 28, 2024
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Feb 28, 2024
Copy link

netlify bot commented Feb 28, 2024

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

Name Link
🔨 Latest commit 4c01e65
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/65e0769d185d4c0008c7648e
😎 Deploy Preview https://deploy-preview-1914--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 configuration.

@mdbooth
Copy link
Contributor Author

mdbooth commented Feb 28, 2024

@lentzi90 @EmilienM This is the first API cleanup change I've extracted. The API change itself is fairly simple. Some of the conversion is a bit hairy, which is mostly specific to this PR.

The new optional package will become a feature though. This allows us to customise the conversion behaviour for specific fields whilst otherwise retaining the defaults in apimachinery.

There will be more like this, but mostly simpler.

@mdbooth mdbooth force-pushed the portOptsCleanup branch 2 times, most recently from a1437bd to 5584a47 Compare February 28, 2024 19:22
@EmilienM
Copy link
Contributor

I really like it!
/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 28, 2024
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 28, 2024
@mdbooth mdbooth added this to the v1beta1 milestone Feb 28, 2024
@EmilienM
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 28, 2024
"k8s.io/apimachinery/pkg/conversion"
)

func Convert_string_To_optional_String(in *string, out *String, _ conversion.Scope) error {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trivial functions but still could be unit tests. We can do that later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a similar thought. I did actually include test coverage for them: notice I added a few 'empty object' conversion tests. These tests will fail if this method isn't doing its job correctly.

Copy link
Contributor

@lentzi90 lentzi90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lentzi90, 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

@EmilienM
Copy link
Contributor

/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 Feb 29, 2024
Internally, all optional fields become pointers. This change has no
direct effect on the CRD, but means that unset values and zero values
now have different meanings.

SecurityGroupFilters is renamed to SecurityGroups for consistency with
other filter fields used throughout the API. Note that this change
thoroughly confuses conversion-gen. Consequently we explicitly disable
the conversion of these fields in v1alpha6 and v1alpha5 and do the
conversion entirely manually.
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 29, 2024
@EmilienM
Copy link
Contributor

/lgtm
restoring lgtm, I just rebased on main and ran make generate.

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

mdbooth commented Feb 29, 2024

/lgtm restoring lgtm, I just rebased on main and ran make generate.

I'm pretty sure this will have fixed it. Not sure why the test run against your most recent push is wedged.

@mdbooth
Copy link
Contributor Author

mdbooth commented Feb 29, 2024

/test pull-cluster-api-provider-openstack-test

@k8s-ci-robot k8s-ci-robot merged commit 9e00969 into kubernetes-sigs:main Feb 29, 2024
9 checks passed
@EmilienM EmilienM deleted the portOptsCleanup branch February 29, 2024 14:12
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants