Skip to content

feat: add multi-subscription support for AzureNodeClass#1580

Draft
comtalyst wants to merge 2 commits intocomtalyst/azurenodeclass-v4from
comtalyst/multi-sub-v4
Draft

feat: add multi-subscription support for AzureNodeClass#1580
comtalyst wants to merge 2 commits intocomtalyst/azurenodeclass-v4from
comtalyst/multi-sub-v4

Conversation

@comtalyst
Copy link
Copy Markdown
Collaborator

Summary

Adds per-NodeClass subscription, resource group, and location overrides for AzureNodeClass, enabling VM creation across multiple Azure subscriptions.

  • subscriptionID, resourceGroup, location fields on AzureNodeClass CRD
  • AZClientManager: lazily creates and caches per-subscription Azure SDK clients (VM, NIC, extensions) using a shared TokenCredential
  • beginLaunchAzureVM resolves effective sub/RG/location from NodeClass overrides with controller-level fallbacks
  • Per-subscription NIC and VM creation via createSimpleNICWithClients and createVirtualMachineWithClients
  • Error cleanup targets the correct subscription/RG

Stacks on PR #1579.

Test plan

  • go build && go vet pass
  • Unit tests for AZClientManager (default sub, lazy creation, caching)
  • Unit tests for multi-sub field resolution
  • E2E: create VM in a non-default subscription

🤖 Generated with Claude Code

@comtalyst comtalyst force-pushed the comtalyst/multi-sub-v4 branch 3 times, most recently from bf471b3 to eaa8e44 Compare March 24, 2026 09:39
@comtalyst comtalyst force-pushed the comtalyst/azurenodeclass-v4 branch from ba1fd8b to 4571be4 Compare March 24, 2026 21:01
@comtalyst comtalyst force-pushed the comtalyst/multi-sub-v4 branch from eaa8e44 to 822bc0c Compare March 24, 2026 21:02
@comtalyst comtalyst added the experimental-please-ignore Issues or PRs that should be ignored unless been told otherwise. label Apr 1, 2026
@comtalyst comtalyst force-pushed the comtalyst/azurenodeclass-v4 branch from 08a4b7d to 2b75465 Compare April 3, 2026 11:21
comtalyst and others added 2 commits April 3, 2026 12:02
Add per-NodeClass subscription, resource group, and location overrides
so VMs can be provisioned across multiple Azure subscriptions from a
single Karpenter controller. This enables scenarios where workloads
need VMs in different subscriptions or regions while sharing one
control plane.

Changes:
- Add SubscriptionID, ResourceGroup, Location fields to AzureNodeClassSpec
  with getter methods and deepcopy support
- Create AZClientManager that lazily creates and caches per-subscription
  Azure SDK clients (VM, NIC, extensions) using a shared TokenCredential
- Wire AZClientManager into DefaultVMProvider; beginLaunchAzureVM now
  resolves effective sub/RG/location from NodeClass overrides with
  fallback to controller-level defaults
- Add createSimpleNICWithClients and createVirtualMachineWithClients
  variants that accept explicit client + resource group parameters
- Update cleanup path (BeginCreateAzureVM error handling) to use
  per-subscription clients for correct resource cleanup
- Update operator.go and test environment to construct AZClientManager

The identity backing the controller must have RBAC across all target
subscriptions. When no overrides are set, behavior is identical to
before (default subscription clients are reused without extra allocation).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…bnet validation

Three features for AzureNodeClass multi-subscription support:

1. Per-NodeClass Managed Identities: Add managedIdentities field to
   AzureNodeClassSpec that merges with global --node-identities flag.
   Case-insensitive ARM resource ID deduplication ensures no conflicts.

2. Multi-subscription List/Get/Delete: VMs created in non-default
   subscriptions are now visible to lifecycle operations. Tracks known
   subscription+RG pairs from Create, then queries all known subs in
   List (via ARG), Get (fallback search), Delete (fallback cleanup),
   GetNic, ListNics, and DeleteNic.

3. AzureNodeClass Subnet Validation: Status controller now validates
   VNETSubnetID exists, with cross-subscription support via
   AZClientManager. Adds SubnetsReady condition and SubnetsClient to
   SubscriptionClients. Exposes AZClientManager on the Operator struct.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@comtalyst comtalyst force-pushed the comtalyst/multi-sub-v4 branch from 822bc0c to fa95176 Compare April 3, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

experimental-please-ignore Issues or PRs that should be ignored unless been told otherwise.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant