Browse Source

Merge pull request #1649 from prometheus/grobie/fix-kubernetes-discovery

Fix type usage in Kubernetes discovery
pull/1650/head
Tobias Schmidt 9 years ago
parent
commit
b713ca56c2
  1. 4
      retrieval/discovery/kubernetes/discovery.go

4
retrieval/discovery/kubernetes/discovery.go

@ -802,14 +802,14 @@ func (kd *Discovery) updatePod(pod *Pod, eventType EventType) {
defer kd.podsMu.Unlock() defer kd.podsMu.Unlock()
switch eventType { switch eventType {
case deleted: case Deleted:
if _, ok := kd.pods[pod.ObjectMeta.Namespace]; ok { if _, ok := kd.pods[pod.ObjectMeta.Namespace]; ok {
delete(kd.pods[pod.ObjectMeta.Namespace], pod.ObjectMeta.Name) delete(kd.pods[pod.ObjectMeta.Namespace], pod.ObjectMeta.Name)
if len(kd.pods[pod.ObjectMeta.Namespace]) == 0 { if len(kd.pods[pod.ObjectMeta.Namespace]) == 0 {
delete(kd.pods, pod.ObjectMeta.Namespace) delete(kd.pods, pod.ObjectMeta.Namespace)
} }
} }
case added, modified: case Added, Modified:
if _, ok := kd.pods[pod.ObjectMeta.Namespace]; !ok { if _, ok := kd.pods[pod.ObjectMeta.Namespace]; !ok {
kd.pods[pod.ObjectMeta.Namespace] = map[string]*Pod{} kd.pods[pod.ObjectMeta.Namespace] = map[string]*Pod{}
} }

Loading…
Cancel
Save