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

add raw string/multiline syntax to marker comments #446

Merged
merged 8 commits into from
Jan 26, 2024

Conversation

alexzielenski
Copy link
Contributor

@alexzielenski alexzielenski commented Jan 17, 2024

adds ability to specify a raw/multiline string in kube-openapi marker comments to make longer strings more ergonomic to use

Syntax Example:

+k8s:validation:key> value line 1
+k8s:validation:key> value line 2

yields key="validation line 2\nvalidation line 2"

Note: Whitespace at edges are trimmed

Using = to specify multiple key-value pairs is now an error for k8s:validation prefixed items. Lists must be specified using explicit indices

/assign @Jefftree
/cc @Schnides123

adds ability to specify a raw/multiline string in kube-openapi marker comments to make longer strings more ergonomic to use
@k8s-ci-robot
Copy link
Contributor

@alexzielenski: GitHub didn't allow me to request PR reviews from the following users: Schnides123.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

adds ability to specify a raw/multiline string in kube-openapi marker comments to make longer strings more ergonomic to use

/assign @Jefftree
/cc @Schnides123

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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 17, 2024
@alexzielenski alexzielenski changed the title add raw string syntax to marker comments add raw string/multiline syntax to marker comments Jan 17, 2024
pkg/generators/markers.go Outdated Show resolved Hide resolved
pkg/generators/markers.go Show resolved Hide resolved
@jpbetz
Copy link
Contributor

jpbetz commented Jan 22, 2024

I'm okay with this as an approach. I haven't reviewed the implementation in detail. Since this is not API facing, I think we just need to get agreement on the go tag format internally.

@thockin @deads2k do you have any thoughts on this format? It seems to me that it expands our go tag support to handle the cases we need to handle, and avoids the "super long oneline gotags" that kubebuilder suffers from

Copy link
Contributor

@jpbetz jpbetz left a comment

Choose a reason for hiding this comment

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

It's going to be great to have this. Two minor comments then LGTM. I'd like to get one other lead to review the syntax, but I think it balances the tradeoffs well.

pkg/generators/markers.go Outdated Show resolved Hide resolved
pkg/generators/markers_test.go Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 25, 2024
Copy link
Contributor

@jpbetz jpbetz left a comment

Choose a reason for hiding this comment

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

just a couple nits

pkg/generators/markers.go Outdated Show resolved Hide resolved
pkg/generators/markers.go Outdated Show resolved Hide resolved
pkg/generators/markers.go Outdated Show resolved Hide resolved
pkg/generators/markers.go Show resolved Hide resolved
pkg/generators/markers.go Show resolved Hide resolved
pkg/generators/markers.go Outdated Show resolved Hide resolved
@jpbetz
Copy link
Contributor

jpbetz commented Jan 25, 2024

LGTM once test issue is cleared (some kind of duplication)?

@Jefftree
Copy link
Member

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexzielenski, Jefftree

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:
  • OWNERS [Jefftree,alexzielenski]

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 merged commit 2919ad4 into kubernetes:master Jan 26, 2024
4 checks passed
Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

Thanks!

// one time and all values are returned. Returns a map with an entry for
// for each key and a value.
//
// Similar to version from gengo, but this version support only allows one
Copy link
Member

Choose a reason for hiding this comment

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

Previous paragraph says "A tag can be specified more than one time and all values are returned." but this says "only allows one value".

Am I misunderstanding?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gah, that was missed when modifying the original comment.

The correct doc should read only one value per key. I'll correct that

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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants