Skip to content

[dataprotection] Add controller and initContainer resource settings for AKS Backup Extension #9648

Open
priyansh17 wants to merge 1 commit intoAzure:mainfrom
priyansh17:main
Open

[dataprotection] Add controller and initContainer resource settings for AKS Backup Extension #9648
priyansh17 wants to merge 1 commit intoAzure:mainfrom
priyansh17:main

Conversation

@priyansh17
Copy link
Contributor

@priyansh17 priyansh17 commented Mar 4, 2026


This adds support for users to modify data protection backup extension for AKS workload to modify limits of specific containers being deployed.

Related command

az k8s-extension create --name azure-aks-backup --extension-type microsoft.dataprotection.kubernetes --scope cluster --cluster-type managedClusters --cluster-name $akscluster --resource-group $aksclusterresourcegroup --release-train stable --config-settings-file backup-ext-config.json

General Guidelines

  • Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • My extension version conforms to the Extension version schema

For new extensions:

… pass-through in DataProtectionKubernetes

Co-authored-by: priyansh17|choudharypr@microsoft.com
Copilot AI review requested due to automatic review settings March 4, 2026 20:27
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 4, 2026

️✔️Azure CLI Extensions Breaking Change Test
️✔️Non Breaking Changes

@yonzhan
Copy link
Collaborator

yonzhan commented Mar 4, 2026

Thank you for your contribution! We will review the pull request and get back to you soon.

@azure-client-tools-bot-prd
Copy link

Hi @priyansh17,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

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).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@microsoft-github-policy-service microsoft-github-policy-service bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Mar 4, 2026
@microsoft-github-policy-service
Copy link
Contributor

Thank you for your contribution @priyansh17! We will review the pull request and get back to you soon.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

CodeGen Tools Feedback Collection

Thank 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

@priyansh17 priyansh17 changed the title Add controller and initContainer resource settings for AKS Backup Extension [dataprotection] Add controller and initContainer resource settings for AKS Backup Extension Mar 4, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the AKS Backup (DataProtectionKubernetes) partner extension configuration mapping to support resource settings for the controller and the Velero Azure plugin initContainer, and adds unit tests to validate the new mappings.

Changes:

  • Add new configuration constants and short-name mappings for controller and initContainer (veleroPluginForMicrosoftAzure) resource requests/limits.
  • Enhance config normalization to accept canonical “full-path” keys case-insensitively and strip whitespace.
  • Add unit tests covering short-name mappings, full-path pass-through, and BSL validation behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/k8s-extension/azext_k8s_extension/partner_extensions/DataProtectionKubernetes.py Adds controller/plugin resource config keys and expands config normalization/recognition logic.
src/k8s-extension/azext_k8s_extension/tests/latest/test_data_protection_kubernetes.py Adds unit tests for the new mapping/normalization behavior and validation paths.

# --------------------------------------------------------------------------------------------

import unittest
from unittest.mock import patch
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patch is imported but never used in this test module. This will be flagged by linting and should be removed (or used if intended).

Suggested change
from unittest.mock import patch

Copilot uses AI. Check for mistakes.
Comment on lines 225 to 228
if validate_bsl:
for key in self.bsl_configuration_settings:
if key.lower() not in input_configuration_keys:
raise RequiredArgumentMissingError(f"Missing required configuration setting: {key}")
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__validate_and_map_config now recognizes canonical full-path keys (including the backup storage location paths), but the required BSL validation only checks for the short-name keys (e.g., blobContainer). If a user provides the required BSL settings using the full-path keys, this will still raise RequiredArgumentMissingError even though the keys are otherwise recognized later in the method. Consider updating the validation to accept either short-name or canonical full-path variants (or restrict full-path recognition to non-required settings).

Copilot uses AI. Check for mistakes.
Comment on lines 233 to +240
for key in input_configuration_settings:
_key = key.lower()
if _key in self.configuration_mapping:
configuration_settings[self.configuration_mapping[_key]] = configuration_settings.pop(key).strip()
elif _key in recognized_full_paths_lower:
# User provided the full configuration path directly - normalize to canonical form
canonical = recognized_full_paths_lower[_key]
configuration_settings[canonical] = configuration_settings.pop(key).strip()
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When both a short-name key and its corresponding canonical full-path key are provided (e.g., cpuLimit and resources.limits.cpu), the current loop can overwrite one with the other based on dict insertion order, and may even pop the value that was just normalized. Please make precedence explicit (for example: prefer the explicit full-path key, or detect duplicates and raise/ignore deterministically) to avoid surprising configuration results.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 4, 2026

Hi @priyansh17

Release Suggestions

Module: k8s-extension

  • Please log updates into to src/k8s-extension/HISTORY.rst
  • Update VERSION to 1.7.1 in src/k8s-extension/setup.py

Notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AKS Auto-Assign Auto assign by bot customer-reported Issues that are reported by GitHub users external to the Azure organization.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants