-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
KEP-2887: OpenAPI Enum Types to Beta #3184
KEP-2887: OpenAPI Enum Types to Beta #3184
Conversation
b4342c4
to
de991a9
Compare
/assign @deads2k for PRR |
@jiahuif: GitHub didn't allow me to assign the following users: PRR, for. Note that only kubernetes members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. In response to this:
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. |
type Foo string | ||
type FooAlias = Foo | ||
``` | ||
would result in the parser to treat FooAlias as a duplicated type. A workaround will be implemented during alpha-to-beta graduation. |
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 is the workaround and how long do you anticipate the workaround existing?
@@ -580,13 +581,17 @@ feature flags will be enabled on some API servers and not others during the | |||
rollout. Similarly, consider large clusters and how enablement/disablement | |||
will rollout across nodes. | |||
--> | |||
If the API-server has multiple replicas, with some instances not yet enabling this feature, | |||
whether the returned OpenAPI Spec contains enum types will depend on which instance holds the leader lock. |
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 leader lock?
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.
Oops, I've been working too much with leader election recently. I meant depends on which instance handled the request.
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.
Updated.
I have questions about the design updates. the PRR lgtm |
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.
Two small nits
Co-authored-by: Tim Bannister <tim@scalefactory.com>
/label tide/merge-method-squash |
@@ -351,6 +351,16 @@ const ( | |||
|
|||
Here, `StorageMedium` can have infinite number of possible values, which disqualify it as an enum type. | |||
|
|||
The Go parser has a limitation on parsing type aliases. The parser cannot distinguish |
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 is "the Go parser"?
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.
changed to "The parser of Go compiler"
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.
is this really what we use for gengo to parse the types.go files?
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.
Yes. the imported package was go/parser
``` | ||
would result in the parser to treat FooAlias and Foo as the same type. | ||
As a result, `gengo` produce either `Foo` or `FooAlias` but not both. | ||
As a workaround, during beta graduation, the enum parser will be updated to accept any name of the type. |
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.
I'm not super clear on what this means, what's the exact behavior that you think we can have? Maybe include the bug too where a lot of the discussion has been going on.
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.
Or can we try to be less hand-wavy on what we'll do here? I'm not sure I understand what you're proposing
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.
I agree. Externalizing this to an issue in kubernetes/gengo
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.
I'd still be happy if we could discuss here what we can expect as a solution.
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.
I just realized that this issue should affect other markers too. I will keep it short in the KEP and describe it in a separate issue
27fa9bb
to
2c0ba07
Compare
2c0ba07
to
daebe14
Compare
Sgtm |
However, as of 1.23, the enum marker is the only marker to be added to a type declaration, and would be the first marker to be affected. | ||
Until there is a fix to `gengo`, the enum generator has the following limitations: | ||
- the enum marker must not be added to aliases | ||
- an aliased enum type or value SHOULD NOT have comments. Otherwise, the comments will be squashed with these of the original with undefined ordering. |
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.
being able to detect this case is important so people's verify scripts work consistently, right?.
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.
Correct. This should be detectable with simple regex matching. I will add a note that in this release cycle either gengo
gets a fix or I will add a check script to detect this.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: deads2k, jiahuif 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 |
That's still a little hand-wavy, but it's also fairly minor and somewhat unrelated to the specific feature. I'm also confident we can figure out a reasonable solution. Thanks. |
This PR revises KEP-2887 for its beta graduation.