-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpod.go
94 lines (89 loc) · 3.01 KB
/
pod.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
82
83
84
85
86
87
88
89
90
91
92
93
94
// TODO : need to change to api package
package thoth
import (
"time"
)
// pod metrics
type Pod struct {
Name string `json:"name"`
Image string `json:"image"`
Port int `json:"port"`
Ip string `json:"ip"`
Cpu uint64 `json:"cpu"`
Memory uint64 `json:"memory"`
DiskUsage uint64 `json:"disk_usage"`
Bandwidth uint64 `json:"bandwidth"`
}
// array of pods type
type Pods []Pod
type PodList struct {
Kind string `json:"kind"`
APIVersion string `json:"apiVersion"`
Metadata struct {
SelfLink string `json:"selfLink"`
ResourceVersion string `json:"resourceVersion"`
} `json:"metadata"`
Items []PodItem `json:"items"`
}
type PodItem struct {
Metadata struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
SelfLink string `json:"selfLink"`
UID string `json:"uid"`
ResourceVersion string `json:"resourceVersion"`
CreationTimestamp time.Time `json:"creationTimestamp"`
Labels struct {
App string `json:"app"`
} `json:"labels"`
Annotations struct {
KubernetesIoConfigHash string `json:"kubernetes.io/config.hash"`
KubernetesIoConfigMirror string `json:"kubernetes.io/config.mirror"`
KubernetesIoConfigSeen time.Time `json:"kubernetes.io/config.seen"`
KubernetesIoConfigSource string `json:"kubernetes.io/config.source"`
} `json:"annotations"`
} `json:"metadata"`
Spec struct {
Containers []struct {
Name string `json:"name"`
Image string `json:"image"`
Command []string `json:"command"`
Resources struct {
} `json:"resources"`
TerminationMessagePath string `json:"terminationMessagePath"`
ImagePullPolicy string `json:"imagePullPolicy"`
} `json:"containers"`
RestartPolicy string `json:"restartPolicy"`
TerminationGracePeriodSeconds int `json:"terminationGracePeriodSeconds"`
DNSPolicy string `json:"dnsPolicy"`
NodeName string `json:"nodeName"`
HostNetwork bool `json:"hostNetwork"`
} `json:"spec"`
Status struct {
Phase string `json:"phase"`
Conditions []struct {
Type string `json:"type"`
Status string `json:"status"`
LastProbeTime interface{} `json:"lastProbeTime"`
LastTransitionTime interface{} `json:"lastTransitionTime"`
} `json:"conditions"`
HostIP string `json:"hostIP"`
PodIP string `json:"podIP"`
StartTime time.Time `json:"startTime"`
ContainerStatuses []struct {
Name string `json:"name"`
State struct {
Running struct {
StartedAt time.Time `json:"startedAt"`
} `json:"running"`
} `json:"state"`
LastState struct {
} `json:"lastState"`
Ready bool `json:"ready"`
RestartCount int `json:"restartCount"`
Image string `json:"image"`
ImageID string `json:"imageID"`
ContainerID string `json:"containerID"`
} `json:"containerStatuses"`
} `json:"status"`
}