sigh, further status changes (#1371)
This commit is contained in:
parent
5ad7c36bd4
commit
40ff6ddfcf
@ -152,6 +152,22 @@ func (k *kubernetes) getService(labels map[string]string) ([]*service, error) {
|
|||||||
status = item.Status.Phase
|
status = item.Status.Phase
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// now try get a deeper status
|
||||||
|
state := item.Status.Containers[0].State
|
||||||
|
|
||||||
|
// set start time
|
||||||
|
if state.Running != nil {
|
||||||
|
svc.Metadata["started"] = state.Running.Started
|
||||||
|
}
|
||||||
|
|
||||||
|
// set status from waiting
|
||||||
|
if v := state.Waiting; v != nil {
|
||||||
|
if len(v.Reason) > 0 {
|
||||||
|
status = v.Reason
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: set from terminated
|
||||||
|
|
||||||
svc.Metadata["status"] = status
|
svc.Metadata["status"] = status
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,6 +14,12 @@ type EnvVar struct {
|
|||||||
Value string `json:"value,omitempty"`
|
Value string `json:"value,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Condition struct {
|
||||||
|
Started string `json:"startedAt,omitempty"`
|
||||||
|
Reason string `json:"reason,omitempty"`
|
||||||
|
Message string `json:"message,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
// Container defined container runtime values
|
// Container defined container runtime values
|
||||||
type Container struct {
|
type Container struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@ -34,8 +40,8 @@ type DeploymentSpec struct {
|
|||||||
// DeploymentCondition describes the state of deployment
|
// DeploymentCondition describes the state of deployment
|
||||||
type DeploymentCondition struct {
|
type DeploymentCondition struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Reason string `json:"reason,omitempty"`
|
reason string `json:"reason,omitempty"`
|
||||||
Message string `json:"message,omitempty"`
|
message string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeploymentStatus is returned when querying deployment
|
// DeploymentStatus is returned when querying deployment
|
||||||
@ -104,6 +110,7 @@ type Pod struct {
|
|||||||
// PodStatus
|
// PodStatus
|
||||||
type PodStatus struct {
|
type PodStatus struct {
|
||||||
Conditions []PodCondition `json:"conditions,omitempty"`
|
Conditions []PodCondition `json:"conditions,omitempty"`
|
||||||
|
Containers []ContainerStatus `json:"containerStatuses"`
|
||||||
PodIP string `json:"podIP"`
|
PodIP string `json:"podIP"`
|
||||||
Phase string `json:"phase"`
|
Phase string `json:"phase"`
|
||||||
Reason string `json:"reason"`
|
Reason string `json:"reason"`
|
||||||
@ -116,6 +123,16 @@ type PodCondition struct {
|
|||||||
Message string `json:"message,omitempty"`
|
Message string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type ContainerStatus struct {
|
||||||
|
State ContainerState `json:"state"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ContainerState struct {
|
||||||
|
Running *Condition `json:"running"`
|
||||||
|
Terminated *Condition `json:"terminated"`
|
||||||
|
Waiting *Condition `json:"waiting"`
|
||||||
|
}
|
||||||
|
|
||||||
// Resource is API resource
|
// Resource is API resource
|
||||||
type Resource struct {
|
type Resource struct {
|
||||||
Name string
|
Name string
|
||||||
|
Loading…
Reference in New Issue
Block a user