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
e0d48d49
Commit
e0d48d49
authored
Jun 29, 2015
by
nikhiljindal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support both GET and POST methods for /exec and /portforward
parent
5bd928fe
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
2 deletions
+133
-2
v1.json
api/swagger-spec/v1.json
+60
-0
v1beta3.json
api/swagger-spec/v1beta3.json
+60
-0
etcd.go
pkg/registry/pod/etcd/etcd.go
+2
-1
rest.go
pkg/registry/pod/rest.go
+1
-1
auth_test.go
test/integration/auth_test.go
+10
-0
No files found.
api/swagger-spec/v1.json
View file @
e0d48d49
...
...
@@ -5957,6 +5957,36 @@
"consumes"
:
[
"*/*"
]
},
{
"type"
:
"string"
,
"method"
:
"POST"
,
"summary"
:
"connect POST requests to exec of Pod"
,
"nickname"
:
"connectPostPodExec"
,
"parameters"
:
[
{
"type"
:
"string"
,
"paramType"
:
"path"
,
"name"
:
"namespace"
,
"description"
:
"object name and auth scope, such as for teams and projects"
,
"required"
:
true
,
"allowMultiple"
:
false
},
{
"type"
:
"string"
,
"paramType"
:
"path"
,
"name"
:
"name"
,
"description"
:
"name of the Pod"
,
"required"
:
true
,
"allowMultiple"
:
false
}
],
"produces"
:
[
"*/*"
],
"consumes"
:
[
"*/*"
]
}
]
},
...
...
@@ -6044,6 +6074,36 @@
"consumes"
:
[
"*/*"
]
},
{
"type"
:
"string"
,
"method"
:
"POST"
,
"summary"
:
"connect POST requests to portforward of Pod"
,
"nickname"
:
"connectPostPodPortforward"
,
"parameters"
:
[
{
"type"
:
"string"
,
"paramType"
:
"path"
,
"name"
:
"namespace"
,
"description"
:
"object name and auth scope, such as for teams and projects"
,
"required"
:
true
,
"allowMultiple"
:
false
},
{
"type"
:
"string"
,
"paramType"
:
"path"
,
"name"
:
"name"
,
"description"
:
"name of the Pod"
,
"required"
:
true
,
"allowMultiple"
:
false
}
],
"produces"
:
[
"*/*"
],
"consumes"
:
[
"*/*"
]
}
]
},
...
...
api/swagger-spec/v1beta3.json
View file @
e0d48d49
...
...
@@ -5957,6 +5957,36 @@
"consumes"
:
[
"*/*"
]
},
{
"type"
:
"string"
,
"method"
:
"POST"
,
"summary"
:
"connect POST requests to exec of Pod"
,
"nickname"
:
"connectPostPodExec"
,
"parameters"
:
[
{
"type"
:
"string"
,
"paramType"
:
"path"
,
"name"
:
"namespace"
,
"description"
:
"object name and auth scope, such as for teams and projects"
,
"required"
:
true
,
"allowMultiple"
:
false
},
{
"type"
:
"string"
,
"paramType"
:
"path"
,
"name"
:
"name"
,
"description"
:
"name of the Pod"
,
"required"
:
true
,
"allowMultiple"
:
false
}
],
"produces"
:
[
"*/*"
],
"consumes"
:
[
"*/*"
]
}
]
},
...
...
@@ -6044,6 +6074,36 @@
"consumes"
:
[
"*/*"
]
},
{
"type"
:
"string"
,
"method"
:
"POST"
,
"summary"
:
"connect POST requests to portforward of Pod"
,
"nickname"
:
"connectPostPodPortforward"
,
"parameters"
:
[
{
"type"
:
"string"
,
"paramType"
:
"path"
,
"name"
:
"namespace"
,
"description"
:
"object name and auth scope, such as for teams and projects"
,
"required"
:
true
,
"allowMultiple"
:
false
},
{
"type"
:
"string"
,
"paramType"
:
"path"
,
"name"
:
"name"
,
"description"
:
"name of the Pod"
,
"required"
:
true
,
"allowMultiple"
:
false
}
],
"produces"
:
[
"*/*"
],
"consumes"
:
[
"*/*"
]
}
]
},
...
...
pkg/registry/pod/etcd/etcd.go
View file @
e0d48d49
...
...
@@ -283,7 +283,8 @@ func (r *ProxyREST) Connect(ctx api.Context, id string, opts runtime.Object) (re
return
genericrest
.
NewUpgradeAwareProxyHandler
(
location
,
nil
,
false
),
nil
}
var
upgradeableMethods
=
[]
string
{
"GET"
}
// Support both GET and POST methods. Over time, we want to move all clients to start using POST and then stop supporting GET.
var
upgradeableMethods
=
[]
string
{
"GET"
,
"POST"
}
// ExecREST implements the exec subresource for a Pod
type
ExecREST
struct
{
...
...
pkg/registry/pod/rest.go
View file @
e0d48d49
...
...
@@ -249,7 +249,7 @@ func ExecLocation(getter ResourceGetter, connInfo client.ConnectionInfoGetter, c
nodeHost
:=
pod
.
Spec
.
NodeName
if
len
(
nodeHost
)
==
0
{
// If pod has not been assigned a host, return an empty location
return
nil
,
nil
,
fmt
.
Errorf
(
"pod %s does not have a host assigned"
,
name
)
return
nil
,
nil
,
errors
.
NewBadRequest
(
fmt
.
Sprintf
(
"pod %s does not have a host assigned"
,
name
)
)
}
nodeScheme
,
nodePort
,
nodeTransport
,
err
:=
connInfo
.
GetConnectionInfo
(
nodeHost
)
if
err
!=
nil
{
...
...
test/integration/auth_test.go
View file @
e0d48d49
...
...
@@ -275,6 +275,16 @@ func getTestRequests() []struct {
{
"POST"
,
timeoutPath
(
"pods"
,
api
.
NamespaceDefault
,
""
),
aPod
,
code201
},
{
"PUT"
,
timeoutPath
(
"pods"
,
api
.
NamespaceDefault
,
"a"
),
aPod
,
code200
},
{
"GET"
,
path
(
"pods"
,
api
.
NamespaceDefault
,
"a"
),
""
,
code200
},
// GET and POST for /exec should return Bad Request (400) since the pod has not been assigned a node yet.
{
"GET"
,
path
(
"pods"
,
api
.
NamespaceDefault
,
"a"
)
+
"/exec"
,
""
,
code400
},
{
"POST"
,
path
(
"pods"
,
api
.
NamespaceDefault
,
"a"
)
+
"/exec"
,
""
,
code400
},
// PUT for /exec should return Method Not Allowed (405).
{
"PUT"
,
path
(
"pods"
,
api
.
NamespaceDefault
,
"a"
)
+
"/exec"
,
""
,
code405
},
// GET and POST for /portforward should return Bad Request (400) since the pod has not been assigned a node yet.
{
"GET"
,
path
(
"pods"
,
api
.
NamespaceDefault
,
"a"
)
+
"/portforward"
,
""
,
code400
},
{
"POST"
,
path
(
"pods"
,
api
.
NamespaceDefault
,
"a"
)
+
"/portforward"
,
""
,
code400
},
// PUT for /portforward should return Method Not Allowed (405).
{
"PUT"
,
path
(
"pods"
,
api
.
NamespaceDefault
,
"a"
)
+
"/portforward"
,
""
,
code405
},
{
"PATCH"
,
path
(
"pods"
,
api
.
NamespaceDefault
,
"a"
),
"{%v}"
,
code200
},
{
"DELETE"
,
timeoutPath
(
"pods"
,
api
.
NamespaceDefault
,
"a"
),
deleteNow
,
code200
},
...
...
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