do not use logreader if it doesn't exist

This commit is contained in:
iwilltry42 2021-10-08 12:59:01 +02:00
parent 7d4d63f18b
commit 1e9c20e0a9
No known key found for this signature in database
GPG Key ID: 7BA57AD1CFF16110

View File

@ -994,11 +994,15 @@ func corednsAddHost(ctx context.Context, runtime k3drt.Runtime, cluster *k3d.Clu
break break
} else { } else {
msg := fmt.Sprintf("error patching the CoreDNS ConfigMap to include entry '%s': %+v", hostsEntry, err) msg := fmt.Sprintf("error patching the CoreDNS ConfigMap to include entry '%s': %+v", hostsEntry, err)
readlogs, err := ioutil.ReadAll(logreader) if logreader != nil {
if err != nil { readlogs, err := ioutil.ReadAll(logreader)
l.Log().Debugf("error reading the logs from failed CoreDNS patch exec process in node %s: %v", node.Name, err) if err != nil {
l.Log().Debugf("error reading the logs from failed CoreDNS patch exec process in node %s: %v", node.Name, err)
} else {
msg += fmt.Sprintf("\nLogs: %s", string(readlogs))
}
} else { } else {
msg += fmt.Sprintf("\nLogs: %s", string(readlogs)) l.Log().Debugf("no logreader returned for exec process")
} }
l.Log().Debugln(msg) l.Log().Debugln(msg)
} }