mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
If an object has no namespace, do not add a leading slash
This commit is contained in:
parent
cdb93a7c46
commit
192e186119
3
pkg/client/cache/store.go
vendored
3
pkg/client/cache/store.go
vendored
@ -57,7 +57,10 @@ func MetaNamespaceKeyFunc(obj interface{}) (string, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("object has no meta: %v", err)
|
return "", fmt.Errorf("object has no meta: %v", err)
|
||||||
}
|
}
|
||||||
|
if len(meta.Namespace()) > 0 {
|
||||||
return meta.Namespace() + "/" + meta.Name(), nil
|
return meta.Namespace() + "/" + meta.Name(), nil
|
||||||
|
}
|
||||||
|
return meta.Name(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type cache struct {
|
type cache struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user