Skip to content

feat: support compute quota categories - #1921

Merged
Matthew Christopher (matthchr) merged 2 commits into
mainfrom
matthchr/quota-categories
Sep 18, 2026
Merged

Matthew Christopher (matthchr) merged 2 commits into
mainfrom
matthchr/quota-categories

Conversation

@matthchr

@matthchr Matthew Christopher (matthchr) commented Sep 18, 2026 •

Copy link
Copy Markdown
Member
  • If category is enabled, use it.
  • If not, don't.
  • Note that I have not currently tested this on a real subscription with categories enabled because we don't currently have one, but given that it definitely won't work without this change I think this is at least a good start and I can do some more testing in parallel

How was this change tested?

Does this change impact docs?

  • Yes, PR includes docs updates
  • Yes, issue opened: #
  • No

Release Note


* If category is enabled, use it.
* If not, don't.
Copilot AI lite review requested due to automatic review settings September 18, 2026 00:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟑 Changes recommended

Resolve the Compute Limit permission and production-path coverage concerns, and ensure mappings are recorded when category usage is absent.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds Azure Compute Limit quota-category support, including VM-family mapping, client wiring, test fakes, and dependency updates.

Changes:

  • Adds category-aware quota resolution.
  • Integrates the Compute Limit API and test environment.
  • Expands unit, controller, and pagination coverage.
  • Adds the Compute Limit SDK dependency.
File summaries
File Summary
pkg/test/environment.go Updates test environment wiring.
pkg/providers/quota/quota.go Implements category-aware quota logic.
pkg/providers/quota/quota_test.go Tests mappings and failure handling.
pkg/providers/instancetype/suite_test.go Tests category-based offering filtering.
pkg/providers/azclient/azclient.go Adds the Compute Limit client integration.
pkg/operator/operator.go Wires the new quota client.
pkg/fake/vmfamiliesapi.go Adds the paginated API fake.
pkg/fake/vmfamiliesapi_test.go Tests fake pagination.
pkg/controllers/quota/suite_test.go Tests category refresh and staleness behavior.
go.sum Records dependency checksums.
go.mod Adds the Compute Limit SDK dependency.
Review details

Suppressed comments (2)

pkg/providers/azclient/azclient.go:236

  • [High][Test Coverage] The new production path constructs and uses the Compute Limit VM-families endpoint, but all added tests substitute the service with a fake pager; the linked E2E run is a regression run, and the PR notes there is no category-enabled subscription behind it. A wrong API version or route, missing RBAC, or different response shape could therefore pass CI while quota filtering remains ineffective or reconciliation fails. Add a live E2E/integration check with a category-enabled subscription, or an equivalent recorded contract test, before relying on this path.
	quotaCategoryVMFamilyMappingAPI, err := armcomputelimit.NewVMFamiliesClient(cfg.SubscriptionID, cred, opts)
	if err != nil {
		return nil, err
	}

pkg/providers/quota/quota.go:119

  • [Medium][Correctness] Once generalPurposeCategory is present, quota categories are enabled, but this condition records a family mapping only when the category usage entry is also present. If Azure returns the mapping while that usage entry is temporarily absent, GetUsage falls back to the family-specific quota and can mark on-demand offerings available from a quota that no longer governs the family. Record the mapping for every succeeded VM-family response so a missing category usage causes the existing fail-open path instead.
		for familyName, categoryName := range familyToCategory {
			if _, ok := freshUsages[categoryName]; ok {
				freshFamilyToQuotaName[familyName] = categoryName
			}
  • Files reviewed: 10/11 changed files
  • Comments generated: 1
  • Review effort level: Lite

πŸ’‘ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/providers/azclient/azclient.go Resolved
@matthchr
Matthew Christopher (matthchr) merged commit ddec8db into main Sep 18, 2026
19 of 20 checks passed
@matthchr
Matthew Christopher (matthchr) deleted the matthchr/quota-categories branch September 18, 2026 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants