Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
OpenAPI V3 Root interface and basic implementation #115393
OpenAPI V3 Root interface and basic implementation #115393
Changes from all commits
5b48247
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Since we've seen that in the other PR, there are some paths that don't map to group-version unfortunately, we should probably ignore these? Unfortunately, I also don't like just being lenient here, do we have a way to be more strict yet allowing the non-matching files @Jefftree ?
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.
Having the non-gv in the test
NewFileClient
will also help you actually test that this code does the right thing by the way.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.
Are there any use cases of requiring the OpenAPI for non group-version paths? If there aren't, I think we should ignore them and users can use
Raw()
if they need those paths to do their own post processing?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 don't think they should do Raw, they should just not use this abstraction (call path and get the bytes?). Hmm, that's not ideal, but we don't have use-cases for them anyway, so let's wait for that.
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.
That's basically using Raw with their own path though? https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/openapi/groupversion.go#L41-L46.
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.
When an api path (e.g. api/apps/v1) does not correctly translate to a GroupVersion, we're now ignoring with a
continue
. Please have a look, including the tests.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 sure what you want to see happen Jeff? Part of the problem is that this API does two things:
map[string]interface{}
, oropenapi3.Spec
).We could possibly (in another PR), split these two responsibilities, i.e. have:
And now if you want to access a non-gv openapi, you can use the parser instead?
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 was just trying to understand use cases for accessing a non-gv openapi, if there aren't any I feel like there's no strong reason to split the responsibilities and make it more complex for the user. I like that we're handling both the GV and raw bytes parsing in the same interface so users don't have to deal with the underlying abstraction.
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 there such util function already implemented somewhere that can be reused directly?
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.
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/client-go/rest/url_utils.go#L64-L78
Found an existing util function for groupversion -> path but not sure if there exists something for the other way around (path -> groupversion)
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.
ditto. it seems to be a common util function.
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.
@seans3 Line 155 enforces the length to be 2 or more, but this line accesses the third index in the array. This causes certain paths to fail when the length is exactly 2 with
runtime error: index out of range [2] with length 2
(eg:/apis/apps
)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.
/apis/apps
does not work because it is not an acceptable input. It should beapis/apps
(without leading/
). And it should always have aVersion
, so it should beapis/apps/v1
.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.
After talk offline, I have a better idea of the issue--thanks.