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

⚠️ Convert ServerMetadata from a map to a list #1828

Merged
merged 1 commit into from
Jan 31, 2024

Conversation

mdbooth
Copy link
Contributor

@mdbooth mdbooth commented Jan 16, 2024

While we're changing it, we also add validation that keys and values don't exceed 255 characters.

Fixes: #1684

TODO:

  • Docs

/hold

Copy link

netlify bot commented Jan 16, 2024

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

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

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jan 16, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 16, 2024
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jan 16, 2024
type: array
x-kubernetes-list-map-keys:
- key
x-kubernetes-list-type: map
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this have more consequences, like e.g. not allowing some characters because K8s doesn't allow them, but OpenStack does?

Copy link
Contributor Author

@mdbooth mdbooth Jan 17, 2024

Choose a reason for hiding this comment

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

I don't think there are any constraints on map keys. The documentation only says:

The key fields must be scalars.

They don't have the same constraints as names.

// Value is the server metadata value
// kubebuilder:validation:MaxLength:=255
Value string `json:"value"`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we may have other K/V settings , maybe something like Metadata then others reuse it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This lead me down an interesting rabbit hole which lead here: https://kubernetes.slack.com/archives/C05G4NJ6P6X/p1705486348670669

cc @lentzi90

I don't think so. The only other similar use I found was ValueSpecs, and the above rabbit hole lead me to believe we might want to remove that.

This struct has a 255 character limit on keys and values, which would likely not apply elsewhere.

If we did find another user for it, we could always DRY it later, as struct names don't form part of the API.

For now I think this is ok.

Copy link
Contributor

@jichenjc jichenjc Jan 19, 2024

Choose a reason for hiding this comment

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

ok, just check in case as I think metadata KV is widely used , but I agree 255 might be a thing not widely used

@mdbooth
Copy link
Contributor Author

mdbooth commented Jan 17, 2024

/hold for docs

@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 Jan 17, 2024
@EmilienM
Copy link
Contributor

/hold cancel
doc was pushed.

I'll ask another reviewer to check it before lgtm.

@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 Jan 18, 2024
Copy link
Contributor

@MaysaMacedo MaysaMacedo left a comment

Choose a reason for hiding this comment

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

/lgtm

Nice work, Matt

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 18, 2024
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 18, 2024
@EmilienM
Copy link
Contributor

It's failing on conversion now, Matt changed something with fuzzer, it'll need adjustment. I'll have a look tomorrow.

@EmilienM
Copy link
Contributor

/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 Jan 18, 2024
While we're changing it, we also add validation that keys and values
don't exceed 255 characters.
@EmilienM
Copy link
Contributor

/lgtm
/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 Jan 31, 2024
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 31, 2024
@EmilienM
Copy link
Contributor

Thanks Matt for fixing conversion.

@k8s-ci-robot k8s-ci-robot merged commit a80cdd2 into kubernetes-sigs:main Jan 31, 2024
9 checks passed
@mdbooth mdbooth deleted the server-metadata branch February 2, 2024 09:23
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.

OpenStackMachineSpec.ServerMetadata should not be a map
6 participants