File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
pkg/oci/instance/metadata Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -17,13 +17,15 @@ package metadata
1717import (
1818 "encoding/json"
1919 "net/http"
20+ "time"
2021
2122 "github.com/pkg/errors"
2223)
2324
2425const (
25- baseURL = "http://169.254.169.254"
26- metadataEndpoint = "/opc/v1/instance/"
26+ baseURL = "http://169.254.169.254"
27+ metadataEndpoint = "/opc/v1/instance/"
28+ defaultHTTPTimeout = 5 * time .Second
2729)
2830
2931// InstanceMetadata holds the subset of the instance metadata retrieved from the
@@ -48,7 +50,8 @@ type metadataGetter struct {
4850// New returns the instance metadata for the host on which the code is being
4951// executed.
5052func New () Interface {
51- return & metadataGetter {client : http .DefaultClient , baseURL : baseURL }
53+ var client = & http.Client {Timeout : defaultHTTPTimeout }
54+ return & metadataGetter {client : client , baseURL : baseURL }
5255}
5356
5457// Get either returns the cached metadata for the current instance or queries
You can’t perform that action at this time.
0 commit comments