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