-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
Make RESTMapper scope aware, use it to inform kubectl and swagger behavior #3944
Merged
smarterclayton
merged 9 commits into
kubernetes:master
from
derekwaynecarr:rest_mapper_scope_support
Feb 2, 2015
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
71ec444
Make a RESTMapper scope aware
derekwaynecarr f911784
Cherry pick test from #3901
derekwaynecarr 4c33e36
Plumb restmapper properly through apiserver and tests
derekwaynecarr a844973
Make the FilterNamespace function the last visitor
derekwaynecarr a216cb7
Fix logic issue in register resource handlers not doing list across a…
derekwaynecarr 22ceccc
Fix TestUnimplementedRESTStorage
derekwaynecarr 0851ca9
Do not provide a namespace on request url if resource does not requir…
derekwaynecarr d3579f0
Fix integration test to return 404 where a resource is not even suppo…
derekwaynecarr a928be5
Code review comments
derekwaynecarr File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,6 +94,30 @@ type MetadataAccessor interface { | |
runtime.ResourceVersioner | ||
} | ||
|
||
type RESTScopeName string | ||
|
||
const ( | ||
RESTScopeNameNamespace RESTScopeName = "namespace" | ||
RESTScopeNameRoot RESTScopeName = "root" | ||
) | ||
|
||
// RESTScope contains the information needed to deal with REST resources that are in a resource hierarchy | ||
// TODO After we deprecate v1beta1 and v1beta2, we can look a supporting removing the flexibility of supporting | ||
// either a query or path param, and instead just support path param | ||
type RESTScope interface { | ||
// Name of the scope | ||
Name() RESTScopeName | ||
// ParamName is the optional name of the parameter that should be inserted in the resource url | ||
// If empty, no param will be inserted | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you put a TODO here that once v1beta1 and v1beta2 are removed, we should consider removing this flexibility everywhere? |
||
ParamName() string | ||
// ParamPath is a boolean that controls how the parameter is manifested in resource paths | ||
// If true, this parameter is encoded in path (i.e. /{paramName}/{paramValue}) | ||
// If false, this parameter is encoded in query (i.e. ?{paramName}={paramValue}) | ||
ParamPath() bool | ||
// ParamDescription is the optional description to use to document the parameter in api documentation | ||
ParamDescription() string | ||
} | ||
|
||
// RESTMapping contains the information needed to deal with objects of a specific | ||
// resource and kind in a RESTful manner. | ||
type RESTMapping struct { | ||
|
@@ -104,6 +128,9 @@ type RESTMapping struct { | |
APIVersion string | ||
Kind string | ||
|
||
// Scope contains the information needed to deal with REST Resources that are in a resource hierarchy | ||
Scope RESTScope | ||
|
||
runtime.Codec | ||
runtime.ObjectConvertor | ||
MetadataAccessor | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
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.
You preferred that to "cluster"?
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.
My bias at the time was that it should go at the root of a path.