Show Pod IP in details panel.

This commit is contained in:
Tom Wilkie
2016-04-29 11:35:33 +01:00
parent b8cd9ec57b
commit e917dd61a8
3 changed files with 12 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ const (
PodContainerIDs = "kubernetes_pod_container_ids"
PodState = "kubernetes_pod_state"
PodLabelPrefix = "kubernetes_pod_labels_"
PodIP = "kubernetes_pod_ip"
ServiceIDs = "kubernetes_service_ids"
)
@@ -86,12 +87,13 @@ func (p *pod) NodeName() string {
func (p *pod) GetNode(probeID string) report.Node {
n := report.MakeNodeWith(report.MakePodNodeID(p.Namespace(), p.Name()), map[string]string{
PodID: p.ID(),
PodName: p.Name(),
Namespace: p.Namespace(),
PodCreated: p.Created(),
PodContainerIDs: strings.Join(p.ContainerIDs(), " "),
PodState: p.State(),
PodID: p.ID(),
PodName: p.Name(),
Namespace: p.Namespace(),
PodCreated: p.Created(),
PodContainerIDs: strings.Join(p.ContainerIDs(), " "),
PodState: p.State(),
PodIP: p.Status.PodIP,
report.ControlProbeID: probeID,
})
if len(p.serviceIDs) > 0 {

View File

@@ -18,8 +18,9 @@ var (
PodMetadataTemplates = report.MetadataTemplates{
PodID: {ID: PodID, Label: "ID", From: report.FromLatest, Priority: 1},
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},
PodIP: {ID: PodIP, Label: "IP", From: report.FromLatest, Priority: 3},
Namespace: {ID: Namespace, Label: "Namespace", From: report.FromLatest, Priority: 5},
PodCreated: {ID: PodCreated, Label: "Created", From: report.FromLatest, Priority: 6},
}
ServiceMetadataTemplates = report.MetadataTemplates{

View File

@@ -319,7 +319,7 @@ func TestMakeDetailedPodNode(t *testing.T) {
Metadata: []report.MetadataRow{
{ID: "kubernetes_pod_id", Label: "ID", Value: "ping/pong-b", Priority: 1},
{ID: "kubernetes_pod_state", Label: "State", Value: "running", Priority: 2},
{ID: "kubernetes_namespace", Label: "Namespace", Value: "ping", Priority: 3},
{ID: "kubernetes_namespace", Label: "Namespace", Value: "ping", Priority: 5},
},
},
Controls: []detailed.ControlInstance{},