Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preheat image skip certificate validation #1

Merged
merged 1 commit into from
Dec 3, 2021
Merged
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