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
3038eec2
Commit
3038eec2
authored
Feb 10, 2016
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a different verb for delete collection
parent
c70c7fde
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
2 deletions
+12
-2
authorization.md
docs/admin/authorization.md
+2
-2
handlers.go
pkg/apiserver/handlers.go
+4
-0
handlers_test.go
pkg/apiserver/handlers_test.go
+6
-0
No files found.
docs/admin/authorization.md
View file @
3038eec2
...
@@ -65,8 +65,8 @@ A request has the following attributes that can be considered for authorization:
...
@@ -65,8 +65,8 @@ A request has the following attributes that can be considered for authorization:
-
the request path.
-
the request path.
-
allows authorizing access to miscellaneous endpoints like
`/api`
or
`/healthz`
(see
[
kubectl
](
#kubectl
)
).
-
allows authorizing access to miscellaneous endpoints like
`/api`
or
`/healthz`
(see
[
kubectl
](
#kubectl
)
).
-
the request verb.
-
the request verb.
-
API verbs like
`get`
,
`list`
,
`create`
,
`update`
,
and
`watch
`
are used for API requests
-
API verbs like
`get`
,
`list`
,
`create`
,
`update`
,
`watch`
,
`delete`
, and
`deletecollection
`
are used for API requests
-
HTTP verbs like
`get`
,
`post`
,
and
`put
`
are used for non-API requests
-
HTTP verbs like
`get`
,
`post`
,
`put`
, and
`delete
`
are used for non-API requests
-
what resource is being accessed (for API requests only)
-
what resource is being accessed (for API requests only)
-
the namespace of the object being accessed (for namespaced API requests only)
-
the namespace of the object being accessed (for namespaced API requests only)
-
the API group being accessed (for API requests only)
-
the API group being accessed (for API requests only)
...
...
pkg/apiserver/handlers.go
View file @
3038eec2
...
@@ -554,6 +554,10 @@ func (r *RequestInfoResolver) GetRequestInfo(req *http.Request) (RequestInfo, er
...
@@ -554,6 +554,10 @@ func (r *RequestInfoResolver) GetRequestInfo(req *http.Request) (RequestInfo, er
if
len
(
requestInfo
.
Name
)
==
0
&&
requestInfo
.
Verb
==
"get"
{
if
len
(
requestInfo
.
Name
)
==
0
&&
requestInfo
.
Verb
==
"get"
{
requestInfo
.
Verb
=
"list"
requestInfo
.
Verb
=
"list"
}
}
// if there's no name on the request and we thought it was a delete before, then the actual verb is deletecollection
if
len
(
requestInfo
.
Name
)
==
0
&&
requestInfo
.
Verb
==
"delete"
{
requestInfo
.
Verb
=
"deletecollection"
}
return
requestInfo
,
nil
return
requestInfo
,
nil
}
}
pkg/apiserver/handlers_test.go
View file @
3038eec2
...
@@ -364,6 +364,12 @@ func TestGetAPIRequestInfo(t *testing.T) {
...
@@ -364,6 +364,12 @@ func TestGetAPIRequestInfo(t *testing.T) {
{
"DELETE"
,
"/api/v1/namespaces/other/pods/foo"
,
"delete"
,
"api"
,
""
,
"v1"
,
"other"
,
"pods"
,
""
,
"foo"
,
[]
string
{
"pods"
,
"foo"
}},
{
"DELETE"
,
"/api/v1/namespaces/other/pods/foo"
,
"delete"
,
"api"
,
""
,
"v1"
,
"other"
,
"pods"
,
""
,
"foo"
,
[]
string
{
"pods"
,
"foo"
}},
{
"POST"
,
"/api/v1/namespaces/other/pods"
,
"create"
,
"api"
,
""
,
"v1"
,
"other"
,
"pods"
,
""
,
""
,
[]
string
{
"pods"
}},
{
"POST"
,
"/api/v1/namespaces/other/pods"
,
"create"
,
"api"
,
""
,
"v1"
,
"other"
,
"pods"
,
""
,
""
,
[]
string
{
"pods"
}},
// deletecollection verb identification
{
"DELETE"
,
"/api/v1/nodes"
,
"deletecollection"
,
"api"
,
""
,
"v1"
,
""
,
"nodes"
,
""
,
""
,
[]
string
{
"nodes"
}},
{
"DELETE"
,
"/api/v1/namespaces"
,
"deletecollection"
,
"api"
,
""
,
"v1"
,
""
,
"namespaces"
,
""
,
""
,
[]
string
{
"namespaces"
}},
{
"DELETE"
,
"/api/v1/namespaces/other/pods"
,
"deletecollection"
,
"api"
,
""
,
"v1"
,
"other"
,
"pods"
,
""
,
""
,
[]
string
{
"pods"
}},
{
"DELETE"
,
"/apis/extensions/v1/namespaces/other/pods"
,
"deletecollection"
,
"api"
,
"extensions"
,
"v1"
,
"other"
,
"pods"
,
""
,
""
,
[]
string
{
"pods"
}},
// api group identification
// api group identification
{
"POST"
,
"/apis/extensions/v1/namespaces/other/pods"
,
"create"
,
"api"
,
"extensions"
,
"v1"
,
"other"
,
"pods"
,
""
,
""
,
[]
string
{
"pods"
}},
{
"POST"
,
"/apis/extensions/v1/namespaces/other/pods"
,
"create"
,
"api"
,
"extensions"
,
"v1"
,
"other"
,
"pods"
,
""
,
""
,
[]
string
{
"pods"
}},
...
...
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