[Managed Prometheus] Simplify logic and enable correct recording rule groups for managed prom#8796
[Managed Prometheus] Simplify logic and enable correct recording rule groups for managed prom#8796bragi92 wants to merge 7 commits intoAzure:mainfrom
Conversation
This is required for our helm charts where customers can opt to change the caching behaviour during restore.
…ged prom extension
|
Validation for Breaking Change Starting...
Thanks for your contribution! |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR. Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
There was a problem hiding this comment.
Pull Request Overview
This PR simplifies the logic for managed Prometheus by updating the recording rule groups and adds support for the new 'DisableInformerCache' configuration in the data protection module. Key changes include:
- Updating test scripts and pipeline templates to support the new extension functionality.
- Bumping the extension version from 1.6.4 to 1.6.5 and updating recording rule creation and deletion logic.
- Adding support for the new 'DisableInformerCache' configuration in the DataProtectionKubernetes extension.
Reviewed Changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/* | New and updated PowerShell test suites, pipeline templates, and supporting files for validating the extension functionality. |
| src/k8s-extension/setup.py | Extension version bump from 1.6.4 to 1.6.5. |
| src/k8s-extension/azext_k8s_extension/partner_extensions/azuremonitormetrics/recordingrules/delete.py | Added deletion for an additional UX recording rule group for improved recording rule management. |
| src/k8s-extension/azext_k8s_extension/partner_extensions/azuremonitormetrics/recordingrules/create.py | Modified logic to iterate over filtered recording rule templates and call put_rules for non-Windows rules. |
| src/k8s-extension/azext_k8s_extension/partner_extensions/DataProtectionKubernetes.py | Added support for the new “DisableInformerCache” configuration. |
| testing/Bootstrap.ps1 & testing/Test.ps1 | Adjustments to resource group handling and test file path iteration in the CI workflow. |
Comments suppressed due to low confidence (1)
testing/Test.ps1:82
- $testFilePaths is assigned as a string when handling 'k8s-configuration' tests, but it is iterated over in a foreach loop as if it were a collection. Consider wrapping it in an array (e.g., @($testFilePaths)) or using it directly in Get-ChildItem.
foreach ($paths in $testFilePaths) {
| for index, rule_template in enumerate(default_rules_template): | ||
| rule_name = rule_template["name"] | ||
| is_windows_rule = "win" in rule_name.lower() | ||
|
|
||
| # Skip any recording rules as ARC metrics extension doesn't have windows support | ||
| if is_windows_rule: | ||
| continue | ||
|
|
There was a problem hiding this comment.
When filtering out Windows rules using 'continue', the use of enumerate's index may not correctly correspond to the intended rule_template being processed. Consider collecting non-Windows templates in a separate list or directly using the current rule_template instead of default_rules_template[index] to avoid potential index mismatches.
| for index, rule_template in enumerate(default_rules_template): | |
| rule_name = rule_template["name"] | |
| is_windows_rule = "win" in rule_name.lower() | |
| # Skip any recording rules as ARC metrics extension doesn't have windows support | |
| if is_windows_rule: | |
| continue | |
| # Filter out Windows rules into a separate list | |
| non_windows_templates = [ | |
| rule_template for rule_template in default_rules_template | |
| if "win" not in rule_template["name"].lower() | |
| ] | |
| for rule_template in non_windows_templates: |
| az group show --name $envConfig.resourceGroup | ||
| if (!$?) { | ||
| Write-Host "Resource group does not exist, creating it now in region 'eastus2euap'" | ||
| az group create --name $envConfig.resourceGroup --location eastus2euap |
There was a problem hiding this comment.
The variable '$envConfig' is used instead of the correct '$ENVCONFIG' as defined earlier, which could lead to lookup failures. Update '$envConfig.resourceGroup' to '$ENVCONFIG.resourceGroup' for consistency.
| az group show --name $envConfig.resourceGroup | |
| if (!$?) { | |
| Write-Host "Resource group does not exist, creating it now in region 'eastus2euap'" | |
| az group create --name $envConfig.resourceGroup --location eastus2euap | |
| az group show --name $ENVCONFIG.resourceGroup | |
| if (!$?) { | |
| Write-Host "Resource group does not exist, creating it now in region 'eastus2euap'" | |
| az group create --name $ENVCONFIG.resourceGroup --location eastus2euap |
CodeGen Tools Feedback CollectionThank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey |
|
This checklist is used to make sure that common guidelines for a pull request are followed.
Related command
az k8s-extension create --name azuremonitor-metrics --cluster-name --resource-group --cluster-type connectedClusters --extension-type Microsoft.AzureMonitor.Containers.Metrics
General Guidelines
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)For new extensions:
About Extension Publish
There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update
src/index.jsonautomatically.You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify
src/index.json.