From f4df4067bd378df12f6e50a7bf46d9971b5baff5 Mon Sep 17 00:00:00 2001 From: Paul Meyer <49727155+katexochen@users.noreply.github.com> Date: Fri, 6 Jan 2023 16:26:30 +0100 Subject: [PATCH] deps: upgrade Azure sdk (#887) Signed-off-by: Paul Meyer <49727155+katexochen@users.noreply.github.com> --- go.mod | 6 +- go.sum | 9 +- hack/build-manifest/azure/client.go | 2 +- hack/go.mod | 13 +-- hack/go.sum | 10 +- internal/cloud/azure/cloud.go | 12 +- internal/cloud/azure/cloud_test.go | 108 +++++++++--------- internal/cloud/azure/interface.go | 16 +-- operators/constellation-node-operator/go.mod | 4 +- operators/constellation-node-operator/go.sum | 10 +- .../internal/cloud/azure/client/api.go | 34 +++--- .../internal/cloud/azure/client/client.go | 6 +- .../cloud/azure/client/client_test.go | 88 +++++++------- .../cloud/azure/client/instanceview.go | 4 +- .../cloud/azure/client/instanceview_test.go | 30 ++--- .../internal/cloud/azure/client/nodeimage.go | 2 +- .../cloud/azure/client/nodeimage_test.go | 66 +++++------ .../cloud/azure/client/pendingnode_test.go | 10 +- .../cloud/azure/client/scalinggroup.go | 2 +- .../cloud/azure/client/scalinggroup_test.go | 38 +++--- 20 files changed, 233 insertions(+), 237 deletions(-) diff --git a/go.mod b/go.mod index 9c5ee089a..18ec6cf10 100644 --- a/go.mod +++ b/go.mod @@ -44,9 +44,8 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.9.0 github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.11.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2 v2.0.0 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.1.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.1.0 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.6.1 github.com/Azure/go-autorest/autorest/to v0.4.0 github.com/aws/aws-sdk-go-v2 v1.17.3 @@ -117,8 +116,9 @@ require ( cloud.google.com/go/iam v0.8.0 // indirect cloud.google.com/go/longrunning v0.3.0 // indirect code.cloudfoundry.org/clock v0.0.0-20180518195852-02e53af36e6c // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0 // indirect + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.1.0 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect github.com/AzureAD/microsoft-authentication-library-for-go v0.7.0 // indirect diff --git a/go.sum b/go.sum index 7cab459da..9b2d13974 100644 --- a/go.sum +++ b/go.sum @@ -92,8 +92,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0 h1:sVW/AFBTGyJxDaMYlq0ct3jUX github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1 h1:XUNQ4mw+zJmaA2KXzP9JlQiecy1SI+Eog7xVkPiqIbg= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 h1:+5VZ72z0Qan5Bog5C+ZkgSqUbeVUd9wgtHOrIKuc5b8= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.9.0 h1:TOFrNxfjslms5nLLIMjW7N0+zSALX4KiGsptmpb16AA= github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.9.0/go.mod h1:EAyXOW1F6BTJPiK2pDvmnvxOHPxoTYWoqBeIlql+QhI= github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.11.0 h1:82w8tzLcOwDP/Q35j/wEBPt0n0kVC3cjtPdD62G8UAk= @@ -102,15 +102,14 @@ github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0 h1:Lg6BW0VPmCwcMl github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0/go.mod h1:9V2j0jn9jDEkCkv8w/bKTNppX/d0FVA1ud77xCIP4KA= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights v1.0.0 h1:BpGGvzarSyE7kQF1x1hptUcGmNzZEE3yYI+uqBSNRxk= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights v1.0.0/go.mod h1:1ijUM40peD7YK5MFEJja2wjjp4eimFNWv0NXoY3nsZM= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0 h1:/Di3vB4sNeQ+7A8efjUVENvyB945Wruvstucqp7ZArg= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2 v2.0.0 h1:xxe4naFUPYEW1W6C8yWrfFNmyZLnEbO+CsbsSF83wDo= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2 v2.0.0/go.mod h1:aLFjumYDvv63tH1qnqkcmdjdZ6Sn+/viPv7H3jft0oY= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3 v3.0.1 h1:H3g2mkmu105ON0c/Gqx3Bm+bzoIijLom8LmV9Gjn7X0= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0 h1:KepfQdVTTQl/UmAbRALdkUUUfcWfu8xRaqrQ03ZGwvM= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0/go.mod h1:Q3u+T/qw3Kb1Wf3DFKiFwEZlyaAyPb4yBgWm9wq7yh8= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0 h1:lMW1lD/17LUA5z1XTURo7LcVG2ICBPlyMHjIUrcFZNQ= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.1.0 h1:QM6sE5k2ZT/vI5BEe0r7mqjsUSnhVBFbOsVkEuaEfiA= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.1.0/go.mod h1:243D9iHbcQXoFUtgHJwL7gl2zx1aDuDMjvBZVGr2uW0= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.1.0 h1:mk57wRUA8fyjFxVcPPGv4shLcWDXPFYokTJL9zJxQtE= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2 v2.1.0/go.mod h1:mU96hbp8qJDA9OzTV1Ji7wCyPyaqC5kI6ZPsZfJ8sE4= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.6.1 h1:YvQv9Mz6T8oR5ypQOL6erY0Z5t71ak1uHV4QFokCOZk= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.6.1/go.mod h1:c6WvOhtmjNUWbLfOG1qxM/q0SPvQNSVJvolm+C52dIU= diff --git a/hack/build-manifest/azure/client.go b/hack/build-manifest/azure/client.go index c3a2351ba..bc153a452 100644 --- a/hack/build-manifest/azure/client.go +++ b/hack/build-manifest/azure/client.go @@ -13,7 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" "github.com/edgelesssys/constellation/v2/internal/logger" ) diff --git a/hack/go.mod b/hack/go.mod index 10380e82a..cddbf1325 100644 --- a/hack/go.mod +++ b/hack/go.mod @@ -36,7 +36,7 @@ require ( cloud.google.com/go/compute v1.14.0 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2 v2.0.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0 github.com/edgelesssys/constellation/v2 v2.0.0 github.com/fatih/color v1.13.0 github.com/go-git/go-git/v5 v5.5.1 @@ -56,19 +56,13 @@ require ( libvirt.org/go/libvirtxml v1.8009.0 ) -require ( - github.com/google/go-sev-guest v0.4.1 // indirect - github.com/google/logger v1.1.1 // indirect - github.com/pborman/uuid v1.2.0 // indirect -) - require ( cloud.google.com/go v0.107.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v0.8.0 // indirect cloud.google.com/go/kms v1.7.0 // indirect cloud.google.com/go/storage v1.28.1 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.9.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.11.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0 // indirect @@ -158,9 +152,11 @@ require ( github.com/google/go-attestation v0.4.4-0.20221011162210-17f9c05652a9 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/go-containerregistry v0.12.1 // indirect + github.com/google/go-sev-guest v0.4.1 // indirect github.com/google/go-tpm v0.3.3 // indirect github.com/google/go-tspi v0.3.0 // indirect github.com/google/gofuzz v1.2.0 // indirect + github.com/google/logger v1.1.1 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/tink/go v1.7.0 // indirect github.com/google/trillian v1.5.0 // indirect @@ -219,6 +215,7 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/pborman/uuid v1.2.0 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect github.com/pjbgf/sha1cd v0.2.3 // indirect github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect diff --git a/hack/go.sum b/hack/go.sum index 41b3c9de9..a088c371f 100644 --- a/hack/go.sum +++ b/hack/go.sum @@ -89,17 +89,17 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0 h1:sVW/AFBTGyJxDaMYlq0ct3jUX github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1 h1:XUNQ4mw+zJmaA2KXzP9JlQiecy1SI+Eog7xVkPiqIbg= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 h1:+5VZ72z0Qan5Bog5C+ZkgSqUbeVUd9wgtHOrIKuc5b8= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.9.0 h1:TOFrNxfjslms5nLLIMjW7N0+zSALX4KiGsptmpb16AA= github.com/Azure/azure-sdk-for-go/sdk/keyvault/azkeys v0.9.0/go.mod h1:EAyXOW1F6BTJPiK2pDvmnvxOHPxoTYWoqBeIlql+QhI= github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.11.0 h1:82w8tzLcOwDP/Q35j/wEBPt0n0kVC3cjtPdD62G8UAk= github.com/Azure/azure-sdk-for-go/sdk/keyvault/azsecrets v0.11.0/go.mod h1:S78i9yTr4o/nXlH76bKjGUye9Z2wSxO5Tz7GoDr4vfI= github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0 h1:Lg6BW0VPmCwcMlvOviL3ruHFO+H9tZNqscK0AeuFjGM= github.com/Azure/azure-sdk-for-go/sdk/keyvault/internal v0.7.0/go.mod h1:9V2j0jn9jDEkCkv8w/bKTNppX/d0FVA1ud77xCIP4KA= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0 h1:/Di3vB4sNeQ+7A8efjUVENvyB945Wruvstucqp7ZArg= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2 v2.0.0 h1:xxe4naFUPYEW1W6C8yWrfFNmyZLnEbO+CsbsSF83wDo= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2 v2.0.0/go.mod h1:aLFjumYDvv63tH1qnqkcmdjdZ6Sn+/viPv7H3jft0oY= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3 v3.0.1 h1:H3g2mkmu105ON0c/Gqx3Bm+bzoIijLom8LmV9Gjn7X0= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0 h1:KepfQdVTTQl/UmAbRALdkUUUfcWfu8xRaqrQ03ZGwvM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0/go.mod h1:Q3u+T/qw3Kb1Wf3DFKiFwEZlyaAyPb4yBgWm9wq7yh8= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0 h1:lMW1lD/17LUA5z1XTURo7LcVG2ICBPlyMHjIUrcFZNQ= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.1.0 h1:QM6sE5k2ZT/vI5BEe0r7mqjsUSnhVBFbOsVkEuaEfiA= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= diff --git a/internal/cloud/azure/cloud.go b/internal/cloud/azure/cloud.go index c6316f707..1d654fbb2 100644 --- a/internal/cloud/azure/cloud.go +++ b/internal/cloud/azure/cloud.go @@ -15,8 +15,8 @@ import ( "path" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" "github.com/edgelesssys/constellation/v2/internal/cloud" "github.com/edgelesssys/constellation/v2/internal/cloud/azureshared" "github.com/edgelesssys/constellation/v2/internal/cloud/metadata" @@ -68,7 +68,7 @@ func New(ctx context.Context) (*Cloud, error) { if err != nil { return nil, err } - scaleSetsAPI, err := armcomputev2.NewVirtualMachineScaleSetsClient(subscriptionID, cred, nil) + scaleSetsAPI, err := armcompute.NewVirtualMachineScaleSetsClient(subscriptionID, cred, nil) if err != nil { return nil, err } @@ -76,7 +76,7 @@ func New(ctx context.Context) (*Cloud, error) { if err != nil { return nil, err } - virtualMachineScaleSetVMsAPI, err := armcomputev2.NewVirtualMachineScaleSetVMsClient(subscriptionID, cred, nil) + virtualMachineScaleSetVMsAPI, err := armcompute.NewVirtualMachineScaleSetVMsClient(subscriptionID, cred, nil) if err != nil { return nil, err } @@ -354,7 +354,7 @@ func (c *Cloud) getSubnetworkCIDR(ctx context.Context) (string, error) { } // getVMInterfaces retrieves all network interfaces referenced by a scale set virtual machine. -func (c *Cloud) getVMInterfaces(ctx context.Context, vm armcomputev2.VirtualMachineScaleSetVM, resourceGroup, scaleSet, instanceID string) ([]armnetwork.Interface, error) { +func (c *Cloud) getVMInterfaces(ctx context.Context, vm armcompute.VirtualMachineScaleSetVM, resourceGroup, scaleSet, instanceID string) ([]armnetwork.Interface, error) { if vm.Properties == nil || vm.Properties.NetworkProfile == nil { return []armnetwork.Interface{}, errors.New("no network profile found") } @@ -399,7 +399,7 @@ type cloudConfig struct { } // convertToInstanceMetadata converts a armcomputev2.VirtualMachineScaleSetVM to a metadata.InstanceMetadata. -func convertToInstanceMetadata(vm armcomputev2.VirtualMachineScaleSetVM, networkInterfaces []armnetwork.Interface, +func convertToInstanceMetadata(vm armcompute.VirtualMachineScaleSetVM, networkInterfaces []armnetwork.Interface, ) (metadata.InstanceMetadata, error) { if vm.ID == nil { return metadata.InstanceMetadata{}, errors.New("missing instance ID") diff --git a/internal/cloud/azure/cloud_test.go b/internal/cloud/azure/cloud_test.go index 5c5338191..0b9371ac2 100644 --- a/internal/cloud/azure/cloud_test.go +++ b/internal/cloud/azure/cloud_test.go @@ -14,8 +14,8 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" "github.com/edgelesssys/constellation/v2/internal/cloud" "github.com/edgelesssys/constellation/v2/internal/cloud/metadata" "github.com/edgelesssys/constellation/v2/internal/role" @@ -322,15 +322,15 @@ func TestGetInstance(t *testing.T) { someErr := errors.New("failed") sampleProviderID := "azure:///subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name/virtualMachines/instance-id" successVMAPI := &stubVirtualMachineScaleSetVMsAPI{ - getVM: armcomputev2.VirtualMachineScaleSetVM{ + getVM: armcompute.VirtualMachineScaleSetVM{ Name: to.Ptr("scale-set-name-instance-id"), ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name/virtualMachines/instance-id"), - Properties: &armcomputev2.VirtualMachineScaleSetVMProperties{ - OSProfile: &armcomputev2.OSProfile{ + Properties: &armcompute.VirtualMachineScaleSetVMProperties{ + OSProfile: &armcompute.OSProfile{ ComputerName: to.Ptr("scale-set-name-instance-id"), }, - NetworkProfile: &armcomputev2.NetworkProfile{ - NetworkInterfaces: []*armcomputev2.NetworkInterfaceReference{ + NetworkProfile: &armcompute.NetworkProfile{ + NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ { ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Network/networkInterfaces/nic-name"), }, @@ -379,15 +379,15 @@ func TestGetInstance(t *testing.T) { }, "success control-plane": { scaleSetsVMAPI: &stubVirtualMachineScaleSetVMsAPI{ - getVM: armcomputev2.VirtualMachineScaleSetVM{ + getVM: armcompute.VirtualMachineScaleSetVM{ Name: to.Ptr("scale-set-name-instance-id"), ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name/virtualMachines/instance-id"), - Properties: &armcomputev2.VirtualMachineScaleSetVMProperties{ - OSProfile: &armcomputev2.OSProfile{ + Properties: &armcompute.VirtualMachineScaleSetVMProperties{ + OSProfile: &armcompute.OSProfile{ ComputerName: to.Ptr("scale-set-name-instance-id"), }, - NetworkProfile: &armcomputev2.NetworkProfile{ - NetworkInterfaces: []*armcomputev2.NetworkInterfaceReference{ + NetworkProfile: &armcompute.NetworkProfile{ + NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ { ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Network/networkInterfaces/nic-name"), }, @@ -543,7 +543,7 @@ func TestList(t *testing.T) { } scaleSetsResponse := &stubScaleSetsAPI{ pager: &stubVirtualMachineScaleSetsClientListPager{ - list: []armcomputev2.VirtualMachineScaleSet{{ + list: []armcompute.VirtualMachineScaleSet{{ Name: to.Ptr("scale-set"), Tags: map[string]*string{ cloud.TagUID: to.Ptr("uid"), @@ -552,19 +552,19 @@ func TestList(t *testing.T) { }}, }, } - scaleSetVM := armcomputev2.VirtualMachineScaleSetVM{ + scaleSetVM := armcompute.VirtualMachineScaleSetVM{ Name: to.Ptr("scale-set_0"), InstanceID: to.Ptr("instance-id"), ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set/virtualMachines/0"), - Properties: &armcomputev2.VirtualMachineScaleSetVMProperties{ - NetworkProfile: &armcomputev2.NetworkProfile{ - NetworkInterfaces: []*armcomputev2.NetworkInterfaceReference{ + Properties: &armcompute.VirtualMachineScaleSetVMProperties{ + NetworkProfile: &armcompute.NetworkProfile{ + NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ { ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set/virtualMachines/0/networkInterfaces/interface-name"), }, }, }, - OSProfile: &armcomputev2.OSProfile{ + OSProfile: &armcompute.OSProfile{ ComputerName: to.Ptr("scale-set-0"), }, }, @@ -598,7 +598,7 @@ func TestList(t *testing.T) { scaleSetsAPI: scaleSetsResponse, scaleSetsVMAPI: &stubVirtualMachineScaleSetVMsAPI{ pager: &stubVirtualMachineScaleSetVMPager{ - list: []armcomputev2.VirtualMachineScaleSetVM{scaleSetVM}, + list: []armcompute.VirtualMachineScaleSetVM{scaleSetVM}, }, }, wantInstances: []metadata.InstanceMetadata{workerInstance}, @@ -612,21 +612,21 @@ func TestList(t *testing.T) { scaleSetsAPI: scaleSetsResponse, scaleSetsVMAPI: &stubVirtualMachineScaleSetVMsAPI{ pager: &stubVirtualMachineScaleSetVMPager{ - list: []armcomputev2.VirtualMachineScaleSetVM{ + list: []armcompute.VirtualMachineScaleSetVM{ scaleSetVM, { Name: to.Ptr("control-set_0"), InstanceID: to.Ptr("0"), ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/control-set/virtualMachines/0"), - Properties: &armcomputev2.VirtualMachineScaleSetVMProperties{ - NetworkProfile: &armcomputev2.NetworkProfile{ - NetworkInterfaces: []*armcomputev2.NetworkInterfaceReference{ + Properties: &armcompute.VirtualMachineScaleSetVMProperties{ + NetworkProfile: &armcompute.NetworkProfile{ + NetworkInterfaces: []*armcompute.NetworkInterfaceReference{ { ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/control-set/virtualMachines/0/networkInterfaces/interface-name"), }, }, }, - OSProfile: &armcomputev2.OSProfile{ + OSProfile: &armcompute.OSProfile{ ComputerName: to.Ptr("control-set-0"), }, }, @@ -657,7 +657,7 @@ func TestList(t *testing.T) { scaleSetsAPI: scaleSetsResponse, scaleSetsVMAPI: &stubVirtualMachineScaleSetVMsAPI{ pager: &stubVirtualMachineScaleSetVMPager{ - list: []armcomputev2.VirtualMachineScaleSetVM{scaleSetVM}, + list: []armcompute.VirtualMachineScaleSetVM{scaleSetVM}, }, }, wantErr: true, @@ -671,7 +671,7 @@ func TestList(t *testing.T) { scaleSetsAPI: scaleSetsResponse, scaleSetsVMAPI: &stubVirtualMachineScaleSetVMsAPI{ pager: &stubVirtualMachineScaleSetVMPager{ - list: []armcomputev2.VirtualMachineScaleSetVM{scaleSetVM}, + list: []armcompute.VirtualMachineScaleSetVM{scaleSetVM}, }, }, wantErr: true, @@ -1050,26 +1050,26 @@ func (a *stubIMDSAPI) initSecretHash(ctx context.Context) (string, error) { } type stubVirtualMachineScaleSetVMPager struct { - list []armcomputev2.VirtualMachineScaleSetVM + list []armcompute.VirtualMachineScaleSetVM fetchErr error more bool } -func (p *stubVirtualMachineScaleSetVMPager) moreFunc() func(armcomputev2.VirtualMachineScaleSetVMsClientListResponse) bool { - return func(armcomputev2.VirtualMachineScaleSetVMsClientListResponse) bool { +func (p *stubVirtualMachineScaleSetVMPager) moreFunc() func(armcompute.VirtualMachineScaleSetVMsClientListResponse) bool { + return func(armcompute.VirtualMachineScaleSetVMsClientListResponse) bool { return p.more } } -func (p *stubVirtualMachineScaleSetVMPager) fetcherFunc() func(context.Context, *armcomputev2.VirtualMachineScaleSetVMsClientListResponse, -) (armcomputev2.VirtualMachineScaleSetVMsClientListResponse, error) { - return func(context.Context, *armcomputev2.VirtualMachineScaleSetVMsClientListResponse) (armcomputev2.VirtualMachineScaleSetVMsClientListResponse, error) { - page := make([]*armcomputev2.VirtualMachineScaleSetVM, len(p.list)) +func (p *stubVirtualMachineScaleSetVMPager) fetcherFunc() func(context.Context, *armcompute.VirtualMachineScaleSetVMsClientListResponse, +) (armcompute.VirtualMachineScaleSetVMsClientListResponse, error) { + return func(context.Context, *armcompute.VirtualMachineScaleSetVMsClientListResponse) (armcompute.VirtualMachineScaleSetVMsClientListResponse, error) { + page := make([]*armcompute.VirtualMachineScaleSetVM, len(p.list)) for i := range p.list { page[i] = &p.list[i] } - return armcomputev2.VirtualMachineScaleSetVMsClientListResponse{ - VirtualMachineScaleSetVMListResult: armcomputev2.VirtualMachineScaleSetVMListResult{ + return armcompute.VirtualMachineScaleSetVMsClientListResponse{ + VirtualMachineScaleSetVMListResult: armcompute.VirtualMachineScaleSetVMListResult{ Value: page, }, }, p.fetchErr @@ -1077,21 +1077,21 @@ func (p *stubVirtualMachineScaleSetVMPager) fetcherFunc() func(context.Context, } type stubVirtualMachineScaleSetVMsAPI struct { - getVM armcomputev2.VirtualMachineScaleSetVM + getVM armcompute.VirtualMachineScaleSetVM getErr error pager *stubVirtualMachineScaleSetVMPager } -func (a *stubVirtualMachineScaleSetVMsAPI) Get(context.Context, string, string, string, *armcomputev2.VirtualMachineScaleSetVMsClientGetOptions, -) (armcomputev2.VirtualMachineScaleSetVMsClientGetResponse, error) { - return armcomputev2.VirtualMachineScaleSetVMsClientGetResponse{ +func (a *stubVirtualMachineScaleSetVMsAPI) Get(context.Context, string, string, string, *armcompute.VirtualMachineScaleSetVMsClientGetOptions, +) (armcompute.VirtualMachineScaleSetVMsClientGetResponse, error) { + return armcompute.VirtualMachineScaleSetVMsClientGetResponse{ VirtualMachineScaleSetVM: a.getVM, }, a.getErr } -func (a *stubVirtualMachineScaleSetVMsAPI) NewListPager(string, string, *armcomputev2.VirtualMachineScaleSetVMsClientListOptions, -) *runtime.Pager[armcomputev2.VirtualMachineScaleSetVMsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[armcomputev2.VirtualMachineScaleSetVMsClientListResponse]{ +func (a *stubVirtualMachineScaleSetVMsAPI) NewListPager(string, string, *armcompute.VirtualMachineScaleSetVMsClientListOptions, +) *runtime.Pager[armcompute.VirtualMachineScaleSetVMsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[armcompute.VirtualMachineScaleSetVMsClientListResponse]{ More: a.pager.moreFunc(), Fetcher: a.pager.fetcherFunc(), }) @@ -1118,26 +1118,26 @@ func (a *stubNetworkInterfacesAPI) Get(context.Context, string, string, *armnetw } type stubVirtualMachineScaleSetsClientListPager struct { - list []armcomputev2.VirtualMachineScaleSet + list []armcompute.VirtualMachineScaleSet fetchErr error more bool } -func (p *stubVirtualMachineScaleSetsClientListPager) moreFunc() func(armcomputev2.VirtualMachineScaleSetsClientListResponse) bool { - return func(armcomputev2.VirtualMachineScaleSetsClientListResponse) bool { +func (p *stubVirtualMachineScaleSetsClientListPager) moreFunc() func(armcompute.VirtualMachineScaleSetsClientListResponse) bool { + return func(armcompute.VirtualMachineScaleSetsClientListResponse) bool { return p.more } } -func (p *stubVirtualMachineScaleSetsClientListPager) fetcherFunc() func(context.Context, *armcomputev2.VirtualMachineScaleSetsClientListResponse, -) (armcomputev2.VirtualMachineScaleSetsClientListResponse, error) { - return func(context.Context, *armcomputev2.VirtualMachineScaleSetsClientListResponse) (armcomputev2.VirtualMachineScaleSetsClientListResponse, error) { - page := make([]*armcomputev2.VirtualMachineScaleSet, len(p.list)) +func (p *stubVirtualMachineScaleSetsClientListPager) fetcherFunc() func(context.Context, *armcompute.VirtualMachineScaleSetsClientListResponse, +) (armcompute.VirtualMachineScaleSetsClientListResponse, error) { + return func(context.Context, *armcompute.VirtualMachineScaleSetsClientListResponse) (armcompute.VirtualMachineScaleSetsClientListResponse, error) { + page := make([]*armcompute.VirtualMachineScaleSet, len(p.list)) for i := range p.list { page[i] = &p.list[i] } - return armcomputev2.VirtualMachineScaleSetsClientListResponse{ - VirtualMachineScaleSetListResult: armcomputev2.VirtualMachineScaleSetListResult{ + return armcompute.VirtualMachineScaleSetsClientListResponse{ + VirtualMachineScaleSetListResult: armcompute.VirtualMachineScaleSetListResult{ Value: page, }, }, p.fetchErr @@ -1148,9 +1148,9 @@ type stubScaleSetsAPI struct { pager *stubVirtualMachineScaleSetsClientListPager } -func (a *stubScaleSetsAPI) NewListPager(string, *armcomputev2.VirtualMachineScaleSetsClientListOptions, -) *runtime.Pager[armcomputev2.VirtualMachineScaleSetsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[armcomputev2.VirtualMachineScaleSetsClientListResponse]{ +func (a *stubScaleSetsAPI) NewListPager(string, *armcompute.VirtualMachineScaleSetsClientListOptions, +) *runtime.Pager[armcompute.VirtualMachineScaleSetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[armcompute.VirtualMachineScaleSetsClientListResponse]{ More: a.pager.moreFunc(), Fetcher: a.pager.fetcherFunc(), }) diff --git a/internal/cloud/azure/interface.go b/internal/cloud/azure/interface.go index 7e0b9228e..3935f8c9b 100644 --- a/internal/cloud/azure/interface.go +++ b/internal/cloud/azure/interface.go @@ -11,8 +11,8 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/applicationinsights/armapplicationinsights" - armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v2" ) type imdsAPI interface { @@ -58,16 +58,16 @@ type publicIPAddressesAPI interface { type virtualMachineScaleSetVMsAPI interface { Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, - options *armcomputev2.VirtualMachineScaleSetVMsClientGetOptions, - ) (armcomputev2.VirtualMachineScaleSetVMsClientGetResponse, error) + options *armcompute.VirtualMachineScaleSetVMsClientGetOptions, + ) (armcompute.VirtualMachineScaleSetVMsClientGetResponse, error) NewListPager(resourceGroupName string, virtualMachineScaleSetName string, - options *armcomputev2.VirtualMachineScaleSetVMsClientListOptions, - ) *runtime.Pager[armcomputev2.VirtualMachineScaleSetVMsClientListResponse] + options *armcompute.VirtualMachineScaleSetVMsClientListOptions, + ) *runtime.Pager[armcompute.VirtualMachineScaleSetVMsClientListResponse] } type scaleSetsAPI interface { - NewListPager(resourceGroupName string, options *armcomputev2.VirtualMachineScaleSetsClientListOptions, - ) *runtime.Pager[armcomputev2.VirtualMachineScaleSetsClientListResponse] + NewListPager(resourceGroupName string, options *armcompute.VirtualMachineScaleSetsClientListOptions, + ) *runtime.Pager[armcompute.VirtualMachineScaleSetsClientListResponse] } type loadBalancerAPI interface { diff --git a/operators/constellation-node-operator/go.mod b/operators/constellation-node-operator/go.mod index 8fbd684b4..643d03260 100644 --- a/operators/constellation-node-operator/go.mod +++ b/operators/constellation-node-operator/go.mod @@ -8,7 +8,7 @@ require ( cloud.google.com/go/compute v1.14.0 github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 - github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2 v2.0.0 + github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0 github.com/googleapis/gax-go/v2 v2.7.0 github.com/medik8s/node-maintenance-operator v0.13.1 github.com/onsi/ginkgo v1.16.5 @@ -30,7 +30,7 @@ require ( require ( cloud.google.com/go/compute/metadata v0.2.3 // indirect - github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 // indirect github.com/Azure/go-autorest v14.2.0+incompatible // indirect github.com/Azure/go-autorest/autorest v0.11.27 // indirect github.com/Azure/go-autorest/autorest/adal v0.9.20 // indirect diff --git a/operators/constellation-node-operator/go.sum b/operators/constellation-node-operator/go.sum index ae50b59c7..4065bddff 100644 --- a/operators/constellation-node-operator/go.sum +++ b/operators/constellation-node-operator/go.sum @@ -46,11 +46,11 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0 h1:sVW/AFBTGyJxDaMYlq0ct3jUX github.com/Azure/azure-sdk-for-go/sdk/azcore v1.2.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 h1:t/W5MYAuQy81cvM8VUNfRLzhtKpXhVUAN7Cd7KVbTyc= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0/go.mod h1:NBanQUfSWiWn3QEpWDTCU0IjBECKOYvl2R8xdRtMtiM= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1 h1:XUNQ4mw+zJmaA2KXzP9JlQiecy1SI+Eog7xVkPiqIbg= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.1/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute v1.0.0 h1:/Di3vB4sNeQ+7A8efjUVENvyB945Wruvstucqp7ZArg= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2 v2.0.0 h1:xxe4naFUPYEW1W6C8yWrfFNmyZLnEbO+CsbsSF83wDo= -github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2 v2.0.0/go.mod h1:aLFjumYDvv63tH1qnqkcmdjdZ6Sn+/viPv7H3jft0oY= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2 h1:+5VZ72z0Qan5Bog5C+ZkgSqUbeVUd9wgtHOrIKuc5b8= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.1.2/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v3 v3.0.1 h1:H3g2mkmu105ON0c/Gqx3Bm+bzoIijLom8LmV9Gjn7X0= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0 h1:KepfQdVTTQl/UmAbRALdkUUUfcWfu8xRaqrQ03ZGwvM= +github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4 v4.0.0/go.mod h1:Q3u+T/qw3Kb1Wf3DFKiFwEZlyaAyPb4yBgWm9wq7yh8= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal v1.0.0 h1:lMW1lD/17LUA5z1XTURo7LcVG2ICBPlyMHjIUrcFZNQ= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork v1.1.0 h1:QM6sE5k2ZT/vI5BEe0r7mqjsUSnhVBFbOsVkEuaEfiA= github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.0.0 h1:ECsQtyERDVz3NP3kvDOTLvbQhqWp/x9EsGKtb4ogUr8= diff --git a/operators/constellation-node-operator/internal/cloud/azure/client/api.go b/operators/constellation-node-operator/internal/cloud/azure/client/api.go index f94015ab9..8b8ed01bf 100644 --- a/operators/constellation-node-operator/internal/cloud/azure/client/api.go +++ b/operators/constellation-node-operator/internal/cloud/azure/client/api.go @@ -10,34 +10,34 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/internal/poller" ) type virtualMachineScaleSetVMsAPI interface { Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, - options *armcomputev2.VirtualMachineScaleSetVMsClientGetOptions, - ) (armcomputev2.VirtualMachineScaleSetVMsClientGetResponse, error) + options *armcompute.VirtualMachineScaleSetVMsClientGetOptions, + ) (armcompute.VirtualMachineScaleSetVMsClientGetResponse, error) GetInstanceView(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, - options *armcomputev2.VirtualMachineScaleSetVMsClientGetInstanceViewOptions, - ) (armcomputev2.VirtualMachineScaleSetVMsClientGetInstanceViewResponse, error) + options *armcompute.VirtualMachineScaleSetVMsClientGetInstanceViewOptions, + ) (armcompute.VirtualMachineScaleSetVMsClientGetInstanceViewResponse, error) NewListPager(resourceGroupName string, virtualMachineScaleSetName string, - options *armcomputev2.VirtualMachineScaleSetVMsClientListOptions, - ) *runtime.Pager[armcomputev2.VirtualMachineScaleSetVMsClientListResponse] + options *armcompute.VirtualMachineScaleSetVMsClientListOptions, + ) *runtime.Pager[armcompute.VirtualMachineScaleSetVMsClientListResponse] } type scaleSetsAPI interface { Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, - options *armcomputev2.VirtualMachineScaleSetsClientGetOptions, - ) (armcomputev2.VirtualMachineScaleSetsClientGetResponse, error) - BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters armcomputev2.VirtualMachineScaleSetUpdate, - options *armcomputev2.VirtualMachineScaleSetsClientBeginUpdateOptions, - ) (*runtime.Poller[armcomputev2.VirtualMachineScaleSetsClientUpdateResponse], error) - BeginDeleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs armcomputev2.VirtualMachineScaleSetVMInstanceRequiredIDs, - options *armcomputev2.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions, - ) (*runtime.Poller[armcomputev2.VirtualMachineScaleSetsClientDeleteInstancesResponse], error) - NewListPager(resourceGroupName string, options *armcomputev2.VirtualMachineScaleSetsClientListOptions, - ) *runtime.Pager[armcomputev2.VirtualMachineScaleSetsClientListResponse] + options *armcompute.VirtualMachineScaleSetsClientGetOptions, + ) (armcompute.VirtualMachineScaleSetsClientGetResponse, error) + BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters armcompute.VirtualMachineScaleSetUpdate, + options *armcompute.VirtualMachineScaleSetsClientBeginUpdateOptions, + ) (*runtime.Poller[armcompute.VirtualMachineScaleSetsClientUpdateResponse], error) + BeginDeleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs, + options *armcompute.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions, + ) (*runtime.Poller[armcompute.VirtualMachineScaleSetsClientDeleteInstancesResponse], error) + NewListPager(resourceGroupName string, options *armcompute.VirtualMachineScaleSetsClientListOptions, + ) *runtime.Pager[armcompute.VirtualMachineScaleSetsClientListResponse] } type capacityPoller interface { diff --git a/operators/constellation-node-operator/internal/cloud/azure/client/client.go b/operators/constellation-node-operator/internal/cloud/azure/client/client.go index 0ff999c1c..5e0bf70ef 100644 --- a/operators/constellation-node-operator/internal/cloud/azure/client/client.go +++ b/operators/constellation-node-operator/internal/cloud/azure/client/client.go @@ -8,7 +8,7 @@ package client import ( "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/internal/poller" "github.com/spf13/afero" ) @@ -34,11 +34,11 @@ func NewFromDefault(configPath string) (*Client, error) { return nil, err } - scaleSetAPI, err := armcomputev2.NewVirtualMachineScaleSetsClient(config.SubscriptionID, cred, nil) + scaleSetAPI, err := armcompute.NewVirtualMachineScaleSetsClient(config.SubscriptionID, cred, nil) if err != nil { return nil, err } - virtualMachineScaleSetVMsAPI, err := armcomputev2.NewVirtualMachineScaleSetVMsClient(config.SubscriptionID, cred, nil) + virtualMachineScaleSetVMsAPI, err := armcompute.NewVirtualMachineScaleSetVMsClient(config.SubscriptionID, cred, nil) if err != nil { return nil, err } diff --git a/operators/constellation-node-operator/internal/cloud/azure/client/client_test.go b/operators/constellation-node-operator/internal/cloud/azure/client/client_test.go index 03e47dfcd..1e17bd598 100644 --- a/operators/constellation-node-operator/internal/cloud/azure/client/client_test.go +++ b/operators/constellation-node-operator/internal/cloud/azure/client/client_test.go @@ -11,31 +11,31 @@ import ( "net/http" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" ) type stubScaleSetsAPI struct { - scaleSet armcomputev2.VirtualMachineScaleSetsClientGetResponse + scaleSet armcompute.VirtualMachineScaleSetsClientGetResponse getErr error - updateResponse armcomputev2.VirtualMachineScaleSetsClientUpdateResponse + updateResponse armcompute.VirtualMachineScaleSetsClientUpdateResponse updateErr error - deleteResponse armcomputev2.VirtualMachineScaleSetsClientDeleteInstancesResponse + deleteResponse armcompute.VirtualMachineScaleSetsClientDeleteInstancesResponse deleteErr error resultErr error pager *stubVMSSPager } func (a *stubScaleSetsAPI) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, - options *armcomputev2.VirtualMachineScaleSetsClientGetOptions, -) (armcomputev2.VirtualMachineScaleSetsClientGetResponse, error) { + options *armcompute.VirtualMachineScaleSetsClientGetOptions, +) (armcompute.VirtualMachineScaleSetsClientGetResponse, error) { return a.scaleSet, a.getErr } -func (a *stubScaleSetsAPI) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters armcomputev2.VirtualMachineScaleSetUpdate, - options *armcomputev2.VirtualMachineScaleSetsClientBeginUpdateOptions, -) (*runtime.Poller[armcomputev2.VirtualMachineScaleSetsClientUpdateResponse], error) { - poller, err := runtime.NewPoller(nil, runtime.NewPipeline("", "", runtime.PipelineOptions{}, nil), &runtime.NewPollerOptions[armcomputev2.VirtualMachineScaleSetsClientUpdateResponse]{ - Handler: &stubPoller[armcomputev2.VirtualMachineScaleSetsClientUpdateResponse]{ +func (a *stubScaleSetsAPI) BeginUpdate(ctx context.Context, resourceGroupName string, vmScaleSetName string, parameters armcompute.VirtualMachineScaleSetUpdate, + options *armcompute.VirtualMachineScaleSetsClientBeginUpdateOptions, +) (*runtime.Poller[armcompute.VirtualMachineScaleSetsClientUpdateResponse], error) { + poller, err := runtime.NewPoller(nil, runtime.NewPipeline("", "", runtime.PipelineOptions{}, nil), &runtime.NewPollerOptions[armcompute.VirtualMachineScaleSetsClientUpdateResponse]{ + Handler: &stubPoller[armcompute.VirtualMachineScaleSetsClientUpdateResponse]{ result: a.updateResponse, resultErr: a.resultErr, }, @@ -46,11 +46,11 @@ func (a *stubScaleSetsAPI) BeginUpdate(ctx context.Context, resourceGroupName st return poller, a.updateErr } -func (a *stubScaleSetsAPI) BeginDeleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs armcomputev2.VirtualMachineScaleSetVMInstanceRequiredIDs, - options *armcomputev2.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions, -) (*runtime.Poller[armcomputev2.VirtualMachineScaleSetsClientDeleteInstancesResponse], error) { - poller, err := runtime.NewPoller(nil, runtime.NewPipeline("", "", runtime.PipelineOptions{}, nil), &runtime.NewPollerOptions[armcomputev2.VirtualMachineScaleSetsClientDeleteInstancesResponse]{ - Handler: &stubPoller[armcomputev2.VirtualMachineScaleSetsClientDeleteInstancesResponse]{ +func (a *stubScaleSetsAPI) BeginDeleteInstances(ctx context.Context, resourceGroupName string, vmScaleSetName string, vmInstanceIDs armcompute.VirtualMachineScaleSetVMInstanceRequiredIDs, + options *armcompute.VirtualMachineScaleSetsClientBeginDeleteInstancesOptions, +) (*runtime.Poller[armcompute.VirtualMachineScaleSetsClientDeleteInstancesResponse], error) { + poller, err := runtime.NewPoller(nil, runtime.NewPipeline("", "", runtime.PipelineOptions{}, nil), &runtime.NewPollerOptions[armcompute.VirtualMachineScaleSetsClientDeleteInstancesResponse]{ + Handler: &stubPoller[armcompute.VirtualMachineScaleSetsClientDeleteInstancesResponse]{ result: a.deleteResponse, resultErr: a.resultErr, }, @@ -61,38 +61,38 @@ func (a *stubScaleSetsAPI) BeginDeleteInstances(ctx context.Context, resourceGro return poller, a.deleteErr } -func (a *stubScaleSetsAPI) NewListPager(resourceGroupName string, options *armcomputev2.VirtualMachineScaleSetsClientListOptions, -) *runtime.Pager[armcomputev2.VirtualMachineScaleSetsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[armcomputev2.VirtualMachineScaleSetsClientListResponse]{ +func (a *stubScaleSetsAPI) NewListPager(resourceGroupName string, options *armcompute.VirtualMachineScaleSetsClientListOptions, +) *runtime.Pager[armcompute.VirtualMachineScaleSetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[armcompute.VirtualMachineScaleSetsClientListResponse]{ More: a.pager.moreFunc(), Fetcher: a.pager.fetcherFunc(), }) } type stubvirtualMachineScaleSetVMsAPI struct { - scaleSetVM armcomputev2.VirtualMachineScaleSetVMsClientGetResponse + scaleSetVM armcompute.VirtualMachineScaleSetVMsClientGetResponse getErr error - instanceView armcomputev2.VirtualMachineScaleSetVMsClientGetInstanceViewResponse + instanceView armcompute.VirtualMachineScaleSetVMsClientGetInstanceViewResponse instanceViewErr error pager *stubVMSSVMPager } func (a *stubvirtualMachineScaleSetVMsAPI) Get(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, - options *armcomputev2.VirtualMachineScaleSetVMsClientGetOptions, -) (armcomputev2.VirtualMachineScaleSetVMsClientGetResponse, error) { + options *armcompute.VirtualMachineScaleSetVMsClientGetOptions, +) (armcompute.VirtualMachineScaleSetVMsClientGetResponse, error) { return a.scaleSetVM, a.getErr } func (a *stubvirtualMachineScaleSetVMsAPI) GetInstanceView(ctx context.Context, resourceGroupName string, vmScaleSetName string, instanceID string, - options *armcomputev2.VirtualMachineScaleSetVMsClientGetInstanceViewOptions, -) (armcomputev2.VirtualMachineScaleSetVMsClientGetInstanceViewResponse, error) { + options *armcompute.VirtualMachineScaleSetVMsClientGetInstanceViewOptions, +) (armcompute.VirtualMachineScaleSetVMsClientGetInstanceViewResponse, error) { return a.instanceView, a.instanceViewErr } func (a *stubvirtualMachineScaleSetVMsAPI) NewListPager(resourceGroupName string, virtualMachineScaleSetName string, - options *armcomputev2.VirtualMachineScaleSetVMsClientListOptions, -) *runtime.Pager[armcomputev2.VirtualMachineScaleSetVMsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[armcomputev2.VirtualMachineScaleSetVMsClientListResponse]{ + options *armcompute.VirtualMachineScaleSetVMsClientListOptions, +) *runtime.Pager[armcompute.VirtualMachineScaleSetVMsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[armcompute.VirtualMachineScaleSetVMsClientListResponse]{ More: a.pager.moreFunc(), Fetcher: a.pager.fetcherFunc(), }) @@ -118,25 +118,25 @@ func (p *stubPoller[T]) Result(ctx context.Context, out *T) error { } type stubVMSSVMPager struct { - list []armcomputev2.VirtualMachineScaleSetVM + list []armcompute.VirtualMachineScaleSetVM fetchErr error more bool } -func (p *stubVMSSVMPager) moreFunc() func(armcomputev2.VirtualMachineScaleSetVMsClientListResponse) bool { - return func(armcomputev2.VirtualMachineScaleSetVMsClientListResponse) bool { +func (p *stubVMSSVMPager) moreFunc() func(armcompute.VirtualMachineScaleSetVMsClientListResponse) bool { + return func(armcompute.VirtualMachineScaleSetVMsClientListResponse) bool { return p.more } } -func (p *stubVMSSVMPager) fetcherFunc() func(context.Context, *armcomputev2.VirtualMachineScaleSetVMsClientListResponse) (armcomputev2.VirtualMachineScaleSetVMsClientListResponse, error) { - return func(context.Context, *armcomputev2.VirtualMachineScaleSetVMsClientListResponse) (armcomputev2.VirtualMachineScaleSetVMsClientListResponse, error) { - page := make([]*armcomputev2.VirtualMachineScaleSetVM, len(p.list)) +func (p *stubVMSSVMPager) fetcherFunc() func(context.Context, *armcompute.VirtualMachineScaleSetVMsClientListResponse) (armcompute.VirtualMachineScaleSetVMsClientListResponse, error) { + return func(context.Context, *armcompute.VirtualMachineScaleSetVMsClientListResponse) (armcompute.VirtualMachineScaleSetVMsClientListResponse, error) { + page := make([]*armcompute.VirtualMachineScaleSetVM, len(p.list)) for i := range p.list { page[i] = &p.list[i] } - return armcomputev2.VirtualMachineScaleSetVMsClientListResponse{ - VirtualMachineScaleSetVMListResult: armcomputev2.VirtualMachineScaleSetVMListResult{ + return armcompute.VirtualMachineScaleSetVMsClientListResponse{ + VirtualMachineScaleSetVMListResult: armcompute.VirtualMachineScaleSetVMListResult{ Value: page, }, }, p.fetchErr @@ -144,25 +144,25 @@ func (p *stubVMSSVMPager) fetcherFunc() func(context.Context, *armcomputev2.Virt } type stubVMSSPager struct { - list []armcomputev2.VirtualMachineScaleSet + list []armcompute.VirtualMachineScaleSet fetchErr error more bool } -func (p *stubVMSSPager) moreFunc() func(armcomputev2.VirtualMachineScaleSetsClientListResponse) bool { - return func(armcomputev2.VirtualMachineScaleSetsClientListResponse) bool { +func (p *stubVMSSPager) moreFunc() func(armcompute.VirtualMachineScaleSetsClientListResponse) bool { + return func(armcompute.VirtualMachineScaleSetsClientListResponse) bool { return p.more } } -func (p *stubVMSSPager) fetcherFunc() func(context.Context, *armcomputev2.VirtualMachineScaleSetsClientListResponse) (armcomputev2.VirtualMachineScaleSetsClientListResponse, error) { - return func(context.Context, *armcomputev2.VirtualMachineScaleSetsClientListResponse) (armcomputev2.VirtualMachineScaleSetsClientListResponse, error) { - page := make([]*armcomputev2.VirtualMachineScaleSet, len(p.list)) +func (p *stubVMSSPager) fetcherFunc() func(context.Context, *armcompute.VirtualMachineScaleSetsClientListResponse) (armcompute.VirtualMachineScaleSetsClientListResponse, error) { + return func(context.Context, *armcompute.VirtualMachineScaleSetsClientListResponse) (armcompute.VirtualMachineScaleSetsClientListResponse, error) { + page := make([]*armcompute.VirtualMachineScaleSet, len(p.list)) for i := range p.list { page[i] = &p.list[i] } - return armcomputev2.VirtualMachineScaleSetsClientListResponse{ - VirtualMachineScaleSetListResult: armcomputev2.VirtualMachineScaleSetListResult{ + return armcompute.VirtualMachineScaleSetsClientListResponse{ + VirtualMachineScaleSetListResult: armcompute.VirtualMachineScaleSetListResult{ Value: page, }, }, p.fetchErr diff --git a/operators/constellation-node-operator/internal/cloud/azure/client/instanceview.go b/operators/constellation-node-operator/internal/cloud/azure/client/instanceview.go index a40ec6330..9f7ae1e1b 100644 --- a/operators/constellation-node-operator/internal/cloud/azure/client/instanceview.go +++ b/operators/constellation-node-operator/internal/cloud/azure/client/instanceview.go @@ -7,7 +7,7 @@ SPDX-License-Identifier: AGPL-3.0-only package client import ( - armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" updatev1alpha1 "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/api/v1alpha1" ) @@ -29,7 +29,7 @@ const ( // reference: // - https://docs.microsoft.com/en-us/azure/virtual-machines/states-billing#provisioning-states // - https://docs.microsoft.com/en-us/azure/virtual-machines/states-billing#power-states-and-billing -func nodeStateFromStatuses(statuses []*armcomputev2.InstanceViewStatus) updatev1alpha1.CSPNodeState { +func nodeStateFromStatuses(statuses []*armcompute.InstanceViewStatus) updatev1alpha1.CSPNodeState { for _, status := range statuses { if status == nil || status.Code == nil { continue diff --git a/operators/constellation-node-operator/internal/cloud/azure/client/instanceview_test.go b/operators/constellation-node-operator/internal/cloud/azure/client/instanceview_test.go index 47c87cb34..a7ace50bc 100644 --- a/operators/constellation-node-operator/internal/cloud/azure/client/instanceview_test.go +++ b/operators/constellation-node-operator/internal/cloud/azure/client/instanceview_test.go @@ -10,7 +10,7 @@ import ( "testing" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" "github.com/stretchr/testify/assert" updatev1alpha1 "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/api/v1alpha1" @@ -22,77 +22,77 @@ const provisioningStateSucceeded = "ProvisioningState/succeeded" func TestNodeStateFromStatuses(t *testing.T) { testCases := map[string]struct { - statuses []*armcomputev2.InstanceViewStatus + statuses []*armcompute.InstanceViewStatus wantState updatev1alpha1.CSPNodeState }{ "no statuses": { wantState: updatev1alpha1.NodeStateUnknown, }, "invalid status": { - statuses: []*armcomputev2.InstanceViewStatus{nil, {Code: nil}}, + statuses: []*armcompute.InstanceViewStatus{nil, {Code: nil}}, wantState: updatev1alpha1.NodeStateUnknown, }, "provisioning creating": { - statuses: []*armcomputev2.InstanceViewStatus{{Code: to.Ptr(provisioningStateCreating)}}, + statuses: []*armcompute.InstanceViewStatus{{Code: to.Ptr(provisioningStateCreating)}}, wantState: updatev1alpha1.NodeStateCreating, }, "provisioning updating": { - statuses: []*armcomputev2.InstanceViewStatus{{Code: to.Ptr(provisioningStateUpdating)}}, + statuses: []*armcompute.InstanceViewStatus{{Code: to.Ptr(provisioningStateUpdating)}}, wantState: updatev1alpha1.NodeStateStopped, }, "provisioning migrating": { - statuses: []*armcomputev2.InstanceViewStatus{{Code: to.Ptr(provisioningStateMigrating)}}, + statuses: []*armcompute.InstanceViewStatus{{Code: to.Ptr(provisioningStateMigrating)}}, wantState: updatev1alpha1.NodeStateStopped, }, "provisioning failed": { - statuses: []*armcomputev2.InstanceViewStatus{{Code: to.Ptr(provisioningStateFailed)}}, + statuses: []*armcompute.InstanceViewStatus{{Code: to.Ptr(provisioningStateFailed)}}, wantState: updatev1alpha1.NodeStateFailed, }, "provisioning deleting": { - statuses: []*armcomputev2.InstanceViewStatus{{Code: to.Ptr(provisioningStateDeleting)}}, + statuses: []*armcompute.InstanceViewStatus{{Code: to.Ptr(provisioningStateDeleting)}}, wantState: updatev1alpha1.NodeStateTerminating, }, "provisioning succeeded (but no power state)": { - statuses: []*armcomputev2.InstanceViewStatus{{Code: to.Ptr(provisioningStateSucceeded)}}, + statuses: []*armcompute.InstanceViewStatus{{Code: to.Ptr(provisioningStateSucceeded)}}, wantState: updatev1alpha1.NodeStateUnknown, }, "power starting": { - statuses: []*armcomputev2.InstanceViewStatus{ + statuses: []*armcompute.InstanceViewStatus{ {Code: to.Ptr(provisioningStateSucceeded)}, {Code: to.Ptr(powerStateStarting)}, }, wantState: updatev1alpha1.NodeStateCreating, }, "power stopping": { - statuses: []*armcomputev2.InstanceViewStatus{ + statuses: []*armcompute.InstanceViewStatus{ {Code: to.Ptr(provisioningStateSucceeded)}, {Code: to.Ptr(powerStateStopping)}, }, wantState: updatev1alpha1.NodeStateStopped, }, "power stopped": { - statuses: []*armcomputev2.InstanceViewStatus{ + statuses: []*armcompute.InstanceViewStatus{ {Code: to.Ptr(provisioningStateSucceeded)}, {Code: to.Ptr(powerStateStopped)}, }, wantState: updatev1alpha1.NodeStateStopped, }, "power deallocating": { - statuses: []*armcomputev2.InstanceViewStatus{ + statuses: []*armcompute.InstanceViewStatus{ {Code: to.Ptr(provisioningStateSucceeded)}, {Code: to.Ptr(powerStateDeallocating)}, }, wantState: updatev1alpha1.NodeStateStopped, }, "power deallocated": { - statuses: []*armcomputev2.InstanceViewStatus{ + statuses: []*armcompute.InstanceViewStatus{ {Code: to.Ptr(provisioningStateSucceeded)}, {Code: to.Ptr(powerStateDeallocated)}, }, wantState: updatev1alpha1.NodeStateStopped, }, "power running": { - statuses: []*armcomputev2.InstanceViewStatus{ + statuses: []*armcompute.InstanceViewStatus{ {Code: to.Ptr(provisioningStateSucceeded)}, {Code: to.Ptr(powerStateRunning)}, }, diff --git a/operators/constellation-node-operator/internal/cloud/azure/client/nodeimage.go b/operators/constellation-node-operator/internal/cloud/azure/client/nodeimage.go index d2c83a938..7ce8986c7 100644 --- a/operators/constellation-node-operator/internal/cloud/azure/client/nodeimage.go +++ b/operators/constellation-node-operator/internal/cloud/azure/client/nodeimage.go @@ -11,7 +11,7 @@ import ( "fmt" "strings" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" ) // GetNodeImage returns the image name of the node. diff --git a/operators/constellation-node-operator/internal/cloud/azure/client/nodeimage_test.go b/operators/constellation-node-operator/internal/cloud/azure/client/nodeimage_test.go index 78885f33d..194110715 100644 --- a/operators/constellation-node-operator/internal/cloud/azure/client/nodeimage_test.go +++ b/operators/constellation-node-operator/internal/cloud/azure/client/nodeimage_test.go @@ -13,7 +13,7 @@ import ( "testing" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/internal/poller" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -22,17 +22,17 @@ import ( func TestGetNodeImage(t *testing.T) { testCases := map[string]struct { providerID string - vm armcomputev2.VirtualMachineScaleSetVM + vm armcompute.VirtualMachineScaleSetVM getScaleSetVMErr error wantImage string wantErr bool }{ "getting node image works": { providerID: "azure:///subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name/virtualMachines/instance-id", - vm: armcomputev2.VirtualMachineScaleSetVM{ - Properties: &armcomputev2.VirtualMachineScaleSetVMProperties{ - StorageProfile: &armcomputev2.StorageProfile{ - ImageReference: &armcomputev2.ImageReference{ + vm: armcompute.VirtualMachineScaleSetVM{ + Properties: &armcompute.VirtualMachineScaleSetVMProperties{ + StorageProfile: &armcompute.StorageProfile{ + ImageReference: &armcompute.ImageReference{ ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/images/image-name"), }, }, @@ -42,10 +42,10 @@ func TestGetNodeImage(t *testing.T) { }, "getting community node image works": { providerID: "azure:///subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name/virtualMachines/instance-id", - vm: armcomputev2.VirtualMachineScaleSetVM{ - Properties: &armcomputev2.VirtualMachineScaleSetVMProperties{ - StorageProfile: &armcomputev2.StorageProfile{ - ImageReference: &armcomputev2.ImageReference{ + vm: armcompute.VirtualMachineScaleSetVM{ + Properties: &armcompute.VirtualMachineScaleSetVMProperties{ + StorageProfile: &armcompute.StorageProfile{ + ImageReference: &armcompute.ImageReference{ CommunityGalleryImageID: to.Ptr("/CommunityGalleries/gallery-name/Images/image-name/Versions/1.2.3"), }, }, @@ -64,7 +64,7 @@ func TestGetNodeImage(t *testing.T) { }, "scale set vm does not have valid image reference": { providerID: "azure:///subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name/virtualMachines/instance-id", - vm: armcomputev2.VirtualMachineScaleSetVM{}, + vm: armcompute.VirtualMachineScaleSetVM{}, wantErr: true, }, } @@ -76,7 +76,7 @@ func TestGetNodeImage(t *testing.T) { client := Client{ virtualMachineScaleSetVMsAPI: &stubvirtualMachineScaleSetVMsAPI{ - scaleSetVM: armcomputev2.VirtualMachineScaleSetVMsClientGetResponse{ + scaleSetVM: armcompute.VirtualMachineScaleSetVMsClientGetResponse{ VirtualMachineScaleSetVM: tc.vm, }, getErr: tc.getScaleSetVMErr, @@ -129,9 +129,9 @@ func TestGetScalingGroupID(t *testing.T) { func TestCreateNode(t *testing.T) { testCases := map[string]struct { scalingGroupID string - sku *armcomputev2.SKU - preexistingVMs []armcomputev2.VirtualMachineScaleSetVM - newVM *armcomputev2.VirtualMachineScaleSetVM + sku *armcompute.SKU + preexistingVMs []armcompute.VirtualMachineScaleSetVM + newVM *armcompute.VirtualMachineScaleSetVM fetchErr error pollErr error getSKUCapacityErr error @@ -143,13 +143,13 @@ func TestCreateNode(t *testing.T) { }{ "creating node works": { scalingGroupID: "/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name", - sku: &armcomputev2.SKU{ + sku: &armcompute.SKU{ Capacity: to.Ptr(int64(0)), }, - newVM: &armcomputev2.VirtualMachineScaleSetVM{ + newVM: &armcompute.VirtualMachineScaleSetVM{ ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name/virtualMachines/node-name"), - Properties: &armcomputev2.VirtualMachineScaleSetVMProperties{ - OSProfile: &armcomputev2.OSProfile{ + Properties: &armcompute.VirtualMachineScaleSetVMProperties{ + OSProfile: &armcompute.OSProfile{ ComputerName: to.Ptr("node-name"), }, }, @@ -159,16 +159,16 @@ func TestCreateNode(t *testing.T) { }, "creating node works with existing nodes": { scalingGroupID: "/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name", - sku: &armcomputev2.SKU{ + sku: &armcompute.SKU{ Capacity: to.Ptr(int64(1)), }, - preexistingVMs: []armcomputev2.VirtualMachineScaleSetVM{ + preexistingVMs: []armcompute.VirtualMachineScaleSetVM{ {ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name/virtualMachines/preexisting-node")}, }, - newVM: &armcomputev2.VirtualMachineScaleSetVM{ + newVM: &armcompute.VirtualMachineScaleSetVM{ ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name/virtualMachines/new-node"), - Properties: &armcomputev2.VirtualMachineScaleSetVMProperties{ - OSProfile: &armcomputev2.OSProfile{ + Properties: &armcompute.VirtualMachineScaleSetVMProperties{ + OSProfile: &armcompute.OSProfile{ ComputerName: to.Ptr("new-node"), }, }, @@ -196,19 +196,19 @@ func TestCreateNode(t *testing.T) { }, "updating scale set capacity fails": { scalingGroupID: "/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name", - sku: &armcomputev2.SKU{Capacity: to.Ptr(int64(0))}, + sku: &armcompute.SKU{Capacity: to.Ptr(int64(0))}, updateScaleSetErr: errors.New("update scale set error"), wantEarlyErr: true, }, "polling for increased capacity fails": { scalingGroupID: "/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name", - sku: &armcomputev2.SKU{Capacity: to.Ptr(int64(0))}, + sku: &armcompute.SKU{Capacity: to.Ptr(int64(0))}, pollErr: errors.New("poll error"), wantLateErr: true, }, "new node cannot be found": { scalingGroupID: "/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name", - sku: &armcomputev2.SKU{Capacity: to.Ptr(int64(0))}, + sku: &armcompute.SKU{Capacity: to.Ptr(int64(0))}, wantLateErr: true, }, } @@ -228,8 +228,8 @@ func TestCreateNode(t *testing.T) { pager: pager, }, scaleSetsAPI: &stubScaleSetsAPI{ - scaleSet: armcomputev2.VirtualMachineScaleSetsClientGetResponse{ - VirtualMachineScaleSet: armcomputev2.VirtualMachineScaleSet{ + scaleSet: armcompute.VirtualMachineScaleSetsClientGetResponse{ + VirtualMachineScaleSet: armcompute.VirtualMachineScaleSet{ SKU: tc.sku, }, }, @@ -321,9 +321,9 @@ func TestCapacityPollingHandler(t *testing.T) { var gotCapacity int64 handler := capacityPollingHandler{ scaleSetsAPI: &stubScaleSetsAPI{ - scaleSet: armcomputev2.VirtualMachineScaleSetsClientGetResponse{ - VirtualMachineScaleSet: armcomputev2.VirtualMachineScaleSet{ - SKU: &armcomputev2.SKU{Capacity: to.Ptr(int64(0))}, + scaleSet: armcompute.VirtualMachineScaleSetsClientGetResponse{ + VirtualMachineScaleSet: armcompute.VirtualMachineScaleSet{ + SKU: &armcompute.SKU{Capacity: to.Ptr(int64(0))}, }, }, }, @@ -344,7 +344,7 @@ func TestCapacityPollingHandler(t *testing.T) { assert.Error(handler.Poll(context.Background())) // let Poll finish - handler.scaleSetsAPI.(*stubScaleSetsAPI).scaleSet.SKU = &armcomputev2.SKU{Capacity: to.Ptr(wantCapacity)} + handler.scaleSetsAPI.(*stubScaleSetsAPI).scaleSet.SKU = &armcompute.SKU{Capacity: to.Ptr(wantCapacity)} assert.NoError(handler.Poll(context.Background())) assert.True(handler.Done()) assert.NoError(handler.Result(context.Background(), &gotCapacity)) diff --git a/operators/constellation-node-operator/internal/cloud/azure/client/pendingnode_test.go b/operators/constellation-node-operator/internal/cloud/azure/client/pendingnode_test.go index 6ba763f3e..b207fef69 100644 --- a/operators/constellation-node-operator/internal/cloud/azure/client/pendingnode_test.go +++ b/operators/constellation-node-operator/internal/cloud/azure/client/pendingnode_test.go @@ -14,7 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" updatev1alpha1 "github.com/edgelesssys/constellation/v2/operators/constellation-node-operator/v2/api/v1alpha1" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -23,15 +23,15 @@ import ( func TestGetNodeState(t *testing.T) { testCases := map[string]struct { providerID string - instanceView armcomputev2.VirtualMachineScaleSetVMInstanceView + instanceView armcompute.VirtualMachineScaleSetVMInstanceView getInstanceViewErr error wantState updatev1alpha1.CSPNodeState wantErr bool }{ "getting node state works": { providerID: "azure:///subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name/virtualMachines/instance-id", - instanceView: armcomputev2.VirtualMachineScaleSetVMInstanceView{ - Statuses: []*armcomputev2.InstanceViewStatus{ + instanceView: armcompute.VirtualMachineScaleSetVMInstanceView{ + Statuses: []*armcompute.InstanceViewStatus{ {Code: to.Ptr("ProvisioningState/succeeded")}, {Code: to.Ptr("PowerState/running")}, }, @@ -61,7 +61,7 @@ func TestGetNodeState(t *testing.T) { client := Client{ virtualMachineScaleSetVMsAPI: &stubvirtualMachineScaleSetVMsAPI{ - instanceView: armcomputev2.VirtualMachineScaleSetVMsClientGetInstanceViewResponse{ + instanceView: armcompute.VirtualMachineScaleSetVMsClientGetInstanceViewResponse{ VirtualMachineScaleSetVMInstanceView: tc.instanceView, }, instanceViewErr: tc.getInstanceViewErr, diff --git a/operators/constellation-node-operator/internal/cloud/azure/client/scalinggroup.go b/operators/constellation-node-operator/internal/cloud/azure/client/scalinggroup.go index cfcb4257f..701b063ef 100644 --- a/operators/constellation-node-operator/internal/cloud/azure/client/scalinggroup.go +++ b/operators/constellation-node-operator/internal/cloud/azure/client/scalinggroup.go @@ -12,7 +12,7 @@ import ( "strings" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" ) // GetScalingGroupImage returns the image URI of the scaling group. diff --git a/operators/constellation-node-operator/internal/cloud/azure/client/scalinggroup_test.go b/operators/constellation-node-operator/internal/cloud/azure/client/scalinggroup_test.go index ed7196976..e91492e48 100644 --- a/operators/constellation-node-operator/internal/cloud/azure/client/scalinggroup_test.go +++ b/operators/constellation-node-operator/internal/cloud/azure/client/scalinggroup_test.go @@ -12,7 +12,7 @@ import ( "testing" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - armcomputev2 "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v2" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute/v4" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -20,18 +20,18 @@ import ( func TestGetScalingGroupImage(t *testing.T) { testCases := map[string]struct { scalingGroupID string - scaleSet armcomputev2.VirtualMachineScaleSet + scaleSet armcompute.VirtualMachineScaleSet getScaleSetErr error wantImage string wantErr bool }{ "getting image works": { scalingGroupID: "/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name", - scaleSet: armcomputev2.VirtualMachineScaleSet{ - Properties: &armcomputev2.VirtualMachineScaleSetProperties{ - VirtualMachineProfile: &armcomputev2.VirtualMachineScaleSetVMProfile{ - StorageProfile: &armcomputev2.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcomputev2.ImageReference{ + scaleSet: armcompute.VirtualMachineScaleSet{ + Properties: &armcompute.VirtualMachineScaleSetProperties{ + VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ + StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ + ImageReference: &armcompute.ImageReference{ ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/images/image-name"), }, }, @@ -42,11 +42,11 @@ func TestGetScalingGroupImage(t *testing.T) { }, "getting community image works": { scalingGroupID: "/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-name", - scaleSet: armcomputev2.VirtualMachineScaleSet{ - Properties: &armcomputev2.VirtualMachineScaleSetProperties{ - VirtualMachineProfile: &armcomputev2.VirtualMachineScaleSetVMProfile{ - StorageProfile: &armcomputev2.VirtualMachineScaleSetStorageProfile{ - ImageReference: &armcomputev2.ImageReference{ + scaleSet: armcompute.VirtualMachineScaleSet{ + Properties: &armcompute.VirtualMachineScaleSetProperties{ + VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ + StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ + ImageReference: &armcompute.ImageReference{ CommunityGalleryImageID: to.Ptr("/CommunityGalleries/gallery-name/Images/image-name/Versions/1.2.3"), }, }, @@ -77,7 +77,7 @@ func TestGetScalingGroupImage(t *testing.T) { client := Client{ scaleSetsAPI: &stubScaleSetsAPI{ - scaleSet: armcomputev2.VirtualMachineScaleSetsClientGetResponse{ + scaleSet: armcompute.VirtualMachineScaleSetsClientGetResponse{ VirtualMachineScaleSet: tc.scaleSet, }, getErr: tc.getScaleSetErr, @@ -184,14 +184,14 @@ func TestGetScalingGroupName(t *testing.T) { func TestListScalingGroups(t *testing.T) { testCases := map[string]struct { - scaleSet armcomputev2.VirtualMachineScaleSet + scaleSet armcompute.VirtualMachineScaleSet fetchPageErr error wantControlPlanes []string wantWorkers []string wantErr bool }{ "listing control-plane works": { - scaleSet: armcomputev2.VirtualMachineScaleSet{ + scaleSet: armcompute.VirtualMachineScaleSet{ ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/constellation-scale-set-control-planes-uid"), Tags: map[string]*string{ "constellation-uid": to.Ptr("uid"), @@ -201,7 +201,7 @@ func TestListScalingGroups(t *testing.T) { wantControlPlanes: []string{"/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/constellation-scale-set-control-planes-uid"}, }, "listing worker works": { - scaleSet: armcomputev2.VirtualMachineScaleSet{ + scaleSet: armcompute.VirtualMachineScaleSet{ ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/constellation-scale-set-workers-uid"), Tags: map[string]*string{ "constellation-uid": to.Ptr("uid"), @@ -211,7 +211,7 @@ func TestListScalingGroups(t *testing.T) { wantWorkers: []string{"/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/constellation-scale-set-workers-uid"}, }, "listing is not dependent on resource name": { - scaleSet: armcomputev2.VirtualMachineScaleSet{ + scaleSet: armcompute.VirtualMachineScaleSet{ ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/some-scale-set"), Tags: map[string]*string{ "constellation-uid": to.Ptr("uid"), @@ -221,7 +221,7 @@ func TestListScalingGroups(t *testing.T) { wantControlPlanes: []string{"/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/some-scale-set"}, }, "listing other works": { - scaleSet: armcomputev2.VirtualMachineScaleSet{ + scaleSet: armcompute.VirtualMachineScaleSet{ ID: to.Ptr("/subscriptions/subscription-id/resourceGroups/resource-group/providers/Microsoft.Compute/virtualMachineScaleSets/other"), }, }, @@ -240,7 +240,7 @@ func TestListScalingGroups(t *testing.T) { client := Client{ scaleSetsAPI: &stubScaleSetsAPI{ pager: &stubVMSSPager{ - list: []armcomputev2.VirtualMachineScaleSet{tc.scaleSet}, + list: []armcompute.VirtualMachineScaleSet{tc.scaleSet}, fetchErr: tc.fetchPageErr, }, },