fix: Exclude VMSS Flex with Standalone VMs and cleanup old workflow#721
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR aims to fix the filter condition for VMSS Flex instances by excluding those with an empty SKU field.
- Added a filtering condition to exclude instances without a SKU
- Ensured that VMSS Flex instances with standalone VMs are filtered out
|
@tksh164 I'm seeing that Code scanning is waiting for results from CodeQL for the commits d7ad3a1 and b657fe5. When I look at your commit from here: b657fe5 It's showing that it originated outside the repo... I'm not sure if Github is having an issue, but we can't merge this until the commit is "scanned". Have you run into this before? |
|
@kpoineal - It seems waiting to review from aprl-maintainers. |
|
@tksh164 All the checks have passed and I have approved the PR. Something is preventing the CodeQL from running correctly. |
|
@DaFitRobsta In currently, this PR blocked by waiting for results from CodeQL for the commits 332dacc or 5340e84. 5340e84 does not belong to this repo (APRLv2). It belongs to your forked repo. I'm not sure, but I'm guessing that CodeQL does not enabled on your forked repo. It is the reason for the block on this PR, I think. So, could you try to check the code scanning settings on your forked repo? |
There was a problem hiding this comment.
Pull Request Overview
This PR updates the KQL query to exclude VMSS Flex instances associated with standalone VMs by filtering out entries with an empty SKU and removes an outdated workflow.
- Changed the filter to only include entries with a non-empty SKU
- Updated the inline comment to reflect the new exclusion criteria
Files not reviewed (2)
- .github/scripts/build-recommendation-object.ps1: Language not supported
- .github/workflows/build-recommendation-object.yml: Language not supported
| // Find VMSS instances (excluding VMSS Flex associated with standalone VMs) associated with autoscale settings when autoscale is disabled | ||
| resources | ||
| | where type == "microsoft.compute/virtualmachinescalesets" | ||
| | where isempty(tostring(tags['aks-managed-poolName'])) |
There was a problem hiding this comment.
[nitpick] Consider adding a brief comment explaining why converting SKU to a string is required, to help future maintainers understand the data type assumptions in this query.
| | where isempty(tostring(tags['aks-managed-poolName'])) | |
| | where isempty(tostring(tags['aks-managed-poolName'])) | |
| // Convert `sku` to a string to ensure consistent handling of its data type, as it might not always be a string. |





Overview/Summary
The original KQL didn't account for VMSS flex instances that had standalone VMs associated with them. The updated query doesn't include a VMSS instance if the SKU is empty on the object.
Screenshot: Still returns VMSS instances without an empty SKU

Screenshot: Environment with VMSS instances with empty SKU:

Related Issues/Work Items
Fixes AB#40454
Also, have removed old and unused workflow for building recommendation object.
Breaking Changes
As part of this pull request I have
mainbranch