|
|
@@ -4,9 +4,8 @@ import (
|
|
|
"database/sql"
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
- "golang.org/x/text/cases"
|
|
|
- "golang.org/x/text/language"
|
|
|
"io"
|
|
|
+ "net"
|
|
|
"net/http"
|
|
|
"regexp"
|
|
|
"strconv"
|
|
|
@@ -14,6 +13,9 @@ import (
|
|
|
"sync"
|
|
|
"time"
|
|
|
|
|
|
+ "golang.org/x/text/cases"
|
|
|
+ "golang.org/x/text/language"
|
|
|
+
|
|
|
"github.com/opencost/opencost/pkg/kubecost"
|
|
|
|
|
|
"github.com/opencost/opencost/pkg/util"
|
|
|
@@ -506,9 +508,16 @@ func NewProvider(cache clustercache.ClusterCache, apiKey string, config *config.
|
|
|
clusterRegion: cp.region,
|
|
|
clusterAccountID: cp.accountID,
|
|
|
clusterProjectID: cp.projectID,
|
|
|
- metadataClient: metadata.NewClient(&http.Client{
|
|
|
- Transport: httputil.NewUserAgentTransport("kubecost", http.DefaultTransport),
|
|
|
- }),
|
|
|
+ metadataClient: metadata.NewClient(
|
|
|
+ &http.Client{
|
|
|
+ Transport: httputil.NewUserAgentTransport("kubecost", &http.Transport{
|
|
|
+ Dial: (&net.Dialer{
|
|
|
+ Timeout: 2 * time.Second,
|
|
|
+ KeepAlive: 30 * time.Second,
|
|
|
+ }).Dial,
|
|
|
+ }),
|
|
|
+ Timeout: 5 * time.Second,
|
|
|
+ }),
|
|
|
}, nil
|
|
|
case kubecost.AWSProvider:
|
|
|
log.Info("Found ProviderID starting with \"aws\", using AWS Provider")
|