update vendor

added files required by BuildConfig reaper
This commit is contained in:
Tomas Kral
2017-05-16 17:56:38 +02:00
parent bee784faf6
commit 166eedfc1c
6 changed files with 484 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package util
import (
"path"
kapi "k8s.io/kubernetes/pkg/api"
kerrors "k8s.io/kubernetes/pkg/api/errors"
)
// NoNamespaceKeyFunc is the default function for constructing etcd paths to a resource relative to prefix enforcing
// If a namespace is on context, it errors.
func NoNamespaceKeyFunc(ctx kapi.Context, prefix string, name string) (string, error) {
ns, ok := kapi.NamespaceFrom(ctx)
if ok && len(ns) > 0 {
return "", kerrors.NewBadRequest("Namespace parameter is not allowed.")
}
if len(name) == 0 {
return "", kerrors.NewBadRequest("Name parameter required.")
}
return path.Join(prefix, name), nil
}