Skip to content

refactor: extract vminstancenic.go (PR 2/3)#1485

Open
comtalyst wants to merge 1 commit intocomtalyst/vm-path-refactor-1-utilsfrom
comtalyst/vm-path-refactor-2-nic
Open

refactor: extract vminstancenic.go (PR 2/3)#1485
comtalyst wants to merge 1 commit intocomtalyst/vm-path-refactor-1-utilsfrom
comtalyst/vm-path-refactor-2-nic

Conversation

@comtalyst
Copy link
Collaborator

@comtalyst comtalyst commented Mar 5, 2026

Fixes #

Description

Extract NIC construction functions from vminstance.go into vminstancenic.go: createNICOptions, newNetworkInterfaceForVM, applyTemplateToNic, createNetworkInterface.

Add buildAndCreateNIC orchestrator that consolidates backend pool fetching, NSG resolution, and NIC creation (previously scattered inline in beginLaunchInstance). Simplify beginLaunchInstance by replacing inline NIC logic with single buildAndCreateNIC call.

Part 2 of 3 in the VM path refactoring series. Stacked on PR 1 (#1484).

How was this change tested?

  • go build ./... passes
  • go test ./pkg/providers/instance/... passes
  • go test ./pkg/cloudprovider/... passes

Does this change impact docs?

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

Release Note


@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-1-utils branch from 678a458 to 873f8d0 Compare March 5, 2026 20:53
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-2-nic branch from 92508b9 to 9e72b5e Compare March 5, 2026 20:54
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-1-utils branch from 873f8d0 to 5e7f32c Compare March 7, 2026 09:31
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-2-nic branch from 9e72b5e to 94d8d93 Compare March 7, 2026 09:31
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-1-utils branch from 5e7f32c to 4e37401 Compare March 7, 2026 09:46
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-2-nic branch from 94d8d93 to d152b26 Compare March 7, 2026 09:46
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-1-utils branch from 4e37401 to 8841fb2 Compare March 7, 2026 09:48
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-2-nic branch from d152b26 to 38fd0d0 Compare March 7, 2026 09:48
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-1-utils branch from 8841fb2 to 7d04147 Compare March 7, 2026 11:30
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-2-nic branch from 38fd0d0 to e6df9d4 Compare March 7, 2026 11:30
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-1-utils branch from 7d04147 to 937d6d9 Compare March 7, 2026 12:28
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-2-nic branch from e6df9d4 to 8b6d4de Compare March 7, 2026 12:28
@comtalyst comtalyst force-pushed the comtalyst/vm-path-refactor-1-utils branch from 937d6d9 to f7ed3ee Compare March 8, 2026 09:31
Move NIC construction functions from vminstance.go to vminstancenic.go:
- createNICOptions struct
- newNetworkInterfaceForVM
- applyTemplateToNic
- createNetworkInterface

Add buildAndCreateNIC orchestrator that consolidates the NIC creation
logic (backend pools, NSG resolution, NIC construction) previously
scattered inline in beginLaunchInstance.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant