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
7b34d6ef
Commit
7b34d6ef
authored
Feb 11, 2015
by
derekwaynecarr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The namespace context for a get of an individual namespace is the namespace
parent
15c57efd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
handlers.go
pkg/apiserver/handlers.go
+3
-1
handlers_test.go
pkg/apiserver/handlers_test.go
+1
-1
No files found.
pkg/apiserver/handlers.go
View file @
7b34d6ef
...
@@ -292,8 +292,10 @@ func (r *APIRequestInfoResolver) GetAPIRequestInfo(req *http.Request) (APIReques
...
@@ -292,8 +292,10 @@ func (r *APIRequestInfoResolver) GetAPIRequestInfo(req *http.Request) (APIReques
// URL forms: /namespaces/{namespace}/{kind}/*, where parts are adjusted to be relative to kind
// URL forms: /namespaces/{namespace}/{kind}/*, where parts are adjusted to be relative to kind
if
currentParts
[
0
]
==
"namespaces"
{
if
currentParts
[
0
]
==
"namespaces"
{
if
len
(
currentParts
)
<
3
{
if
len
(
currentParts
)
<
3
{
requestInfo
.
Namespace
=
""
requestInfo
.
Resource
=
"namespaces"
requestInfo
.
Resource
=
"namespaces"
if
len
(
currentParts
)
>
1
{
requestInfo
.
Namespace
=
currentParts
[
1
]
}
}
else
{
}
else
{
requestInfo
.
Resource
=
currentParts
[
2
]
requestInfo
.
Resource
=
currentParts
[
2
]
requestInfo
.
Namespace
=
currentParts
[
1
]
requestInfo
.
Namespace
=
currentParts
[
1
]
...
...
pkg/apiserver/handlers_test.go
View file @
7b34d6ef
...
@@ -80,7 +80,7 @@ func TestGetAPIRequestInfo(t *testing.T) {
...
@@ -80,7 +80,7 @@ func TestGetAPIRequestInfo(t *testing.T) {
// resource paths
// resource paths
{
"GET"
,
"/namespaces"
,
"list"
,
""
,
""
,
"namespaces"
,
"Namespace"
,
""
,
[]
string
{
"namespaces"
}},
{
"GET"
,
"/namespaces"
,
"list"
,
""
,
""
,
"namespaces"
,
"Namespace"
,
""
,
[]
string
{
"namespaces"
}},
{
"GET"
,
"/namespaces/other"
,
"get"
,
""
,
""
,
"namespaces"
,
"Namespace"
,
"other"
,
[]
string
{
"namespaces"
,
"other"
}},
{
"GET"
,
"/namespaces/other"
,
"get"
,
""
,
"
other
"
,
"namespaces"
,
"Namespace"
,
"other"
,
[]
string
{
"namespaces"
,
"other"
}},
{
"GET"
,
"/namespaces/other/pods"
,
"list"
,
""
,
"other"
,
"pods"
,
"Pod"
,
""
,
[]
string
{
"pods"
}},
{
"GET"
,
"/namespaces/other/pods"
,
"list"
,
""
,
"other"
,
"pods"
,
"Pod"
,
""
,
[]
string
{
"pods"
}},
{
"GET"
,
"/namespaces/other/pods/foo"
,
"get"
,
""
,
"other"
,
"pods"
,
"Pod"
,
"foo"
,
[]
string
{
"pods"
,
"foo"
}},
{
"GET"
,
"/namespaces/other/pods/foo"
,
"get"
,
""
,
"other"
,
"pods"
,
"Pod"
,
"foo"
,
[]
string
{
"pods"
,
"foo"
}},
...
...
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