diff --git a/apis/cluster.cattle.io/v3/schema/schema.go b/apis/cluster.cattle.io/v3/schema/schema.go index 3646f5dd..8ffba07e 100644 --- a/apis/cluster.cattle.io/v3/schema/schema.go +++ b/apis/cluster.cattle.io/v3/schema/schema.go @@ -3,6 +3,7 @@ package schema import ( "github.com/rancher/norman/types" m "github.com/rancher/norman/types/mapper" + "github.com/rancher/types/apis/project.cattle.io/v3/schema" "github.com/rancher/types/factory" "github.com/rancher/types/mapper" "k8s.io/api/core/v1" @@ -16,9 +17,23 @@ var ( } Schemas = factory.Schemas(&Version). - Init(nodeTypes) + Init(nodeTypes). + Init(copyNamespace) ) +func copyNamespace(schemas *types.Schemas) *types.Schemas { + cloneProjectSchema("namespaceStatus", schemas) + cloneProjectSchema("namespace", schemas) + return schemas +} + +func cloneProjectSchema(name string, schemas *types.Schemas) { + schema := schema.Schemas.Schema(&schema.Version, name) + copy := *schema + copy.Version = Version + schemas.AddSchema(©) +} + func nodeTypes(schemas *types.Schemas) *types.Schemas { return schemas. AddMapperForType(&Version, v1.NodeStatus{},