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
1c4e9300
Commit
1c4e9300
authored
Oct 17, 2014
by
Eric Tune
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1867 from derekwaynecarr/pod_cache_kubelet_update
Fixup kubelet handlePodInfo to be namespace aware
parents
67fec225
d590af2c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
5 deletions
+10
-5
config_test.go
pkg/kubelet/config/config_test.go
+1
-1
server.go
pkg/kubelet/server.go
+8
-3
server_test.go
pkg/kubelet/server_test.go
+1
-1
No files found.
pkg/kubelet/config/config_test.go
View file @
1c4e9300
...
@@ -42,7 +42,7 @@ func (s sortedPods) Swap(i, j int) {
...
@@ -42,7 +42,7 @@ func (s sortedPods) Swap(i, j int) {
s
[
i
],
s
[
j
]
=
s
[
j
],
s
[
i
]
s
[
i
],
s
[
j
]
=
s
[
j
],
s
[
i
]
}
}
func
(
s
sortedPods
)
Less
(
i
,
j
int
)
bool
{
func
(
s
sortedPods
)
Less
(
i
,
j
int
)
bool
{
return
s
[
i
]
.
ID
<
s
[
j
]
.
ID
return
s
[
i
]
.
ID
<
s
[
j
]
.
ID
&&
s
[
i
]
.
Namespace
<
s
[
j
]
.
Namespace
}
}
func
CreateValidPod
(
name
,
namespace
,
source
string
)
api
.
BoundPod
{
func
CreateValidPod
(
name
,
namespace
,
source
string
)
api
.
BoundPod
{
...
...
pkg/kubelet/server.go
View file @
1c4e9300
...
@@ -228,17 +228,22 @@ func (s *Server) handlePodInfo(w http.ResponseWriter, req *http.Request) {
...
@@ -228,17 +228,22 @@ func (s *Server) handlePodInfo(w http.ResponseWriter, req *http.Request) {
}
}
podID
:=
u
.
Query
()
.
Get
(
"podID"
)
podID
:=
u
.
Query
()
.
Get
(
"podID"
)
podUUID
:=
u
.
Query
()
.
Get
(
"UUID"
)
podUUID
:=
u
.
Query
()
.
Get
(
"UUID"
)
podNamespace
:=
u
.
Query
()
.
Get
(
"podNamespace"
)
if
len
(
podID
)
==
0
{
if
len
(
podID
)
==
0
{
w
.
WriteHeader
(
http
.
StatusBadRequest
)
w
.
WriteHeader
(
http
.
StatusBadRequest
)
http
.
Error
(
w
,
"Missing 'podID=' query entry."
,
http
.
StatusBadRequest
)
http
.
Error
(
w
,
"Missing 'podID=' query entry."
,
http
.
StatusBadRequest
)
return
return
}
}
if
len
(
podNamespace
)
==
0
{
w
.
WriteHeader
(
http
.
StatusBadRequest
)
http
.
Error
(
w
,
"Missing 'podNamespace=' query entry."
,
http
.
StatusBadRequest
)
return
}
// TODO: backwards compatibility with existing API, needs API change
// TODO: backwards compatibility with existing API, needs API change
podFullName
:=
GetPodFullName
(
&
api
.
BoundPod
{
podFullName
:=
GetPodFullName
(
&
api
.
BoundPod
{
TypeMeta
:
api
.
TypeMeta
{
TypeMeta
:
api
.
TypeMeta
{
ID
:
podID
,
ID
:
podID
,
// TODO: I am broken
Namespace
:
podNamespace
,
Namespace
:
api
.
NamespaceDefault
,
Annotations
:
map
[
string
]
string
{
ConfigSourceAnnotationKey
:
"etcd"
},
Annotations
:
map
[
string
]
string
{
ConfigSourceAnnotationKey
:
"etcd"
},
},
},
})
})
...
...
pkg/kubelet/server_test.go
View file @
1c4e9300
...
@@ -263,7 +263,7 @@ func TestPodInfo(t *testing.T) {
...
@@ -263,7 +263,7 @@ func TestPodInfo(t *testing.T) {
}
}
return
nil
,
fmt
.
Errorf
(
"bad pod %s"
,
name
)
return
nil
,
fmt
.
Errorf
(
"bad pod %s"
,
name
)
}
}
resp
,
err
:=
http
.
Get
(
fw
.
testHTTPServer
.
URL
+
"/podInfo?podID=goodpod"
)
resp
,
err
:=
http
.
Get
(
fw
.
testHTTPServer
.
URL
+
"/podInfo?podID=goodpod
&podNamespace=default
"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Errorf
(
"Got error GETing: %v"
,
err
)
t
.
Errorf
(
"Got error GETing: %v"
,
err
)
}
}
...
...
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