mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-07 03:03:59 +00:00
Fix pods/log OpenAPI/Swagger spec to return string instead of v1.Pod
This commit is contained in:
parent
23d7615e7f
commit
a9cee59f69
@ -290,6 +290,10 @@ type StorageMetadata interface {
|
|||||||
// ProducesMIMETypes returns a list of the MIME types the specified HTTP verb (GET, POST, DELETE,
|
// ProducesMIMETypes returns a list of the MIME types the specified HTTP verb (GET, POST, DELETE,
|
||||||
// PATCH) can respond with.
|
// PATCH) can respond with.
|
||||||
ProducesMIMETypes(verb string) []string
|
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
|
// ConnectRequest is an object passed to admission control for Connect operations
|
||||||
|
@ -213,7 +213,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
versionedObject := indirectArbitraryPointer(versionedPtr)
|
defaultVersionedObject := indirectArbitraryPointer(versionedPtr)
|
||||||
kind := fqKindToRegister.Kind
|
kind := fqKindToRegister.Kind
|
||||||
hasSubresource := len(subresource) > 0
|
hasSubresource := len(subresource) > 0
|
||||||
|
|
||||||
@ -520,6 +520,10 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
|
|||||||
Kind: fqKindToRegister,
|
Kind: fqKindToRegister,
|
||||||
}
|
}
|
||||||
for _, action := range actions {
|
for _, action := range actions {
|
||||||
|
versionedObject := storageMeta.ProducesObject(action.Verb)
|
||||||
|
if versionedObject == nil {
|
||||||
|
versionedObject = defaultVersionedObject
|
||||||
|
}
|
||||||
reqScope.Namer = action.Namer
|
reqScope.Namer = action.Namer
|
||||||
namespaced := ""
|
namespaced := ""
|
||||||
if apiResource.Namespaced {
|
if apiResource.Namespaced {
|
||||||
@ -1054,6 +1058,10 @@ func (defaultStorageMetadata) ProducesMIMETypes(verb string) []string {
|
|||||||
return nil
|
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
|
// splitSubresource checks if the given storage path is the path of a subresource and returns
|
||||||
// the resource and subresource components.
|
// the resource and subresource components.
|
||||||
func splitSubresource(path string) (string, string, error) {
|
func splitSubresource(path string) (string, string, error) {
|
||||||
|
@ -620,6 +620,10 @@ func (m *MetadataRESTStorage) ProducesMIMETypes(method string) []string {
|
|||||||
return m.types
|
return m.types
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *MetadataRESTStorage) ProducesObject(verb string) interface{} {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var _ rest.StorageMetadata = &MetadataRESTStorage{}
|
var _ rest.StorageMetadata = &MetadataRESTStorage{}
|
||||||
|
|
||||||
type GetWithOptionsRESTStorage struct {
|
type GetWithOptionsRESTStorage struct {
|
||||||
|
@ -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
|
// 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) {
|
func (r *LogREST) Get(ctx api.Context, name string, opts runtime.Object) (runtime.Object, error) {
|
||||||
logOpts, ok := opts.(*api.PodLogOptions)
|
logOpts, ok := opts.(*api.PodLogOptions)
|
||||||
|
Loading…
Reference in New Issue
Block a user