mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-09 13:12:20 +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:
8
pkg/client/cache/listwatch_test.go
vendored
8
pkg/client/cache/listwatch_test.go
vendored
@@ -42,7 +42,7 @@ func buildResourcePath(prefix, namespace, resource string) string {
|
||||
base := path.Join("/api", testapi.Version(), prefix)
|
||||
if len(namespace) > 0 {
|
||||
if !(testapi.Version() == "v1beta1" || testapi.Version() == "v1beta2") {
|
||||
base = path.Join(base, "ns", namespace)
|
||||
base = path.Join(base, "namespaces", namespace)
|
||||
}
|
||||
}
|
||||
return path.Join(base, resource)
|
||||
@@ -58,10 +58,8 @@ func buildQueryValues(namespace string, query url.Values) url.Values {
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(namespace) > 0 {
|
||||
if testapi.Version() == "v1beta1" || testapi.Version() == "v1beta2" {
|
||||
v.Set("namespace", namespace)
|
||||
}
|
||||
if testapi.Version() == "v1beta1" || testapi.Version() == "v1beta2" {
|
||||
v.Set("namespace", namespace)
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
Reference in New Issue
Block a user