forked from gambol99/go-marathon
-
Notifications
You must be signed in to change notification settings - Fork 1
/
pod_instance_status.go
89 lines (74 loc) · 3.68 KB
/
pod_instance_status.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
/*
Copyright 2017 The go-marathon Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package marathon
// PodInstanceState is the state of a specific pod instance
type PodInstanceState string
const (
// PodInstanceStatePending is when an instance is pending scheduling
PodInstanceStatePending PodInstanceState = "PENDING"
// PodInstanceStateStaging is when an instance is staged to be scheduled
PodInstanceStateStaging PodInstanceState = "STAGING"
// PodInstanceStateStable is when an instance is stably running
PodInstanceStateStable PodInstanceState = "STABLE"
// PodInstanceStateDegraded is when an instance is degraded status
PodInstanceStateDegraded PodInstanceState = "DEGRADED"
// PodInstanceStateTerminal is when an instance is terminal
PodInstanceStateTerminal PodInstanceState = "TERMINAL"
)
// PodInstanceStatus is the status of a pod instance
type PodInstanceStatus struct {
AgentHostname string `json:"agentHostname,omitempty"`
Conditions []*StatusCondition `json:"conditions,omitempty"`
Containers []*ContainerStatus `json:"containers,omitempty"`
ID string `json:"id,omitempty"`
LastChanged string `json:"lastChanged,omitempty"`
LastUpdated string `json:"lastUpdated,omitempty"`
Message string `json:"message,omitempty"`
Networks []*PodNetworkStatus `json:"networks,omitempty"`
Resources *Resources `json:"resources,omitempty"`
SpecReference string `json:"specReference,omitempty"`
Status PodInstanceState `json:"status,omitempty"`
StatusSince string `json:"statusSince,omitempty"`
}
// PodNetworkStatus is the networks attached to a pod instance
type PodNetworkStatus struct {
Addresses []string `json:"addresses,omitempty"`
Name string `json:"name,omitempty"`
}
// StatusCondition describes info about a status change
type StatusCondition struct {
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
Reason string `json:"reason,omitempty"`
LastChanged string `json:"lastChanged,omitempty"`
LastUpdated string `json:"lastUpdated,omitempty"`
}
// ContainerStatus contains all status information for a container instance
type ContainerStatus struct {
Conditions []*StatusCondition `json:"conditions,omitempty"`
ContainerID string `json:"containerId,omitempty"`
Endpoints []*PodEndpoint `json:"endpoints,omitempty"`
LastChanged string `json:"lastChanged,omitempty"`
LastUpdated string `json:"lastUpdated,omitempty"`
Message string `json:"message,omitempty"`
Name string `json:"name,omitempty"`
Resources *Resources `json:"resources,omitempty"`
Status string `json:"status,omitempty"`
StatusSince string `json:"statusSince,omitempty"`
Termination *ContainerTerminationState `json:"termination,omitempty"`
}
// ContainerTerminationState describes why a container terminated
type ContainerTerminationState struct {
ExitCode int `json:"exitCode,omitempty"`
Message string `json:"message,omitempty"`
}