mirror of
https://github.com/rancher/types.git
synced 2025-08-01 13:07:05 +00:00
Copy namespace to cluster schemas
This commit is contained in:
parent
8873bb7c6b
commit
a6b44f25da
@ -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{},
|
||||
|
Loading…
Reference in New Issue
Block a user