Skip to content

Commit

Permalink
Merge pull request kubernetes#10426 from csrwng/api_versioned_options
Browse files Browse the repository at this point in the history
API Server: Use versioned objects for GET and CONNECT operations
  • Loading branch information
mikedanese committed Jul 29, 2015
2 parents 63cf00d + a84fa79 commit 59611d7
Show file tree
Hide file tree
Showing 3 changed files with 304 additions and 13 deletions.
216 changes: 216 additions & 0 deletions api/swagger-spec/v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -5706,6 +5706,54 @@
"summary": "connect GET requests to exec of Pod",
"nickname": "connectGetNamespacedPodExec",
"parameters": [
{
"type": "boolean",
"paramType": "query",
"name": "stdin",
"description": "redirect the standard input stream of the pod for this call; defaults to false",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "stdout",
"description": "redirect the standard output stream of the pod for this call; defaults to true",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "stderr",
"description": "redirect the standard error stream of the pod for this call; defaults to true",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "tty",
"description": "allocate a terminal for this exec call; defaults to false",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "container",
"description": "the container in which to execute the command. Defaults to only container if there is only one container in the pod.",
"required": false,
"allowMultiple": false
},
{
"type": "",
"paramType": "query",
"name": "command",
"description": "the command to execute; argv array; not executed within a shell",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -5736,6 +5784,54 @@
"summary": "connect POST requests to exec of Pod",
"nickname": "connectPostNamespacedPodExec",
"parameters": [
{
"type": "boolean",
"paramType": "query",
"name": "stdin",
"description": "redirect the standard input stream of the pod for this call; defaults to false",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "stdout",
"description": "redirect the standard output stream of the pod for this call; defaults to true",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "stderr",
"description": "redirect the standard error stream of the pod for this call; defaults to true",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "tty",
"description": "allocate a terminal for this exec call; defaults to false",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "container",
"description": "the container in which to execute the command. Defaults to only container if there is only one container in the pod.",
"required": false,
"allowMultiple": false
},
{
"type": "",
"paramType": "query",
"name": "command",
"description": "the command to execute; argv array; not executed within a shell",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -5780,6 +5876,30 @@
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "query",
"name": "container",
"description": "the container for which to stream logs; defaults to only container if there is one container in the pod",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "follow",
"description": "follow the log stream of the pod; defaults to false",
"required": false,
"allowMultiple": false
},
{
"type": "boolean",
"paramType": "query",
"name": "previous",
"description": "return previous terminated container logs; defaults to false",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -5889,6 +6009,14 @@
"summary": "connect GET requests to proxy of Pod",
"nickname": "connectGetNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -5919,6 +6047,14 @@
"summary": "connect POST requests to proxy of Pod",
"nickname": "connectPostNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -5949,6 +6085,14 @@
"summary": "connect PUT requests to proxy of Pod",
"nickname": "connectPutNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -5979,6 +6123,14 @@
"summary": "connect DELETE requests to proxy of Pod",
"nickname": "connectDeleteNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -6009,6 +6161,14 @@
"summary": "connect HEAD requests to proxy of Pod",
"nickname": "connectHeadNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -6039,6 +6199,14 @@
"summary": "connect OPTIONS requests to proxy of Pod",
"nickname": "connectOptionsNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -6075,6 +6243,14 @@
"summary": "connect GET requests to proxy of Pod",
"nickname": "connectGetNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -6113,6 +6289,14 @@
"summary": "connect POST requests to proxy of Pod",
"nickname": "connectPostNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -6151,6 +6335,14 @@
"summary": "connect PUT requests to proxy of Pod",
"nickname": "connectPutNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -6189,6 +6381,14 @@
"summary": "connect DELETE requests to proxy of Pod",
"nickname": "connectDeleteNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -6227,6 +6427,14 @@
"summary": "connect HEAD requests to proxy of Pod",
"nickname": "connectHeadNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down Expand Up @@ -6265,6 +6473,14 @@
"summary": "connect OPTIONS requests to proxy of Pod",
"nickname": "connectOptionsNamespacedPodProxy",
"parameters": [
{
"type": "string",
"paramType": "query",
"name": "path",
"description": "URL path to use in proxy request to pod",
"required": false,
"allowMultiple": false
},
{
"type": "string",
"paramType": "path",
Expand Down
29 changes: 18 additions & 11 deletions pkg/apiserver/api_installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,25 +204,31 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
}
versionedStatus := indirectArbitraryPointer(versionedStatusPtr)
var (
getOptions runtime.Object
getOptionsKind string
getSubpath bool
getSubpathKey string
getOptions runtime.Object
versionedGetOptions runtime.Object
getOptionsKind string
getSubpath bool
getSubpathKey string
)
if isGetterWithOptions {
getOptions, getSubpath, getSubpathKey = getterWithOptions.NewGetOptions()
_, getOptionsKind, err = a.group.Typer.ObjectVersionAndKind(getOptions)
if err != nil {
return err
}
versionedGetOptions, err = a.group.Creater.New(serverVersion, getOptionsKind)
if err != nil {
return err
}
isGetter = true
}

var (
connectOptions runtime.Object
connectOptionsKind string
connectSubpath bool
connectSubpathKey string
connectOptions runtime.Object
versionedConnectOptions runtime.Object
connectOptionsKind string
connectSubpath bool
connectSubpathKey string
)
if isConnecter {
connectOptions, connectSubpath, connectSubpathKey = connecter.NewConnectOptions()
Expand All @@ -231,6 +237,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
if err != nil {
return err
}
versionedConnectOptions, err = a.group.Creater.New(serverVersion, connectOptionsKind)
}
}

Expand Down Expand Up @@ -390,7 +397,7 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
Returns(http.StatusOK, "OK", versionedObject).
Writes(versionedObject)
if isGetterWithOptions {
if err := addObjectParams(ws, route, getOptions); err != nil {
if err := addObjectParams(ws, route, versionedGetOptions); err != nil {
return err
}
}
Expand Down Expand Up @@ -561,8 +568,8 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
Produces("*/*").
Consumes("*/*").
Writes("string")
if connectOptions != nil {
if err := addObjectParams(ws, route, connectOptions); err != nil {
if versionedConnectOptions != nil {
if err := addObjectParams(ws, route, versionedConnectOptions); err != nil {
return err
}
}
Expand Down
Loading

0 comments on commit 59611d7

Please sign in to comment.