-
Notifications
You must be signed in to change notification settings - Fork 250
test(e2e): add timing test for createVMExtensionLinuxAKSNode #8064
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
Replace hardcoded VM extension version "1.406" with a cached Azure API call that fetches the latest version at runtime. Add a caching layer via CachedGetLatestVMExtensionImageVersion to avoid redundant API calls across tests. Update all callers to pass context for proper propagation. Signed-off-by: Suraj Deshmukh <suraj.deshmukh@microsoft.com>
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -259,7 +259,7 @@ func Test_Ubuntu2404_NvidiaDevicePluginRunning(t *testing.T) { | |||||
| vmss.Tags["EnableManagedGPUExperience"] = to.Ptr("true") | ||||||
|
|
||||||
| // Enable the AKS VM extension for GPU nodes | ||||||
| extension, err := createVMExtensionLinuxAKSNode(vmss.Location) | ||||||
| extension, err := createVMExtensionLinuxAKSNode(context.TODO(), vmss.Location) | ||||||
|
||||||
| extension, err := createVMExtensionLinuxAKSNode(context.TODO(), vmss.Location) | |
| extension, err := createVMExtensionLinuxAKSNode(testCtx, vmss.Location) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2138,7 +2138,7 @@ func Test_Ubuntu2404_NPD_Basic(t *testing.T) { | |||||
| BootstrapConfigMutator: func(nbc *datamodel.NodeBootstrappingConfiguration) { | ||||||
| }, | ||||||
| VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) { | ||||||
| extension, err := createVMExtensionLinuxAKSNode(vmss.Location) | ||||||
| extension, err := createVMExtensionLinuxAKSNode(context.TODO(), vmss.Location) | ||||||
|
||||||
| extension, err := createVMExtensionLinuxAKSNode(context.TODO(), vmss.Location) | |
| extension, err := createVMExtensionLinuxAKSNode(testCtx, vmss.Location) |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -522,21 +522,22 @@ func addTrustedLaunchToVMSS(properties *armcompute.VirtualMachineScaleSetPropert | |||||
| return properties | ||||||
| } | ||||||
|
|
||||||
| func createVMExtensionLinuxAKSNode(_ *string) (*armcompute.VirtualMachineScaleSetExtension, error) { | ||||||
| // Default to "westus" if location is nil. | ||||||
| // region := "westus" | ||||||
| // if location != nil { | ||||||
| // region = *location | ||||||
| // } | ||||||
| func createVMExtensionLinuxAKSNode(ctx context.Context, location *string) (*armcompute.VirtualMachineScaleSetExtension, error) { | ||||||
| region := config.Config.DefaultLocation | ||||||
| if location != nil { | ||||||
| region = *location | ||||||
| } | ||||||
|
|
||||||
| extensionName := "Compute.AKS.Linux.AKSNode" | ||||||
| publisher := "Microsoft.AKS" | ||||||
| extensionVersion := "1.406" | ||||||
| // NOTE (@surajssd): If this is gonna be called multiple times, then find a way to cache the latest version. | ||||||
| // extensionVersion, err := config.Azure.GetLatestVMExtensionImageVersion(context.TODO(), region, extensionName, publisher) | ||||||
| // if err != nil { | ||||||
| // return nil, fmt.Errorf("getting latest VM extension image version: %v", err) | ||||||
| // } | ||||||
| extensionVersion, err := CachedGetLatestVMExtensionImageVersion(ctx, GetLatestExtensionVersionRequest{ | ||||||
| Location: region, | ||||||
| ExtType: extensionName, | ||||||
| Publisher: publisher, | ||||||
| }) | ||||||
| if err != nil { | ||||||
| return nil, fmt.Errorf("getting latest VM extension image version: %w", err) | ||||||
| } | ||||||
|
Comment on lines
+525
to
+540
|
||||||
|
|
||||||
| return &armcompute.VirtualMachineScaleSetExtension{ | ||||||
| Name: to.Ptr(extensionName), | ||||||
|
|
@@ -795,7 +796,7 @@ func runScenarioGPUNPD(t *testing.T, vmSize, location, k8sSystemPoolSKU string) | |||||
| VMConfigMutator: func(vmss *armcompute.VirtualMachineScaleSet) { | ||||||
| vmss.SKU.Name = to.Ptr(vmSize) | ||||||
|
|
||||||
| extension, err := createVMExtensionLinuxAKSNode(vmss.Location) | ||||||
| extension, err := createVMExtensionLinuxAKSNode(context.TODO(), vmss.Location) | ||||||
|
||||||
| extension, err := createVMExtensionLinuxAKSNode(context.TODO(), vmss.Location) | |
| extension, err := createVMExtensionLinuxAKSNode(testCtx, vmss.Location) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cachedFunc caches the first error permanently for a given key. For VM extension version lookups this can turn a transient Azure API failure into a persistent failure for the rest of the test run (and it also prevents a later retry from succeeding). Consider not caching errors for this specific cached function (e.g., evict the entry on error) so warm calls only come from cache after a successful fetch.