-
Notifications
You must be signed in to change notification settings - Fork 0
/
kubernetes-types.go
65 lines (53 loc) · 1.51 KB
/
kubernetes-types.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
package model
type (
ClusterList struct {
Items Clusters `json:"items"`
}
NodeResource struct {
Spec *NodeResourceSpec `json:"spec,omitempty"`
Status *NodeResourceStatus `json:"status,omitempty"`
}
NodeResourceSpec struct {
Unschedulable bool `json:"unschedulable,omitempty"`
}
NodeResourceStatus struct {
Conditions []NodeResourceCondition `json:"conditions,omitempty"`
}
NodeResourceCondition struct {
Status string `json:"status,omitempty"`
Type string `json:"type,omitempty"`
}
PodResourceList struct {
Items []PodResource `json:"items"`
}
PodResource struct {
Metadata *PodMetadata `json:"metadata,omitempty"`
}
PodMetadata struct {
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
OwnerReferences []*PodOwnerReference `json:"ownerReferences,omitempty"`
}
PodOwnerReference struct {
ApiVersion string `json:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty"`
Name string `json:"name,omitempty"`
}
PodEviction struct {
ApiVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Metadata PodEvictionMetadata `json:"metadata,omitempty"`
}
PodEvictionMetadata struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
}
)
func (n NodeResource) IsReady() bool {
for _, condition := range n.Status.Conditions {
if condition.Type == "Ready" && condition.Status == "True" {
return true
}
}
return false
}