mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 02:30:45 +00:00
Show k8s pod status
This commit is contained in:
@@ -15,6 +15,7 @@ const (
|
||||
PodName = "kubernetes_pod_name"
|
||||
PodCreated = "kubernetes_pod_created"
|
||||
PodContainerIDs = "kubernetes_pod_container_ids"
|
||||
PodState = "kubernetes_pod_state"
|
||||
ServiceIDs = "kubernetes_service_ids"
|
||||
)
|
||||
|
||||
@@ -73,6 +74,10 @@ func (p *pod) AddServiceID(id string) {
|
||||
p.serviceIDs = append(p.serviceIDs, id)
|
||||
}
|
||||
|
||||
func (p *pod) State() string {
|
||||
return string(p.Status.Phase)
|
||||
}
|
||||
|
||||
func (p *pod) GetNode() report.Node {
|
||||
n := report.MakeNodeWith(map[string]string{
|
||||
PodID: p.ID(),
|
||||
@@ -80,6 +85,7 @@ func (p *pod) GetNode() report.Node {
|
||||
Namespace: p.Namespace(),
|
||||
PodCreated: p.Created(),
|
||||
PodContainerIDs: strings.Join(p.ContainerIDs(), " "),
|
||||
PodState: p.State(),
|
||||
})
|
||||
if len(p.serviceIDs) > 0 {
|
||||
n = n.WithLatests(map[string]string{ServiceIDs: strings.Join(p.serviceIDs, " ")})
|
||||
|
||||
@@ -11,8 +11,9 @@ import (
|
||||
var (
|
||||
PodMetadataTemplates = report.MetadataTemplates{
|
||||
PodID: {ID: PodID, Label: "ID", From: report.FromLatest, Priority: 1},
|
||||
Namespace: {ID: Namespace, Label: "Namespace", From: report.FromLatest, Priority: 2},
|
||||
PodCreated: {ID: PodCreated, Label: "Created", From: report.FromLatest, Priority: 3},
|
||||
PodState: {ID: PodState, Label: "State", From: report.FromLatest, Priority: 2},
|
||||
Namespace: {ID: Namespace, Label: "Namespace", From: report.FromLatest, Priority: 3},
|
||||
PodCreated: {ID: PodCreated, Label: "Created", From: report.FromLatest, Priority: 4},
|
||||
}
|
||||
|
||||
ServiceMetadataTemplates = report.MetadataTemplates{
|
||||
|
||||
Reference in New Issue
Block a user