Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
a9cee59f
Commit
a9cee59f
authored
Dec 06, 2016
by
mbohlool
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix pods/log OpenAPI/Swagger spec to return string instead of v1.Pod
parent
23d7615e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
1 deletion
+22
-1
rest.go
pkg/api/rest/rest.go
+4
-0
api_installer.go
pkg/apiserver/api_installer.go
+9
-1
apiserver_test.go
pkg/apiserver/apiserver_test.go
+4
-0
log.go
pkg/registry/core/pod/rest/log.go
+5
-0
No files found.
pkg/api/rest/rest.go
View file @
a9cee59f
...
...
@@ -290,6 +290,10 @@ type StorageMetadata interface {
// ProducesMIMETypes returns a list of the MIME types the specified HTTP verb (GET, POST, DELETE,
// PATCH) can respond with.
ProducesMIMETypes
(
verb
string
)
[]
string
// ProducesObject returns an object the specified HTTP verb respond with. It will overwrite storage object if
// it is not nil. Only the type of the return object matters, the value will be ignored.
ProducesObject
(
verb
string
)
interface
{}
}
// ConnectRequest is an object passed to admission control for Connect operations
...
...
pkg/apiserver/api_installer.go
View file @
a9cee59f
...
...
@@ -213,7 +213,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
if
err
!=
nil
{
return
nil
,
err
}
v
ersionedObject
:=
indirectArbitraryPointer
(
versionedPtr
)
defaultV
ersionedObject
:=
indirectArbitraryPointer
(
versionedPtr
)
kind
:=
fqKindToRegister
.
Kind
hasSubresource
:=
len
(
subresource
)
>
0
...
...
@@ -520,6 +520,10 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
Kind
:
fqKindToRegister
,
}
for
_
,
action
:=
range
actions
{
versionedObject
:=
storageMeta
.
ProducesObject
(
action
.
Verb
)
if
versionedObject
==
nil
{
versionedObject
=
defaultVersionedObject
}
reqScope
.
Namer
=
action
.
Namer
namespaced
:=
""
if
apiResource
.
Namespaced
{
...
...
@@ -1054,6 +1058,10 @@ func (defaultStorageMetadata) ProducesMIMETypes(verb string) []string {
return
nil
}
func
(
defaultStorageMetadata
)
ProducesObject
(
verb
string
)
interface
{}
{
return
nil
}
// splitSubresource checks if the given storage path is the path of a subresource and returns
// the resource and subresource components.
func
splitSubresource
(
path
string
)
(
string
,
string
,
error
)
{
...
...
pkg/apiserver/apiserver_test.go
View file @
a9cee59f
...
...
@@ -620,6 +620,10 @@ func (m *MetadataRESTStorage) ProducesMIMETypes(method string) []string {
return
m
.
types
}
func
(
m
*
MetadataRESTStorage
)
ProducesObject
(
verb
string
)
interface
{}
{
return
nil
}
var
_
rest
.
StorageMetadata
=
&
MetadataRESTStorage
{}
type
GetWithOptionsRESTStorage
struct
{
...
...
pkg/registry/core/pod/rest/log.go
View file @
a9cee59f
...
...
@@ -55,6 +55,11 @@ func (r *LogREST) ProducesMIMETypes(verb string) []string {
}
}
// LogREST implements StorageMetadata, return string as the generating object
func
(
r
*
LogREST
)
ProducesObject
(
verb
string
)
interface
{}
{
return
""
}
// Get retrieves a runtime.Object that will stream the contents of the pod log
func
(
r
*
LogREST
)
Get
(
ctx
api
.
Context
,
name
string
,
opts
runtime
.
Object
)
(
runtime
.
Object
,
error
)
{
logOpts
,
ok
:=
opts
.
(
*
api
.
PodLogOptions
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment