Skip to content

Commit

Permalink
Parse node logs also when encountered with standard html header
Browse files Browse the repository at this point in the history
  • Loading branch information
ardaguclu committed Dec 4, 2024
1 parent e075d0e commit f367270
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/monitortestlibrary/nodeaccess/node_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ func GetDirectoryListing(in io.Reader) ([]string, error) {

// turn href links into lines of output
content, _ := buf.Peek(bufferSize)
if bytes.HasPrefix(content, []byte("<pre>")) {
// Until Go 1.23, kubelet returned with the prefix <pre>, but now
// it returns with standard html prefix. We need to support both of them.
if bytes.HasPrefix(content, []byte("<pre>")) || bytes.HasPrefix(content, []byte("<!doctype html>")) {
reLink := regexp.MustCompile(`href="([^"]+)"`)
s := bufio.NewScanner(buf)
s.Split(func(data []byte, atEOF bool) (advance int, token []byte, err error) {
Expand Down

0 comments on commit f367270

Please sign in to comment.