1
0
mirror of https://github.com/rancher/types.git synced 2025-09-03 22:24:38 +00:00

Move github.com/rancher/rancher/pkg/namespace to types

The namespace package contains constants that need to be used
globally so moving to types to other go modules can depend on it.
This commit is contained in:
Darren Shepherd
2020-05-28 14:02:47 -07:00
parent 0db99d3f04
commit 2ca5754481
2 changed files with 136 additions and 0 deletions

18
namespace/namespace.go Normal file
View File

@@ -0,0 +1,18 @@
package namespace
import v1 "k8s.io/api/core/v1"
var projectIDAnnotation = "field.cattle.io/projectId"
func NsByProjectID(obj interface{}) ([]string, error) {
ns, ok := obj.(*v1.Namespace)
if !ok {
return []string{}, nil
}
if id, ok := ns.Annotations[projectIDAnnotation]; ok {
return []string{id}, nil
}
return []string{}, nil
}