Add check for k8s condition (#1412)
This commit is contained in:
parent
378d03eb66
commit
8d0826a031
@ -129,6 +129,7 @@ func (k *kubernetes) getService(labels map[string]string) ([]*service, error) {
|
|||||||
// parse out deployment status and inject into service metadata
|
// parse out deployment status and inject into service metadata
|
||||||
if len(kdep.Status.Conditions) > 0 {
|
if len(kdep.Status.Conditions) > 0 {
|
||||||
svc.Metadata["status"] = kdep.Status.Conditions[0].Type
|
svc.Metadata["status"] = kdep.Status.Conditions[0].Type
|
||||||
|
svc.Metadata["started"] = kdep.Status.Conditions[0].LastUpdate
|
||||||
delete(svc.Metadata, "error")
|
delete(svc.Metadata, "error")
|
||||||
} else {
|
} else {
|
||||||
svc.Metadata["status"] = "n/a"
|
svc.Metadata["status"] = "n/a"
|
||||||
@ -154,6 +155,11 @@ func (k *kubernetes) getService(labels map[string]string) ([]*service, error) {
|
|||||||
status = item.Status.Phase
|
status = item.Status.Phase
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// skip if we can't get the container
|
||||||
|
if len(item.Status.Containers) == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// now try get a deeper status
|
// now try get a deeper status
|
||||||
state := item.Status.Containers[0].State
|
state := item.Status.Containers[0].State
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ type DeploymentSpec struct {
|
|||||||
|
|
||||||
// DeploymentCondition describes the state of deployment
|
// DeploymentCondition describes the state of deployment
|
||||||
type DeploymentCondition struct {
|
type DeploymentCondition struct {
|
||||||
|
LastUpdate string `json:lastUpdateTime`
|
||||||
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"`
|
||||||
|
Loading…
Reference in New Issue
Block a user