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

[release-1.31] Chore: set batch size to great or equal to 1 #8056

Open
wants to merge 1 commit into
base: release-1.31
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/provider/azure_vmss.go
Original file line number Diff line number Diff line change
Expand Up @@ -2316,6 +2316,9 @@ func (ss *ScaleSet) VMSSBatchSize(ctx context.Context, vmssName string) (int, er
if _, ok := vmss.Tags[consts.VMSSTagForBatchOperation]; ok {
batchSize = ss.GetPutVMSSVMBatchSize()
}
if batchSize < 1 {
batchSize = 1
}
klog.V(2).InfoS("Fetch VMSS batch size", "vmss", vmssName, "size", batchSize)
return batchSize, nil
}
25 changes: 25 additions & 0 deletions pkg/provider/azure_vmss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3297,6 +3297,31 @@
assert.Equal(t, BatchSize, batchSize)
})

t.Run("vmss contains batch operation tag", func(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
ss, err := NewTestScaleSet(ctrl)
assert.NoError(t, err)
ss.Cloud.PutVMSSVMBatchSize = 0

scaleSet := &armcompute.VirtualMachineScaleSet{

Check failure on line 3307 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: armcompute

Check failure on line 3307 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: armcompute
Name: ptr.To("foo"),
Tags: map[string]*string{
consts.VMSSTagForBatchOperation: ptr.To(""),
},
Properties: &armcompute.VirtualMachineScaleSetProperties{

Check failure on line 3312 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: armcompute

Check failure on line 3312 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: armcompute
OrchestrationMode: to.Ptr(armcompute.OrchestrationModeUniform),

Check failure on line 3313 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: to

Check failure on line 3313 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: armcompute

Check failure on line 3313 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: to

Check failure on line 3313 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: armcompute
},
}
mockVMSSClient := ss.Cloud.ComputeClientFactory.GetVirtualMachineScaleSetClient().(*mock_virtualmachinescalesetclient.MockInterface)

Check failure on line 3316 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: mock_virtualmachinescalesetclient

Check failure on line 3316 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: mock_virtualmachinescalesetclient
mockVMSSClient.EXPECT().List(gomock.Any(), gomock.Any()).
Return([]*armcompute.VirtualMachineScaleSet{scaleSet}, nil)

Check failure on line 3318 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Lint

undefined: armcompute (typecheck)

Check failure on line 3318 in pkg/provider/azure_vmss_test.go

View workflow job for this annotation

GitHub Actions / Analyze (go)

undefined: armcompute

batchSize, err := ss.VMSSBatchSize(context.TODO(), ptr.Deref(scaleSet.Name, ""))
assert.NoError(t, err)
assert.Equal(t, 1, batchSize)
})

t.Run("vmss doesn't contain batch operation tag", func(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()
Expand Down
2 changes: 1 addition & 1 deletion pkg/provider/config/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ type Config struct {
// `podIP`: pod IPs will be attached to the inbound backend pool of the load balancer (not supported yet).
LoadBalancerBackendPoolConfigurationType string `json:"loadBalancerBackendPoolConfigurationType,omitempty" yaml:"loadBalancerBackendPoolConfigurationType,omitempty"`
// PutVMSSVMBatchSize defines how many requests the client send concurrently when putting the VMSS VMs.
// If it is smaller than or equal to zero, the request will be sent one by one in sequence (default).
// If it is smaller than or equal to one, the request will be sent one by one in sequence (default).
PutVMSSVMBatchSize int `json:"putVMSSVMBatchSize" yaml:"putVMSSVMBatchSize"`
// PrivateLinkServiceResourceGroup determines the specific resource group of the private link services user want to use
PrivateLinkServiceResourceGroup string `json:"privateLinkServiceResourceGroup,omitempty" yaml:"privateLinkServiceResourceGroup,omitempty"`
Expand Down
Loading