-
Notifications
You must be signed in to change notification settings - Fork 43
/
node.go
81 lines (66 loc) · 2.55 KB
/
node.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package models
import (
"reflect"
specV1 "github.com/baetyl/baetyl-go/v2/spec/v1"
)
// NodeViewList node view list
type NodeViewList struct {
Total int `json:"total"`
ListOptions *ListOptions `json:"listOptions"`
Items []specV1.NodeView `json:"items"`
}
// NodeList node list
type NodeList struct {
Total int `json:"total"`
ListOptions *ListOptions `json:"listOptions"`
Items []specV1.Node `json:"items"`
}
type ListOptions struct {
LabelSelector string `json:"selector,omitempty"`
FieldSelector string `json:"fieldSelector,omitempty"`
Limit int64 `json:"limit,omitempty"`
Continue string `json:"continue,omitempty"`
}
type NodeNames struct {
Names []string `json:"names,"validate:"maxLength=20"`
}
type NodeProperties struct {
State NodePropertiesState `yaml:"state,omitempty" json:"state,omitempty"`
Meta NodePropertiesMetadata `yaml:"metadata,omitempty" json:"metadata,omitempty"`
}
type NodePropertiesState struct {
Report map[string]interface{} `yaml:"report,omitempty" json:"report,omitempty"`
Desire map[string]interface{} `yaml:"desire,omitempty" json:"desire,omitempty"`
}
type NodeProperty struct {
Name string `yaml:"name,omitempty" json:"name,omitempty"`
Type string `yaml:"type,omitempty" json:"type,omitempty"`
Current PropertyValue `yaml:"current,omitempty" json:"current,omitempty"`
Expect PropertyValue `yaml:"expect,omitempty" json:"expect,omitempty"`
}
type PropertyValue struct {
Value string `yaml:"value,omitempty" json:"value,omitempty"`
UpdateTime string `yaml:"updateTime,omitempty" json:"updateTime,omitempty"`
}
type NodeMode struct {
Mode string `yaml:"mode,omitempty" json:"mode,omitempty"`
}
type NodePropertiesMetadata struct {
ReportMeta map[string]interface{} `yaml:"report,omitempty" json:"report,omitempty"`
DesireMeta map[string]interface{} `yaml:"desire,omitempty" json:"desire,omitempty"`
}
func EqualNode(node1, node2 *specV1.Node) bool {
return reflect.DeepEqual(node1.Labels, node2.Labels) &&
reflect.DeepEqual(node1.Description, node2.Description) &&
reflect.DeepEqual(node1.Annotations, node2.Annotations) &&
reflect.DeepEqual(node1.Attributes, node2.Attributes)
}
type NodeCoreConfigs struct {
Version string `yaml:"version,omitempty" json:"version,omitempty"`
// unit: seconds
Frequency int `yaml:"frequency,omitempty" json:"frequency,omitempty"`
APIPort int `yaml:"apiport,omitempty" json:"apiport,omitempty"`
}
type NodeCoreVersions struct {
Versions []string `yaml:"versions,omitempty" json:"versions,omitempty"`
}