Skip to content

Commit 80ccbba

Browse files
Do not use a custom http.Transport due to Resty incompatibility (#227)
We're hitting the same issue as here: linode/cluster-api-provider-linode#436 We use a custom CA and it doesn't get used. Given that we construct an http.Transport that is of a different concrete type than http.Transport (it just needs to be a RoundTripper), resty fails and defaults to an empty client, discarding our CA.
1 parent f2b7e2a commit 80ccbba

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

cloud/linode/client/client.go

+2-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"time"
1111

1212
"github.com/linode/linodego"
13-
"golang.org/x/oauth2"
1413
"k8s.io/klog/v2"
1514
)
1615

@@ -63,19 +62,13 @@ func New(token string, timeout time.Duration) (*linodego.Client, error) {
6362
userAgent := fmt.Sprintf("linode-cloud-controller-manager %s", linodego.DefaultUserAgent)
6463
apiURL := os.Getenv("LINODE_URL")
6564

66-
tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
67-
oauth2Client := &http.Client{
68-
Transport: &oauth2.Transport{
69-
Source: tokenSource,
70-
},
71-
Timeout: timeout,
72-
}
73-
linodeClient := linodego.NewClient(oauth2Client)
65+
linodeClient := linodego.NewClient(&http.Client{Timeout: timeout})
7466
client, err := linodeClient.UseURL(apiURL)
7567
if err != nil {
7668
return nil, err
7769
}
7870
client.SetUserAgent(userAgent)
71+
client.SetToken(token)
7972

8073
klog.V(3).Infof("Linode client created with default timeout of %v", timeout)
8174
return client, nil

0 commit comments

Comments
 (0)