Skip to content

Commit

Permalink
Guard owner.controller dereference (it can be nil)
Browse files Browse the repository at this point in the history
  • Loading branch information
smarterclayton authored and brancz committed Aug 24, 2017
1 parent 259497e commit 17aadf3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion collectors/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,11 @@ func (pc *podCollector) collectPod(ch chan<- prometheus.Metric, p v1.Pod) {
addGauge(descPodOwner, 1, "<none>", "<none>", "<none>")
} else {
for _, owner := range owners {
addGauge(descPodOwner, 1, owner.Kind, owner.Name, strconv.FormatBool(*owner.Controller))
if owner.Controller != nil {
addGauge(descPodOwner, 1, owner.Kind, owner.Name, strconv.FormatBool(*owner.Controller))
} else {
addGauge(descPodOwner, 1, owner.Kind, owner.Name, "false")
}
}
}

Expand Down

0 comments on commit 17aadf3

Please sign in to comment.