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

API Updates

This commit is contained in:
Darren Shepherd
2017-12-04 16:42:18 -07:00
parent 6106f4926c
commit 68600ed35d
17 changed files with 629 additions and 590 deletions

View File

@@ -0,0 +1,43 @@
package schema
import (
"github.com/rancher/norman/types"
m "github.com/rancher/norman/types/mapper"
"github.com/rancher/types/factory"
"github.com/rancher/types/mapper"
"k8s.io/api/core/v1"
)
var (
Version = types.APIVersion{
Version: "v3",
Group: "cluster.cattle.io",
Path: "/v3/clusters",
}
Schemas = factory.Schemas(&Version).
Init(nodeTypes)
)
func nodeTypes(schemas *types.Schemas) *types.Schemas {
return schemas.
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.SliceToMap{Field: "volumesAttached", Key: "devicePath"},
).
AddMapperForType(&Version, v1.Node{},
&m.Embed{Field: "status"},
&m.Drop{Field: "conditions"},
).
MustImport(&Version, v1.NodeStatus{}, struct {
IPAddress string
Hostname string
Info NodeInfo
}{}).
MustImport(&Version, v1.Node{})
}

View File

@@ -0,0 +1,27 @@
package schema
type NodeInfo struct {
CPU CPUInfo
Memory MemoryInfo
OS OSInfo
Kubernetes KubernetesInfo
}
type CPUInfo struct {
Count int64
}
type MemoryInfo struct {
MemTotalKiB int64
}
type OSInfo struct {
DockerVersion string
KernelVersion string
OperatingSystem string
}
type KubernetesInfo struct {
KubeletVersion string
KubeProxyVersion string
}