Skip to content

Commit

Permalink
Do not use a custom http.Transport due to Resty incompatibility
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
okokes-akamai committed Aug 15, 2024
1 parent f2b7e2a commit 1fccf33
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions cloud/linode/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"time"

"github.com/linode/linodego"
"golang.org/x/oauth2"
"k8s.io/klog/v2"
)

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

tokenSource := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
oauth2Client := &http.Client{
Transport: &oauth2.Transport{
Source: tokenSource,
},
Timeout: timeout,
}
linodeClient := linodego.NewClient(oauth2Client)
linodeClient := linodego.NewClient(&http.Client{Timeout: timeout})
client, err := linodeClient.UseURL(apiURL)
if err != nil {
return nil, err
}
client.SetUserAgent(userAgent)
client.SetToken(token)

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

0 comments on commit 1fccf33

Please sign in to comment.