From d107ef01f32d6eb01f1953af666d7712d2572972 Mon Sep 17 00:00:00 2001 From: juliogreff Date: Mon, 16 Sep 2019 12:25:28 +0200 Subject: [PATCH] shipper-state-metrics: initialize rolloutblocks lister This fixes a panic when running the collector: ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x116ce51] goroutine 342 [running]: main.ShipperStateMetrics.collectRolloutBlocks(0x1610760, 0xc00041e010, 0x1610860, 0xc00041e030, 0x1610820, 0xc00041e050, 0x16107a0, 0xc00041e070, 0x16108e0, 0xc00041e090, ...) /shipper/cmd/shipper-state-metrics/collector.go:351 +0x101 main.ShipperStateMetrics.Collect(0x1610760, 0xc00041e010, 0x1610860, 0xc00041e030, 0x1610820, 0xc00041e050, 0x16107a0, 0xc00041e070, 0x16108e0, 0xc00041e090, ...) /shipper/cmd/shipper-state-metrics/collector.go:101 +0x194 github.com/prometheus/client_golang/prometheus.(*Registry).Gather.func1() /shipper/vendor/github.com/prometheus/client_golang/prometheus/registry.go:434 +0x19d created by github.com/prometheus/client_golang/prometheus.(*Registry).Gather /shipper/vendor/github.com/prometheus/client_golang/prometheus/registry.go:445 +0x571 ``` --- cmd/shipper-state-metrics/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/shipper-state-metrics/main.go b/cmd/shipper-state-metrics/main.go index 8463597a1..86aaaa744 100644 --- a/cmd/shipper-state-metrics/main.go +++ b/cmd/shipper-state-metrics/main.go @@ -68,6 +68,7 @@ func main() { ctsLister: shipperInformerFactory.Shipper().V1alpha1().CapacityTargets().Lister(), ttsLister: shipperInformerFactory.Shipper().V1alpha1().TrafficTargets().Lister(), clustersLister: shipperInformerFactory.Shipper().V1alpha1().Clusters().Lister(), + rbLister: shipperInformerFactory.Shipper().V1alpha1().RolloutBlocks().Lister(), nssLister: kubeInformerFactory.Core().V1().Namespaces().Lister(), secretsLister: kubeInformerFactory.Core().V1().Secrets().Lister(),