Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions supernode/daemon/mgr/preheat/image_preaheater.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
package preheat

import (
"crypto/tls"
"encoding/json"
"errors"
"fmt"
"github.com/sirupsen/logrus"
"io/ioutil"
"net/http"
"regexp"
Expand All @@ -28,6 +28,7 @@ import (

"github.com/dragonflyoss/Dragonfly/apis/types"
"github.com/dragonflyoss/Dragonfly/supernode/daemon/mgr"
"github.com/sirupsen/logrus"
)

func init() {
Expand All @@ -44,6 +45,10 @@ func (p *ImagePreheat) Type() string {
return "image"
}

const (
timeout = 1 * time.Minute
)

/**
* Create a worker to preheat the task.
*/
Expand Down Expand Up @@ -153,7 +158,13 @@ func (w *ImageWorker) getLayers(url string, header map[string]string, retryIfUnA
for k, v := range header {
req.Header.Add(k, v)
}
resp, err := http.DefaultClient.Do(req)
client := &http.Client {
Timeout: timeout,
Transport: &http.Transport {
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
resp, err := client.Do(req)
if err != nil {
return
}
Expand Down