Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

preheat image skip certificate validation #1566

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
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