mirror of
https://github.com/rancher/types.git
synced 2025-08-31 21:00:16 +00:00
API Updates
This commit is contained in:
43
apis/cluster.cattle.io/v3/schema/schema.go
Normal file
43
apis/cluster.cattle.io/v3/schema/schema.go
Normal 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{})
|
||||
}
|
27
apis/cluster.cattle.io/v3/schema/types.go
Normal file
27
apis/cluster.cattle.io/v3/schema/types.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user