-
Notifications
You must be signed in to change notification settings - Fork 2
/
types.go
63 lines (53 loc) · 1.37 KB
/
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
package state
import (
"context"
"time"
)
type PodsStats struct {
ContainerStatuses []ContainerStatusStats `json:"containerStatuses"`
Phases []PodPhaseStats `json:"phases"`
TrafficTypes []TrafficTypeStats `json:"trafficTypes"`
}
type PodPhaseStats struct {
Value string `json:"value"`
Text string `json:"text"`
Count int `json:"count"`
}
type TrafficTypeStats struct {
Value string `json:"value"`
Text string `json:"text"`
Count int `json:"count"`
}
type ContainerStatusStats struct {
Value string `json:"value"`
Text string `json:"text"`
Count int `json:"count"`
}
type TrafficType string
const (
TrafficTypeInternet TrafficType = "internet"
TrafficTypePrivate TrafficType = "private"
TrafficTypeControlPlane TrafficType = "control_plane"
TrafficTypeCrossZone TrafficType = "cross_zone"
TrafficTypeWorkload TrafficType = "workload"
TrafficTypeService TrafficType = "service"
)
type FlowsFilter struct {
Namespaces []string `json:"namespaces"`
IDs []string `json:"ids"`
// If set to true filtering by IDs will try to filter by WorkloadKey or ID.
TryWorkloadIDs bool `json:"-"`
}
type Namespace struct {
Name string `json:"name"`
}
func sleep(ctx context.Context, d time.Duration) {
timeout := time.NewTimer(d)
defer timeout.Stop()
select {
case <-ctx.Done():
return
case <-timeout.C:
return
}
}