Skip to content

Commit

Permalink
migrate slb/pip/vm/vmss/vmas to track2 sdk
Browse files Browse the repository at this point in the history
Signed-off-by: Fan Shang Xiang <shafan@microsoft.com>
  • Loading branch information
MartinForReal committed Dec 15, 2024
1 parent cc85ce1 commit 80144d4
Show file tree
Hide file tree
Showing 138 changed files with 8,643 additions and 10,229 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ require (
github.com/onsi/ginkgo/v2 v2.22.0
github.com/onsi/gomega v1.36.0
github.com/prometheus/client_golang v1.20.5
github.com/samber/lo v1.47.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.10.0
Expand Down Expand Up @@ -124,7 +125,6 @@ require (
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.60.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/stoewer/go-strcase v1.2.0 // indirect
github.com/x448/float16 v0.8.4 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ github.com/redis/go-redis/v9 v9.6.1/go.mod h1:0C0c6ycQsdpVNQpxb1njEQIqkx5UcsM8FJ
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=
github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/samber/lo v1.47.0 h1:z7RynLwP5nbyRscyvcD043DWYoOcYRv3mV8lBeqOCLc=
github.com/samber/lo v1.47.0/go.mod h1:RmDH9Ct32Qy3gduHQuKJ3gW1fMHAnE/fAzQuf6He5cU=
github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8=
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
Expand Down
15 changes: 7 additions & 8 deletions internal/testutil/fixture/azure_loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,27 @@ limitations under the License.
package fixture

import (
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network"

"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
"k8s.io/utils/ptr"
)

func (f *AzureFixture) LoadBalancer() *AzureLoadBalancerFixture {
return &AzureLoadBalancerFixture{
lb: &network.LoadBalancer{
Name: ptr.To("lb"),
LoadBalancerPropertiesFormat: &network.LoadBalancerPropertiesFormat{
lb: &armnetwork.LoadBalancer{
Name: ptr.To("lb"),
Properties: &armnetwork.LoadBalancerPropertiesFormat{
// TODO
},
},
}
}

type AzureLoadBalancerFixture struct {
lb *network.LoadBalancer
lb *armnetwork.LoadBalancer
}

func (f *AzureLoadBalancerFixture) Build() network.LoadBalancer {
return *f.lb
func (f *AzureLoadBalancerFixture) Build() *armnetwork.LoadBalancer {
return f.lb
}

func (f *AzureLoadBalancerFixture) IPv4Addresses() []string {
Expand Down
19 changes: 9 additions & 10 deletions internal/testutil/fixture/azure_publicip.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ package fixture
import (
"fmt"

"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2022-07-01/network"

"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v6"
"k8s.io/utils/ptr"
)

Expand All @@ -31,20 +30,20 @@ func (f *AzureFixture) PublicIPAddress(name string) *AzurePublicIPAddressFixture
)

return &AzurePublicIPAddressFixture{
pip: &network.PublicIPAddress{
ID: ptr.To(fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/publicIPAddresses/%s", SubscriptionID, ResourceGroup, name)),
Name: ptr.To(name),
Tags: make(map[string]*string),
PublicIPAddressPropertiesFormat: &network.PublicIPAddressPropertiesFormat{},
pip: &armnetwork.PublicIPAddress{
ID: ptr.To(fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/publicIPAddresses/%s", SubscriptionID, ResourceGroup, name)),
Name: ptr.To(name),
Tags: make(map[string]*string),
Properties: &armnetwork.PublicIPAddressPropertiesFormat{},
},
}
}

type AzurePublicIPAddressFixture struct {
pip *network.PublicIPAddress
pip *armnetwork.PublicIPAddress
}

func (f *AzurePublicIPAddressFixture) Build() network.PublicIPAddress {
func (f *AzurePublicIPAddressFixture) Build() armnetwork.PublicIPAddress {
return *f.pip
}

Expand All @@ -54,6 +53,6 @@ func (f *AzurePublicIPAddressFixture) WithTag(key, value string) *AzurePublicIPA
}

func (f *AzurePublicIPAddressFixture) WithAddress(address string) *AzurePublicIPAddressFixture {
f.pip.PublicIPAddressPropertiesFormat.IPAddress = ptr.To(address)
f.pip.Properties.IPAddress = ptr.To(address)
return f
}
6 changes: 3 additions & 3 deletions kubetest2-aks/deployer/up.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,8 @@ func (d *deployer) createAKSWithCustomConfig() error {
return nil
}

// getAKSKubeconfig gets kubeconfig of the AKS cluster and writes it to specific path.
func (d *deployer) getAKSKubeconfig() error {
// getAKSKUbeconfig gets kubeconfig of the AKS cluster and writes it to specific path.
func (d *deployer) getAKSKUbeconfig() error {
klog.Infof("Retrieving AKS cluster's kubeconfig")
client, err := armcontainerservicev2.NewManagedClustersClient(subscriptionID, cred, nil)
if err != nil {
Expand Down Expand Up @@ -397,7 +397,7 @@ func (d *deployer) Up() error {
}

// Get the cluster kubeconfig
if err := d.getAKSKubeconfig(); err != nil {
if err := d.getAKSKUbeconfig(); err != nil {
return fmt.Errorf("failed to get AKS cluster kubeconfig: %v", err)
}
return nil
Expand Down
Loading

0 comments on commit 80144d4

Please sign in to comment.