-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.go
More file actions
72 lines (59 loc) · 1.86 KB
/
types.go
File metadata and controls
72 lines (59 loc) · 1.86 KB
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
package main
import "time"
type ContainerState string
const (
Requested ContainerState = "requested"
Pulling ContainerState = "pulling"
Created ContainerState = "created"
Starting ContainerState = "starting"
Running ContainerState = "running"
Stopping ContainerState = "stopping"
Stopped ContainerState = "stopped"
Failed ContainerState = "failed"
Destroyed ContainerState = "destroyed"
)
type Container struct {
ID string `json:"id"`
Image string `json:"image"`
State ContainerState `json:"state"`
DesiredState ContainerState `json:"desired_state"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ContainerID string `json:"container_id"`
IPAddress string `json:"ip_address"`
Env map[string]string `json:"env"`
Ports []PortMapping `json:"ports"`
RestartCount int `json:"restart_count"`
NodeID string `json:"node_id"`
Scheduled bool `json:"scheduled"`
}
type PortMapping struct {
HostPort int `json:"host_port"`
ContainerPort int `json:"container_port"`
Protocol string `json:"protocol"`
}
type Node struct {
ID string `json:"id"`
Address string `json:"address"`
Role NodeRole `json:"role"`
State NodeState `json:"state"`
CreatedAt time.Time `json:"created_at"`
LastSeen time.Time `json:"last_seen"`
Capacity Resources `json:"capacity,omitempty"`
Allocated Resources `json:"allocated,omitempty"`
}
type NodeState string
const (
NodeReady NodeState = "ready"
NodeNotReady NodeState = "not_ready"
)
type NodeRole string
const (
ControlPlane NodeRole = "control-plane"
Worker NodeRole = "worker"
)
type Resources struct {
CPUCores int `json:"cpu_cores"`
MemoryMB int64 `json:"memory_mb"`
DiskGB int64 `json:"disk_gb"`
}