diff --git a/apis/management.cattle.io/v3/authz_types.go b/apis/management.cattle.io/v3/authz_types.go index 04ec3861..f89a3d86 100644 --- a/apis/management.cattle.io/v3/authz_types.go +++ b/apis/management.cattle.io/v3/authz_types.go @@ -1,6 +1,7 @@ package v3 import ( + "github.com/rancher/norman/types" extv1 "k8s.io/api/extensions/v1beta1" rbacv1 "k8s.io/api/rbac/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -56,6 +57,7 @@ type PodSecurityPolicyTemplate struct { } type ProjectRoleTemplateBinding struct { + types.Namespaced metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` @@ -66,6 +68,7 @@ type ProjectRoleTemplateBinding struct { } type ClusterRoleTemplateBinding struct { + types.Namespaced metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/management.cattle.io/v3/schema/schema.go b/apis/management.cattle.io/v3/schema/schema.go index 1abb7310..c4baf063 100644 --- a/apis/management.cattle.io/v3/schema/schema.go +++ b/apis/management.cattle.io/v3/schema/schema.go @@ -95,12 +95,14 @@ func authzTypes(schemas *types.Schemas) *types.Schemas { &m.Move{From: "subject/kind", To: "subjectKind"}, &m.Move{From: "subject/namespace", To: "subjectNamespace"}, &m.Drop{Field: "subject"}, + &mapper.NamespaceIDMapper{}, ). AddMapperForType(&Version, v3.ClusterRoleTemplateBinding{}, &m.Move{From: "subject/name", To: "subjectName"}, &m.Move{From: "subject/kind", To: "subjectKind"}, &m.Move{From: "subject/namespace", To: "subjectNamespace"}, &m.Drop{Field: "subject"}, + &mapper.NamespaceIDMapper{}, ). AddMapperForType(&Version, v3.GlobalRoleBinding{}, &m.Move{From: "subject/name", To: "subjectName"}, diff --git a/config/context.go b/config/context.go index 4dd31fce..4de9b406 100644 --- a/config/context.go +++ b/config/context.go @@ -51,12 +51,14 @@ type ManagementContext struct { Management managementv3.Interface RBAC rbacv1.Interface + Core corev1.Interface } func (c *ManagementContext) controllers() []controller.Starter { return []controller.Starter{ c.Management, c.RBAC, + c.Core, } } @@ -144,6 +146,11 @@ func NewManagementContext(config rest.Config) (*ManagementContext, error) { return nil, err } + context.Core, err = corev1.NewForConfig(config) + if err != nil { + return nil, err + } + dynamicConfig := config if dynamicConfig.NegotiatedSerializer == nil { configConfig := dynamic.ContentConfig()