Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update Azure compute API to 2021-04-01 #1646

Merged
merged 1 commit into from Aug 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/v1alpha4/azuremachine_validation.go
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/google/uuid"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"golang.org/x/crypto/ssh"
"k8s.io/apimachinery/pkg/util/validation/field"
)
Expand Down
8 changes: 4 additions & 4 deletions api/v1alpha4/azuremachine_validation_test.go
Expand Up @@ -25,7 +25,7 @@ import (

"github.com/google/uuid"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest/to"

. "github.com/onsi/gomega"
Expand Down Expand Up @@ -107,7 +107,7 @@ func TestAzureMachine_ValidateOSDisk(t *testing.T) {
CachingType: "None",
OSType: "blah",
DiffDiskSettings: &DiffDiskSettings{
Option: string(compute.Local),
Option: string(compute.DiffDiskOptionsLocal),
},
ManagedDisk: &ManagedDiskParameters{
StorageAccountType: "Standard_LRS",
Expand All @@ -122,7 +122,7 @@ func TestAzureMachine_ValidateOSDisk(t *testing.T) {
CachingType: "None",
OSType: "blah",
DiffDiskSettings: &DiffDiskSettings{
Option: string(compute.Local),
Option: string(compute.DiffDiskOptionsLocal),
},
ManagedDisk: &ManagedDiskParameters{
StorageAccountType: "Standard_LRS",
Expand Down Expand Up @@ -195,7 +195,7 @@ func generateNegativeTestCases() []osDiskTestInput {
StorageAccountType: "Premium_LRS",
},
DiffDiskSettings: &DiffDiskSettings{
Option: string(compute.Local),
Option: string(compute.DiffDiskOptionsLocal),
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha4/azuremachinetemplate_webhook_test.go
Expand Up @@ -19,7 +19,7 @@ package v1alpha4
import (
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest/to"
. "github.com/onsi/gomega"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down
2 changes: 1 addition & 1 deletion azure/converters/identity.go
Expand Up @@ -21,7 +21,7 @@ import (

"sigs.k8s.io/cluster-api-provider-azure/azure"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/pkg/errors"

infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4"
Expand Down
2 changes: 1 addition & 1 deletion azure/converters/identity_test.go
Expand Up @@ -19,7 +19,7 @@ package converters
import (
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/onsi/gomega"

infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4"
Expand Down
2 changes: 1 addition & 1 deletion azure/converters/image.go
Expand Up @@ -19,7 +19,7 @@ package converters
import (
"fmt"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/pkg/errors"

infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4"
Expand Down
4 changes: 2 additions & 2 deletions azure/converters/spotinstances.go
Expand Up @@ -19,7 +19,7 @@ package converters
import (
"strconv"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4"
)

Expand All @@ -40,5 +40,5 @@ func GetSpotVMOptions(spotVMOptions *infrav1.SpotVMOptions) (compute.VirtualMach
MaxPrice: &maxPrice,
}
}
return compute.Spot, compute.Deallocate, billingProfile, nil
return compute.VirtualMachinePriorityTypesSpot, compute.VirtualMachineEvictionPolicyTypesDeallocate, billingProfile, nil
}
2 changes: 1 addition & 1 deletion azure/converters/vm.go
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package converters

import (
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest/to"
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4"
)
Expand Down
2 changes: 1 addition & 1 deletion azure/converters/vmss.go
Expand Up @@ -17,7 +17,7 @@ limitations under the License.
package converters

import (
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest/to"
infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4"
"sigs.k8s.io/cluster-api-provider-azure/azure"
Expand Down
2 changes: 1 addition & 1 deletion azure/converters/vmss_test.go
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest/to"
"github.com/onsi/gomega"
"sigs.k8s.io/cluster-api-provider-azure/azure"
Expand Down
6 changes: 3 additions & 3 deletions azure/services/availabilitysets/availabilitysets.go
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"strconv"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest/to"
"github.com/go-logr/logr"
"github.com/pkg/errors"
Expand Down Expand Up @@ -65,7 +65,7 @@ func (s *Service) Reconcile(ctx context.Context) error {
return nil
}

asSku, err := s.resourceSKUCache.Get(ctx, string(compute.Aligned), resourceskus.AvailabilitySets)
asSku, err := s.resourceSKUCache.Get(ctx, string(compute.AvailabilitySetSkuTypesAligned), resourceskus.AvailabilitySets)
if err != nil {
return errors.Wrap(err, "failed to get availability sets sku")
}
Expand All @@ -84,7 +84,7 @@ func (s *Service) Reconcile(ctx context.Context) error {

asParams := compute.AvailabilitySet{
Sku: &compute.Sku{
Name: to.StringPtr(string(compute.Aligned)),
Name: to.StringPtr(string(compute.AvailabilitySetSkuTypesAligned)),
},
AvailabilitySetProperties: &compute.AvailabilitySetProperties{
PlatformFaultDomainCount: to.Int32Ptr(int32(faultDomainCount)),
Expand Down
2 changes: 1 addition & 1 deletion azure/services/availabilitysets/availabilitysets_test.go
Expand Up @@ -21,7 +21,7 @@ import (
"errors"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/to"
"github.com/golang/mock/gomock"
Expand Down
2 changes: 1 addition & 1 deletion azure/services/availabilitysets/client.go
Expand Up @@ -19,7 +19,7 @@ package availabilitysets
import (
"context"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest"
"sigs.k8s.io/cluster-api-provider-azure/azure"
"sigs.k8s.io/cluster-api-provider-azure/util/tele"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion azure/services/disks/client.go
Expand Up @@ -19,7 +19,7 @@ package disks
import (
"context"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest"
"sigs.k8s.io/cluster-api-provider-azure/azure"
"sigs.k8s.io/cluster-api-provider-azure/util/tele"
Expand Down
2 changes: 1 addition & 1 deletion azure/services/networkinterfaces/networkinterfaces_test.go
Expand Up @@ -25,7 +25,7 @@ import (
"sigs.k8s.io/cluster-api-provider-azure/azure"
gomockinternal "sigs.k8s.io/cluster-api-provider-azure/internal/test/matchers/gomock"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2021-02-01/network"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/to"
Expand Down
6 changes: 3 additions & 3 deletions azure/services/resourceskus/cache.go
Expand Up @@ -24,7 +24,7 @@ import (
"sync"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/pkg/errors"

"sigs.k8s.io/cluster-api-provider-azure/azure"
Expand Down Expand Up @@ -182,7 +182,7 @@ func (c *Cache) GetZones(ctx context.Context, location string) ([]string, error)
if sku.Restrictions != nil {
for _, restriction := range *sku.Restrictions {
// Can't deploy anything in this subscription in this location. Bail out.
if restriction.Type == compute.Location {
if restriction.Type == compute.ResourceSkuRestrictionsTypeLocation {
availableZones = nil
break
}
Expand Down Expand Up @@ -243,7 +243,7 @@ func (c *Cache) GetZonesWithVMSize(ctx context.Context, size, location string) (
if sku.Restrictions != nil {
for _, restriction := range *sku.Restrictions {
// Can't deploy anything in this subscription in this location. Bail out.
if restriction.Type == compute.Location {
if restriction.Type == compute.ResourceSkuRestrictionsTypeLocation {
availableZones = nil
break
}
Expand Down
10 changes: 5 additions & 5 deletions azure/services/resourceskus/cache_test.go
Expand Up @@ -20,7 +20,7 @@ import (
"context"
"testing"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest/to"
"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
Expand Down Expand Up @@ -190,7 +190,7 @@ func TestCacheGetZones(t *testing.T) {
},
Restrictions: &[]compute.ResourceSkuRestrictions{
{
Type: compute.Location,
Type: compute.ResourceSkuRestrictionsTypeLocation,
Values: &[]string{"baz"},
},
},
Expand All @@ -214,7 +214,7 @@ func TestCacheGetZones(t *testing.T) {
},
Restrictions: &[]compute.ResourceSkuRestrictions{
{
Type: compute.Zone,
Type: compute.ResourceSkuRestrictionsTypeZone,
RestrictionInfo: &compute.ResourceSkuRestrictionInfo{
Zones: &[]string{"1"},
},
Expand Down Expand Up @@ -339,7 +339,7 @@ func TestCacheGetZonesWithVMSize(t *testing.T) {
},
Restrictions: &[]compute.ResourceSkuRestrictions{
{
Type: compute.Location,
Type: compute.ResourceSkuRestrictionsTypeLocation,
Values: &[]string{"baz"},
},
},
Expand All @@ -363,7 +363,7 @@ func TestCacheGetZonesWithVMSize(t *testing.T) {
},
Restrictions: &[]compute.ResourceSkuRestrictions{
{
Type: compute.Zone,
Type: compute.ResourceSkuRestrictionsTypeZone,
RestrictionInfo: &compute.ResourceSkuRestrictionInfo{
Zones: &[]string{"1"},
},
Expand Down
2 changes: 1 addition & 1 deletion azure/services/resourceskus/client.go
Expand Up @@ -19,7 +19,7 @@ package resourceskus
import (
"context"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest"
"github.com/pkg/errors"

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion azure/services/resourceskus/sku.go
Expand Up @@ -20,7 +20,7 @@ import (
"strconv"
"strings"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/pkg/errors"
)

Expand Down
2 changes: 1 addition & 1 deletion azure/services/roleassignments/roleassignments_test.go
Expand Up @@ -22,7 +22,7 @@ import (
"testing"

"github.com/Azure/azure-sdk-for-go/profiles/2019-03-01/authorization/mgmt/authorization"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/to"
"github.com/golang/mock/gomock"
Expand Down
9 changes: 5 additions & 4 deletions azure/services/scalesets/client.go
Expand Up @@ -23,10 +23,11 @@ import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/azure-sdk-for-go/services/network/mgmt/2019-11-01/network"
"github.com/Azure/go-autorest/autorest"
azureautorest "github.com/Azure/go-autorest/autorest/azure"
"github.com/Azure/go-autorest/autorest/to"
"github.com/pkg/errors"

infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1alpha4"
Expand Down Expand Up @@ -169,7 +170,7 @@ func (ac *AzureClient) Get(ctx context.Context, resourceGroupName, vmssName stri
ctx, span := tele.Tracer().Start(ctx, "scalesets.AzureClient.Get")
defer span.End()

return ac.scalesets.Get(ctx, resourceGroupName, vmssName)
return ac.scalesets.Get(ctx, resourceGroupName, vmssName, "")
}

// CreateOrUpdate the operation to create or update a virtual machine scale set.
Expand Down Expand Up @@ -350,7 +351,7 @@ func (ac *AzureClient) Delete(ctx context.Context, resourceGroupName, vmssName s
ctx, span := tele.Tracer().Start(ctx, "scalesets.AzureClient.Delete")
defer span.End()

future, err := ac.scalesets.Delete(ctx, resourceGroupName, vmssName)
future, err := ac.scalesets.Delete(ctx, resourceGroupName, vmssName, to.BoolPtr(false))
if err != nil {
return err
}
Expand All @@ -373,7 +374,7 @@ func (ac *AzureClient) DeleteAsync(ctx context.Context, resourceGroupName, vmssN
ctx, span := tele.Tracer().Start(ctx, "scalesets.AzureClient.DeleteAsync")
defer span.End()

future, err := ac.scalesets.Delete(ctx, resourceGroupName, vmssName)
future, err := ac.scalesets.Delete(ctx, resourceGroupName, vmssName, to.BoolPtr(false))
if err != nil {
return nil, errors.Wrapf(err, "failed deleting vmss named %q", vmssName)
}
Expand Down
2 changes: 1 addition & 1 deletion azure/services/scalesets/mock_scalesets/client_mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions azure/services/scalesets/scalesets.go
Expand Up @@ -22,7 +22,7 @@ import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2020-06-30/compute"
"github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2021-04-01/compute"
"github.com/Azure/go-autorest/autorest/to"
"github.com/go-logr/logr"
"github.com/pkg/errors"
Expand Down Expand Up @@ -445,7 +445,7 @@ func (s *Service) buildVMSSFromSpec(ctx context.Context, vmssSpec azure.ScaleSet
ID: to.StringPtr(azure.SubnetID(s.Scope.SubscriptionID(), vmssSpec.VNetResourceGroup, vmssSpec.VNetName, vmssSpec.SubnetName)),
},
Primary: to.BoolPtr(true),
PrivateIPAddressVersion: compute.IPv4,
PrivateIPAddressVersion: compute.IPVersionIPv4,
LoadBalancerBackendAddressPools: &backendAddressPools,
},
},
Expand Down Expand Up @@ -640,7 +640,7 @@ func (s *Service) generateOSProfile(ctx context.Context, vmssSpec azure.ScaleSet
}

switch vmssSpec.OSDisk.OSType {
case string(compute.Windows):
case string(compute.OperatingSystemTypesWindows):
// Cloudbase-init is used to generate a password.
// https://cloudbase-init.readthedocs.io/en/latest/plugins.html#setting-password-main
//
Expand Down