Skip to content

Commit 72d01ad

Browse files
authored
Merge pull request #33 from jfrederickson/refactor/linodego-settoken
Use default linodego http client rather than creating a custom one
2 parents f8062de + 0754041 commit 72d01ad

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

cloud/linode/cloud.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@ package linode
33
import (
44
"fmt"
55
"io"
6-
"net/http"
76
"os"
87

98
"github.com/linode/linodego"
10-
"golang.org/x/oauth2"
119
"k8s.io/kubernetes/pkg/cloudprovider"
1210
"k8s.io/kubernetes/pkg/controller"
1311
)
@@ -53,18 +51,8 @@ func newCloud() (cloudprovider.Interface, error) {
5351
return nil, fmt.Errorf("%s must be set in the environment (use a k8s secret)", regionEnv)
5452
}
5553

56-
// Initialize Linode API Client
57-
tokenSource := oauth2.StaticTokenSource(&oauth2.Token{
58-
AccessToken: apiToken,
59-
})
60-
61-
oauth2Client := &http.Client{
62-
Transport: &oauth2.Transport{
63-
Source: tokenSource,
64-
},
65-
}
66-
67-
linodeClient := linodego.NewClient(oauth2Client)
54+
linodeClient := linodego.NewClient(nil)
55+
linodeClient.SetToken(apiToken)
6856
if Options.LinodeGoDebug {
6957
linodeClient.SetDebug(true)
7058
}

0 commit comments

Comments
 (0)