chore: Move to azuresdk folder

This commit is contained in:
Daniel J. Holmes (jaitaiwan) 2024-11-05 14:40:58 +10:00
Родитель c3aac1d8ea
Коммит ba6af03163
7 изменённых файлов: 11 добавлений и 82 удалений

4
pkg/env/core.go поставляемый
Просмотреть файл

@ -11,7 +11,7 @@ import (
"github.com/Azure/go-autorest/autorest"
"github.com/sirupsen/logrus"
"github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/containerservice"
utilcontainerservice "github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/armcontainerservice"
"github.com/Azure/ARO-RP/pkg/util/instancemetadata"
"github.com/Azure/ARO-RP/pkg/util/liveconfig"
)
@ -80,7 +80,7 @@ func (c *core) NewLiveConfigManager(ctx context.Context) (liveconfig.Manager, er
return nil, err
}
mcc, err := containerservice.NewDefaultManagedClustersClient(c.Environment(), c.SubscriptionID(), tokenizer)
mcc, err := utilcontainerservice.NewDefaultManagedClustersClient(c.Environment(), c.SubscriptionID(), tokenizer)
if err != nil {
return nil, err
}

Просмотреть файл

@ -14,7 +14,7 @@ import (
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/containerservice"
utilcontainerservice "github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/armcontainerservice"
)
func getAksClusterByNameAndLocation(ctx context.Context, aksClusters *runtime.Pager[armcontainerservice.ManagedClustersClientListResponse], aksClusterName, location string) (*armcontainerservice.ManagedCluster, error) {
@ -33,7 +33,7 @@ func getAksClusterByNameAndLocation(ctx context.Context, aksClusters *runtime.Pa
return nil, nil
}
func getAksShardKubeconfig(ctx context.Context, managedClustersClient containerservice.ManagedClustersClient, location string, shard int) (*rest.Config, error) {
func getAksShardKubeconfig(ctx context.Context, managedClustersClient utilcontainerservice.ManagedClustersClient, location string, shard int) (*rest.Config, error) {
aksClusterName := fmt.Sprintf("aro-aks-cluster-%03d", shard)
aksClusters := managedClustersClient.List(ctx)

Просмотреть файл

@ -16,7 +16,7 @@ import (
fake "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice/v6/fake"
"github.com/Azure/ARO-RP/pkg/util/azureclient"
"github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/containerservice"
utilcontainerservice "github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/armcontainerservice"
)
//go:embed testdata
@ -87,7 +87,7 @@ func TestProdHiveAdmin(t *testing.T) {
},
}
mcc, err := containerservice.NewManagedClustersClientWithTransport(&azureclient.PublicCloud, dummySubscription, &azfake.TokenCredential{}, fake.NewManagedClustersServerTransport(&transporter))
mcc, err := utilcontainerservice.NewManagedClustersClientWithTransport(&azureclient.PublicCloud, dummySubscription, &azfake.TokenCredential{}, fake.NewManagedClustersServerTransport(&transporter))
if err != nil {
t.Fatal(err)
}

Просмотреть файл

@ -9,7 +9,7 @@ import (
"k8s.io/client-go/rest"
"github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/containerservice"
utilcontainerservice "github.com/Azure/ARO-RP/pkg/util/azureclient/azuresdk/armcontainerservice"
)
const (
@ -30,13 +30,13 @@ type Manager interface {
type dev struct {
location string
managedClustersClient containerservice.ManagedClustersClient
managedClustersClient utilcontainerservice.ManagedClustersClient
hiveCredentialsMutex sync.RWMutex
cachedCredentials map[int]*rest.Config
}
func NewDev(location string, managedClustersClient containerservice.ManagedClustersClient) Manager {
func NewDev(location string, managedClustersClient utilcontainerservice.ManagedClustersClient) Manager {
return &dev{location: location,
managedClustersClient: managedClustersClient,
cachedCredentials: make(map[int]*rest.Config),
@ -46,13 +46,13 @@ func NewDev(location string, managedClustersClient containerservice.ManagedClust
type prod struct {
location string
managedClustersClient containerservice.ManagedClustersClient
managedClustersClient utilcontainerservice.ManagedClustersClient
hiveCredentialsMutex sync.RWMutex
cachedCredentials map[int]*rest.Config
}
func NewProd(location string, managedClustersClient containerservice.ManagedClustersClient) Manager {
func NewProd(location string, managedClustersClient utilcontainerservice.ManagedClustersClient) Manager {
return &prod{
location: location,
managedClustersClient: managedClustersClient,

Просмотреть файл

@ -1,71 +0,0 @@
// Code generated by MockGen. DO NOT EDIT.
// Source: github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/containerservice (interfaces: ManagedClustersClient)
//
// Generated by this command:
//
// mockgen -destination=../../../../util/mocks/azureclient/mgmt/containerservice/containerservice.go github.com/Azure/ARO-RP/pkg/util/azureclient/mgmt/containerservice ManagedClustersClient
//
// Package mock_containerservice is a generated GoMock package.
package mock_containerservice
import (
context "context"
reflect "reflect"
containerservice "github.com/Azure/azure-sdk-for-go/services/containerservice/mgmt/2021-10-01/containerservice"
gomock "go.uber.org/mock/gomock"
)
// MockManagedClustersClient is a mock of ManagedClustersClient interface.
type MockManagedClustersClient struct {
ctrl *gomock.Controller
recorder *MockManagedClustersClientMockRecorder
}
// MockManagedClustersClientMockRecorder is the mock recorder for MockManagedClustersClient.
type MockManagedClustersClientMockRecorder struct {
mock *MockManagedClustersClient
}
// NewMockManagedClustersClient creates a new mock instance.
func NewMockManagedClustersClient(ctrl *gomock.Controller) *MockManagedClustersClient {
mock := &MockManagedClustersClient{ctrl: ctrl}
mock.recorder = &MockManagedClustersClientMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockManagedClustersClient) EXPECT() *MockManagedClustersClientMockRecorder {
return m.recorder
}
// List mocks base method.
func (m *MockManagedClustersClient) List(arg0 context.Context) (containerservice.ManagedClusterListResultPage, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "List", arg0)
ret0, _ := ret[0].(containerservice.ManagedClusterListResultPage)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// List indicates an expected call of List.
func (mr *MockManagedClustersClientMockRecorder) List(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "List", reflect.TypeOf((*MockManagedClustersClient)(nil).List), arg0)
}
// ListClusterAdminCredentials mocks base method.
func (m *MockManagedClustersClient) ListClusterAdminCredentials(arg0 context.Context, arg1, arg2, arg3 string) (containerservice.CredentialResults, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListClusterAdminCredentials", arg0, arg1, arg2, arg3)
ret0, _ := ret[0].(containerservice.CredentialResults)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ListClusterAdminCredentials indicates an expected call of ListClusterAdminCredentials.
func (mr *MockManagedClustersClientMockRecorder) ListClusterAdminCredentials(arg0, arg1, arg2, arg3 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListClusterAdminCredentials", reflect.TypeOf((*MockManagedClustersClient)(nil).ListClusterAdminCredentials), arg0, arg1, arg2, arg3)
}