@@ -10,8 +10,8 @@ import (
1010 "text/template"
1111 "time"
1212
13+ "github.com/Azure/azure-sdk-for-go/sdk/azcore"
1314 "github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
14- "github.com/Azure/azure-sdk-for-go/sdk/azidentity"
1515 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v8"
1616 corev1 "k8s.io/api/core/v1"
1717 apierrors "k8s.io/apimachinery/pkg/api/errors"
@@ -38,7 +38,7 @@ const (
3838 wgKubeImage = "ghcr.io/b4fun/wg-kube:sha-11e4656"
3939)
4040
41- func deployWireGuard (ctx context.Context , credentials * azidentity. DefaultAzureCredential , cfg * utilconfig.Config ) error {
41+ func deployWireGuard (ctx context.Context , credentials azcore. TokenCredential , cfg * utilconfig.Config ) error {
4242 // Step 1: Get or generate WireGuard keys for the hub
4343 log .Print ("Getting WireGuard keys..." )
4444
@@ -93,7 +93,7 @@ func deployWireGuard(ctx context.Context, credentials *azidentity.DefaultAzureCr
9393
9494// getOrCreateWireGuardKeys checks if the wireguard-keys secret exists and returns those keys,
9595// otherwise generates new keys.
96- func getOrCreateWireGuardKeys (ctx context.Context , credentials * azidentity. DefaultAzureCredential , cfg * utilconfig.Config ) (* wireguard.KeyPair , error ) {
96+ func getOrCreateWireGuardKeys (ctx context.Context , credentials azcore. TokenCredential , cfg * utilconfig.Config ) (* wireguard.KeyPair , error ) {
9797 loader , err := k8s .Loader (ctx , credentials , cfg )
9898 if err != nil {
9999 return nil , err
@@ -144,7 +144,7 @@ func getOrCreateWireGuardKeys(ctx context.Context, credentials *azidentity.Defau
144144}
145145
146146// getWireGuardNodeIP retrieves the public and private IP of the WireGuard gateway node from Kubernetes.
147- func getWireGuardNodeIP (ctx context.Context , credentials * azidentity. DefaultAzureCredential , cfg * utilconfig.Config ) (publicIP , privateIP string , err error ) {
147+ func getWireGuardNodeIP (ctx context.Context , credentials azcore. TokenCredential , cfg * utilconfig.Config ) (publicIP , privateIP string , err error ) {
148148 loader , err := k8s .Loader (ctx , credentials , cfg )
149149 if err != nil {
150150 return "" , "" , err
@@ -219,7 +219,7 @@ func getWireGuardNodeIP(ctx context.Context, credentials *azidentity.DefaultAzur
219219}
220220
221221// updateRouteTable updates the route table with the gateway node's private IP.
222- func updateRouteTable (ctx context.Context , credentials * azidentity. DefaultAzureCredential , cfg * utilconfig.Config , gatewayPrivateIP string ) error {
222+ func updateRouteTable (ctx context.Context , credentials azcore. TokenCredential , cfg * utilconfig.Config , gatewayPrivateIP string ) error {
223223 routeTablesClient , err := armnetwork .NewRouteTablesClient (cfg .SubscriptionID , credentials , nil )
224224 if err != nil {
225225 return err
@@ -256,7 +256,7 @@ func updateRouteTable(ctx context.Context, credentials *azidentity.DefaultAzureC
256256}
257257
258258// associateRouteTableWithSubnets associates the wg-routes route table with the aks and nodes subnets.
259- func associateRouteTableWithSubnets (ctx context.Context , credentials * azidentity. DefaultAzureCredential , cfg * utilconfig.Config ) error {
259+ func associateRouteTableWithSubnets (ctx context.Context , credentials azcore. TokenCredential , cfg * utilconfig.Config ) error {
260260 subnetsClient , err := armnetwork .NewSubnetsClient (cfg .SubscriptionID , credentials , nil )
261261 if err != nil {
262262 return err
@@ -307,7 +307,7 @@ func associateRouteTableWithSubnets(ctx context.Context, credentials *azidentity
307307// deployWireGuardToK8s deploys the WireGuard DaemonSet to the AKS cluster.
308308func deployWireGuardToK8s (
309309 ctx context.Context ,
310- credentials * azidentity. DefaultAzureCredential ,
310+ credentials azcore. TokenCredential ,
311311 cfg * utilconfig.Config ,
312312 keys * wireguard.KeyPair ,
313313) error {
0 commit comments