Skip to content

Commit

Permalink
Merge pull request #1409 from weaveworks/1396-pod-ip
Browse files Browse the repository at this point in the history
Show Pod IP in details panel.
  • Loading branch information
paulbellamy committed Apr 29, 2016
2 parents eba1cce + e917dd6 commit a81b116
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
14 changes: 8 additions & 6 deletions probe/kubernetes/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"

StateDeleted = "deleted"
Expand Down Expand Up @@ -88,12 +89,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 {
Expand Down
5 changes: 3 additions & 2 deletions probe/kubernetes/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,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{
Expand Down
2 changes: 1 addition & 1 deletion render/detailed/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{},
Expand Down

0 comments on commit a81b116

Please sign in to comment.