mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #1867 from derekwaynecarr/pod_cache_kubelet_update
Fixup kubelet handlePodInfo to be namespace aware
This commit is contained in:
commit
1c4e9300f2
@ -42,7 +42,7 @@ func (s sortedPods) Swap(i, j int) {
|
||||
s[i], s[j] = s[j], s[i]
|
||||
}
|
||||
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 {
|
||||
|
@ -228,17 +228,22 @@ func (s *Server) handlePodInfo(w http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
podID := u.Query().Get("podID")
|
||||
podUUID := u.Query().Get("UUID")
|
||||
podNamespace := u.Query().Get("podNamespace")
|
||||
if len(podID) == 0 {
|
||||
w.WriteHeader(http.StatusBadRequest)
|
||||
http.Error(w, "Missing 'podID=' query entry.", http.StatusBadRequest)
|
||||
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
|
||||
podFullName := GetPodFullName(&api.BoundPod{
|
||||
TypeMeta: api.TypeMeta{
|
||||
ID: podID,
|
||||
// TODO: I am broken
|
||||
Namespace: api.NamespaceDefault,
|
||||
ID: podID,
|
||||
Namespace: podNamespace,
|
||||
Annotations: map[string]string{ConfigSourceAnnotationKey: "etcd"},
|
||||
},
|
||||
})
|
||||
|
@ -263,7 +263,7 @@ func TestPodInfo(t *testing.T) {
|
||||
}
|
||||
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 {
|
||||
t.Errorf("Got error GETing: %v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user