1
0
mirror of https://github.com/rancher/types.git synced 2025-08-31 21:00:16 +00:00

Address issues in node types

This commit is contained in:
Darren Shepherd
2017-12-29 15:19:10 -07:00
parent 5773f84304
commit f4e5f9a114
3 changed files with 53 additions and 60 deletions

View File

@@ -27,28 +27,42 @@ func namespaceTypes(schemas *types.Schemas) *types.Schemas {
}
func nodeTypes(schemas *types.Schemas) *types.Schemas {
return NodeTypes(&Version, schemas)
}
func NodeTypes(version *types.APIVersion, schemas *types.Schemas) *types.Schemas {
return schemas.
AddMapperForType(&Version, v1.NodeStatus{},
AddMapperForType(version, v1.NodeStatus{},
&mapper.NodeAddressMapper{},
&mapper.OSInfo{},
&m.Drop{Field: "addresses"},
&m.Drop{Field: "daemonEndpoints"},
&m.Drop{Field: "images"},
&m.Drop{Field: "nodeInfo"},
&m.Drop{Field: "conditions"},
&m.Drop{Field: "phase"},
&m.SliceToMap{Field: "volumesAttached", Key: "devicePath"},
).
AddMapperForType(&Version, v1.NodeSpec{},
&m.Move{From: "externalID", To: "externalId"}).
AddMapperForType(&Version, v1.Node{},
AddMapperForType(version, v1.NodeSpec{},
&m.Drop{Field: "externalID"},
&m.Drop{Field: "configSource"},
&m.Move{From: "providerID", To: "providerId"},
&m.Move{From: "podCIDR", To: "podCidr"},
m.Access{Fields: map[string]string{
"podCidr": "r",
"providerId": "r",
"taints": "ru",
"unschedulable": "ru",
}}).
AddMapperForType(version, v1.Node{},
&m.Embed{Field: "status"},
&m.Drop{Field: "conditions"},
).
MustImport(&Version, v1.NodeStatus{}, struct {
MustImport(version, v1.NodeStatus{}, struct {
IPAddress string
Hostname string
Info NodeInfo
}{}).
MustImport(&Version, v1.Node{})
MustImport(version, v1.Node{})
}
func volumeTypes(schemas *types.Schemas) *types.Schemas {