From 91016a605af14635d8470ad031cbf41934cc2ae0 Mon Sep 17 00:00:00 2001 From: Andrew McDermott Date: Wed, 5 Jun 2019 18:41:03 +0100 Subject: [PATCH] Fix SEGV in updateReadinessStats Calling cloudprovider.NodeGroupForNode(unregistered.Node) can result in a nil result for the nodegroup - handle that case. --- cluster-autoscaler/clusterstate/clusterstate.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cluster-autoscaler/clusterstate/clusterstate.go b/cluster-autoscaler/clusterstate/clusterstate.go index d49f31e26cd0..f97209bf7a64 100644 --- a/cluster-autoscaler/clusterstate/clusterstate.go +++ b/cluster-autoscaler/clusterstate/clusterstate.go @@ -573,6 +573,10 @@ func (csr *ClusterStateRegistry) updateReadinessStats(currentTime time.Time) { klog.Warningf("Failed to get nodegroup for %s: %v", unregistered.Node.Name, errNg) continue } + if nodeGroup == nil { + klog.Warningf("Nodegroup is nil for %s", unregistered.Node.Name) + continue + } perNgCopy := perNodeGroup[nodeGroup.Id()] if unregistered.UnregisteredSince.Add(csr.config.MaxNodeProvisionTime).Before(currentTime) { perNgCopy.LongUnregistered++