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

Commit

Permalink
Merge pull request #1 from zkking/zkking-skip-preheat-certificate-val…
Browse files Browse the repository at this point in the history
…idation

preheat image skip certificate validation
  • Loading branch information
zkking committed Dec 3, 2021
2 parents 1bb1d3e + a346c26 commit e15b58b
Showing 1 changed file with 13 additions and 2 deletions.
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

0 comments on commit e15b58b

Please sign in to comment.