-
Notifications
You must be signed in to change notification settings - Fork 121
/
json_structs.go
189 lines (181 loc) · 5.98 KB
/
json_structs.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
package peirates
import "time"
// MountInfo is used by mountRootfs
type MountInfo struct {
yamlBuild string
image string
namespace string
}
// KubeRoles are used for JSON parsing
type KubeRoles struct {
APIVersion string `json:"apiVersion"`
Items []struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Metadata struct {
Annotations struct {
KubectlKubernetesIoLastAppliedConfiguration string `json:"kubectl.kubernetes.io/last-applied-configuration"`
} `json:"annotations"`
CreationTimestamp time.Time `json:"creationTimestamp"`
Name string `json:"name"`
Namespace string `json:"namespace"`
ResourceVersion string `json:"resourceVersion"`
SelfLink string `json:"selfLink"`
UID string `json:"uid"`
} `json:"metadata"`
Rules []struct {
APIGroups []string `json:"apiGroups"`
Resources []string `json:"resources"`
Verbs []string `json:"verbs"`
} `json:"rules"`
} `json:"items"`
Kind string `json:"kind"`
Metadata struct {
ResourceVersion string `json:"resourceVersion"`
SelfLink string `json:"selfLink"`
} `json:"metadata"`
}
// PodDetails is populated by GetPodsInfo (JSON parsing from kubectl get pods)
type PodDetails struct {
APIVersion string `json:"apiVersion"`
Items []struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
Metadata struct {
Annotations struct {
KubectlKubernetesIoLastAppliedConfiguration string `json:"kubectl.kubernetes.io/last-applied-configuration"`
} `json:"annotations"`
CreationTimestamp time.Time `json:"creationTimestamp"`
Labels struct {
App string `json:"app"`
} `json:"labels"`
Name string `json:"name"`
Namespace string `json:"namespace"`
ResourceVersion string `json:"resourceVersion"`
SelfLink string `json:"selfLink"`
UID string `json:"uid"`
} `json:"metadata"`
Spec struct {
Containers []struct {
Image string `json:"image"`
ImagePullPolicy string `json:"imagePullPolicy"`
Name string `json:"name"`
Ports []struct {
ContainerPort int `json:"containerPort"`
Protocol string `json:"protocol"`
} `json:"ports"`
Resources struct {
} `json:"resources"`
TerminationMessagePath string `json:"terminationMessagePath"`
TerminationMessagePolicy string `json:"terminationMessagePolicy"`
VolumeMounts []struct {
MountPath string `json:"mountPath"`
Name string `json:"name"`
ReadOnly bool `json:"readOnly"`
} `json:"volumeMounts"`
} `json:"containers"`
DNSPolicy string `json:"dnsPolicy"`
NodeName string `json:"nodeName"`
NodeSelector struct {
KubernetesIoHostname string `json:"kubernetes.io/hostname"`
} `json:"nodeSelector"`
RestartPolicy string `json:"restartPolicy"`
SchedulerName string `json:"schedulerName"`
SecurityContext struct {
} `json:"securityContext"`
ServiceAccount string `json:"serviceAccount"`
ServiceAccountName string `json:"serviceAccountName"`
TerminationGracePeriodSeconds int `json:"terminationGracePeriodSeconds"`
Tolerations []struct {
Effect string `json:"effect"`
Key string `json:"key"`
Operator string `json:"operator"`
TolerationSeconds int `json:"tolerationSeconds"`
} `json:"tolerations"`
Volumes []struct {
HostPath struct {
Path string `json:"path"`
Type string `json:"type"`
} `json:"hostPath,omitempty"`
Name string `json:"name"`
Secret struct {
DefaultMode int `json:"defaultMode"`
SecretName string `json:"secretName"`
} `json:"secret,omitempty"`
} `json:"volumes"`
} `json:"spec"`
Status struct {
Conditions []struct {
LastProbeTime interface{} `json:"lastProbeTime"`
LastTransitionTime time.Time `json:"lastTransitionTime"`
Status string `json:"status"`
Type string `json:"type"`
} `json:"conditions"`
ContainerStatuses []struct {
ContainerID string `json:"containerID"`
Image string `json:"image"`
ImageID string `json:"imageID"`
LastState struct {
Terminated struct {
ContainerID string `json:"containerID"`
ExitCode int `json:"exitCode"`
FinishedAt time.Time `json:"finishedAt"`
Reason string `json:"reason"`
StartedAt time.Time `json:"startedAt"`
} `json:"terminated"`
} `json:"lastState"`
Name string `json:"name"`
Ready bool `json:"ready"`
RestartCount int `json:"restartCount"`
State struct {
Running *struct {
StartedAt time.Time `json:"startedAt"`
} `json:"running"`
} `json:"state"`
} `json:"containerStatuses"`
HostIP string `json:"hostIP"`
Phase string `json:"phase"`
PodIP string `json:"podIP"`
QosClass string `json:"qosClass"`
StartTime time.Time `json:"startTime"`
} `json:"status"`
} `json:"items"`
Kind string `json:"kind"`
Metadata struct {
ResourceVersion string `json:"resourceVersion"`
SelfLink string `json:"selfLink"`
} `json:"metadata"`
}
// SecretDetails unmarshalls secrets
type SecretDetails struct {
Data []struct {
Namespace string `json:"namespace"`
Token string `json:"token"`
}
Metadata struct {
Name string `json:"name"`
}
SecretType string `json:"type"`
}
// GetNodeDetails unmarshalls node data
type GetNodeDetails struct {
Items []struct {
Metadata struct {
Name string `json:"name"`
} `json:"metadata"`
Status struct {
Addresses []struct {
Address string `json:"address"`
Type string `json:"type"`
} `json:"addresses"`
} `json:"status"`
} `json:"items"`
}
type AWSS3BucketObject struct {
Data string `json:"Data"`
}
type PodNamespaceContainerTuple struct {
PodName string
PodNamespace string
ContainerName string
}