mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-06 19:52:42 +00:00
Always set ?namespace in query if specified
Revise our code to only call Request.Namespace() if a namespace *should* be present. For root scoped resources, namespace should be ignored. For namespaced resources, it is an error to have Namespace=="".
This commit is contained in:
@@ -277,7 +277,13 @@ func TestBind(t *testing.T) {
|
||||
table := []struct {
|
||||
binding *api.Binding
|
||||
}{
|
||||
{binding: &api.Binding{PodID: "foo", Host: "foohost.kubernetes.mydomain.com"}},
|
||||
{binding: &api.Binding{
|
||||
ObjectMeta: api.ObjectMeta{
|
||||
Namespace: api.NamespaceDefault,
|
||||
},
|
||||
PodID: "foo",
|
||||
Host: "foohost.kubernetes.mydomain.com",
|
||||
}},
|
||||
}
|
||||
|
||||
for _, item := range table {
|
||||
@@ -296,7 +302,7 @@ func TestBind(t *testing.T) {
|
||||
continue
|
||||
}
|
||||
expectedBody := runtime.EncodeOrDie(testapi.Codec(), item.binding)
|
||||
handler.ValidateRequest(t, "/api/"+testapi.Version()+"/bindings", "POST", &expectedBody)
|
||||
handler.ValidateRequest(t, "/api/"+testapi.Version()+"/bindings?namespace=default", "POST", &expectedBody)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user