mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-03 18:20:27 +00:00
Show the k8s load balancer IP if it is set
This commit is contained in:
@@ -23,10 +23,11 @@ var (
|
||||
}
|
||||
|
||||
ServiceMetadataTemplates = report.MetadataTemplates{
|
||||
ServiceID: {ID: ServiceID, Label: "ID", From: report.FromLatest, Priority: 1},
|
||||
Namespace: {ID: Namespace, Label: "Namespace", From: report.FromLatest, Priority: 2},
|
||||
ServiceCreated: {ID: ServiceCreated, Label: "Created", From: report.FromLatest, Priority: 3},
|
||||
ServiceIP: {ID: ServiceIP, Label: "Internal IP", From: report.FromLatest, Priority: 4},
|
||||
ServiceID: {ID: ServiceID, Label: "ID", From: report.FromLatest, Priority: 1},
|
||||
Namespace: {ID: Namespace, Label: "Namespace", From: report.FromLatest, Priority: 2},
|
||||
ServiceCreated: {ID: ServiceCreated, Label: "Created", From: report.FromLatest, Priority: 3},
|
||||
ServicePublicIP: {ID: ServicePublicIP, Label: "Public IP", From: report.FromLatest, Priority: 4},
|
||||
ServiceIP: {ID: ServiceIP, Label: "Internal IP", From: report.FromLatest, Priority: 5},
|
||||
}
|
||||
|
||||
PodTableTemplates = report.TableTemplates{
|
||||
|
||||
@@ -70,8 +70,9 @@ var (
|
||||
CreationTimestamp: unversioned.Now(),
|
||||
},
|
||||
Spec: api.ServiceSpec{
|
||||
Type: api.ServiceTypeLoadBalancer,
|
||||
ClusterIP: "10.0.1.1",
|
||||
Type: api.ServiceTypeLoadBalancer,
|
||||
ClusterIP: "10.0.1.1",
|
||||
LoadBalancerIP: "10.0.1.2",
|
||||
Ports: []api.ServicePort{
|
||||
{Protocol: "TCP", Port: 6379},
|
||||
},
|
||||
|
||||
@@ -14,6 +14,7 @@ const (
|
||||
ServiceName = "kubernetes_service_name"
|
||||
ServiceCreated = "kubernetes_service_created"
|
||||
ServiceIP = "kubernetes_service_ip"
|
||||
ServicePublicIP = "kubernetes_service_public_ip"
|
||||
ServiceLabelPrefix = "kubernetes_service_label_"
|
||||
)
|
||||
|
||||
@@ -55,11 +56,15 @@ func (s *service) Selector() labels.Selector {
|
||||
}
|
||||
|
||||
func (s *service) GetNode() report.Node {
|
||||
return report.MakeNodeWith(report.MakeServiceNodeID(s.Namespace(), s.Name()), map[string]string{
|
||||
latest := map[string]string{
|
||||
ServiceID: s.ID(),
|
||||
ServiceName: s.Name(),
|
||||
ServiceCreated: s.ObjectMeta.CreationTimestamp.Format(time.RFC822),
|
||||
Namespace: s.Namespace(),
|
||||
ServiceIP: s.Spec.ClusterIP,
|
||||
}).AddTable(ServiceLabelPrefix, s.Labels)
|
||||
}
|
||||
if s.Spec.LoadBalancerIP != "" {
|
||||
latest[ServicePublicIP] = s.Spec.LoadBalancerIP
|
||||
}
|
||||
return report.MakeNodeWith(report.MakeServiceNodeID(s.Namespace(), s.Name()), latest).AddTable(ServiceLabelPrefix, s.Labels)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user