Merge pull request #714 from erikwilson/node-controller-panic-fix

Fix panic in node controller
pull/729/head
Erik Wilson 2019-08-09 14:09:06 -07:00 committed by GitHub
commit 16da9edf45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -56,11 +56,12 @@ func (h *handler) updateHosts(node *core.Node, removed bool) (*core.Node, error)
return nil, nil return nil, nil
} }
configMap, err := h.configCache.Get("kube-system", "coredns") configMapCache, err := h.configCache.Get("kube-system", "coredns")
if err != nil || configMap == nil { if err != nil || configMapCache == nil {
logrus.Warn(errors.Wrap(err, "Unable to fetch coredns config map")) logrus.Warn(errors.Wrap(err, "Unable to fetch coredns config map"))
return nil, nil return nil, nil
} }
configMap := configMapCache.DeepCopy()
hosts := configMap.Data["NodeHosts"] hosts := configMap.Data["NodeHosts"]
for _, line := range strings.Split(hosts, "\n") { for _, line := range strings.Split(hosts, "\n") {