Skip to content

Add NICNetworkConfig CRD for SwiftV2 multitenancy#4239

Open
Copilot wants to merge 13 commits intomasterfrom
copilot/positive-loon
Open

Add NICNetworkConfig CRD for SwiftV2 multitenancy#4239
Copilot wants to merge 13 commits intomasterfrom
copilot/positive-loon

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 25, 2026

  • Investigate CI failure (crdgen workflow failing with "Changes detected. Please run 'make regenerate-crd' locally")
  • Run make regenerate-crd to regenerate CRD files using controller-gen
  • Fix zz_generated.deepcopy.go - controller-gen reordered deepcopy functions alphabetically
  • Verify tests pass after regeneration
  • Use require instead of assert for error assertions in TestEmbedNICNetworkConfig and TestGetNICNetworkConfigs
Original prompt

Now that you have the implementation plan, create a PR with these changes on azure-container-networking github repo

[Chronological Review] 1. User requested creating an implementation plan for a new CRD called "NIC NC" based on a SharePoint Word document 2. Agent explored the existing CRD codebase structure (crd/ directory with nodenetworkconfig, multitenantnetworkcontainer, clustersubnetstate, overlayextensionconfig, multitenancy) 3. SharePoint document fetch failed (401 - auth required) 4. Agent explored existing CRD patterns deeply - nodenetworkconfig as reference, overlayextensionconfig, multitenancy CRDs 5. Agent asked user for document contents - user provided full Go type definitions 6. Agent identified shortName conflict (nnc already used by NodeNetworkConfig) 7. User clarified: add under crd/multitenancy/api/v1alpha1/, no shortName needed, need client.go/embed.go/manifest generation too 8. Agent created plan, entered autopilot mode, implemented all changes 9. PowerShell was unavailable - couldn't run controller-gen/make 10. Agent manually wrote deepcopy methods and CRD manifest YAML 11. Task was marked complete with note about needing to run `make all`

[Intent Mapping]

  • Create new NICNetworkConfig CRD for SwiftV2 feature
  • Place under multitenancy.acn.azure.com/v1alpha1 group
  • Include types, client, embed, manifest, tests
  • No shortName (avoid nnc conflict)

[Technical Inventory]

  • Go CRD with kubebuilder annotations
  • controller-gen for code generation
  • multitenancy.acn.azure.com API group, v1alpha1
  • DeviceType enum reused from podnetwork.go
  • Namespaced scope

[Code Archaeology]

  • Created: nicnetworkconfig.go, manifest YAML
  • Modified: zz_generated.deepcopy.go, embed.go, embed_test.go, client.go

[Progress Assessment]
All 6 todos completed. Task marked complete.

[Recent Commands Analysis]
The final commands were:

  1. view nicnetworkconfig.go and embed_test.go - verification
  2. edit plan.md to mark COMPLETE
  3. task_complete called with summary
1. Conversation Overview: - Primary Objectives: "Create a new CRD called NIC NC based on this word document which already has laid out all the changes & fields for this new CRD for a swiftv2 feature" - Session Context: User wanted to create a plan and implement a new Kubernetes CRD (NICNetworkConfig) in the azure-container-networking repository. The SharePoint document was inaccessible (401 auth), so user pasted the Go type definitions directly. After clarifying questions about placement (multitenancy package), shortName (none), and scope (types + client + embed + manifest), agent created a plan and implemented all changes in autopilot mode. - User Intent Evolution: Started as plan request → user confirmed autopilot implementation → all changes implemented
  1. Technical Foundation:

    • Repository: C:\ACN\azure-container-networking - Azure Container Networking Go project
    • CRD Framework: kubebuilder annotations with controller-gen for code generation
    • API Group: multitenancy.acn.azure.com version v1alpha1 (same as PodNetwork, MTPNC, NodeInfo CRDs)
    • Existing CRD Pattern: Types file → Makefile runs controller-gen → generates deepcopy + manifest YAML → embed.go embeds YAML → client.go provides Install/InstallOrUpdate methods
    • DeviceType enum: Reused from podnetwork.go - values acn.azure.com/vnet-nic and acn.azure.com/infiniband-nic
    • PowerShell: NOT available in environment (pwsh.exe not found) - manual file creation was required instead of running make all
  2. Codebase Status:

    • crd/multitenancy/api/v1alpha1/nicnetworkconfig.go (NEW):

      • Purpose: Defines NICNetworkConfig CRD types for SwiftV2
      • Current State: Created with all types
      • Key Types: NICNetworkConfig (root), NICNetworkConfigList, NICNetworkConfigSpec (podNetwork string, podAllocations []PodAllocationRequest), PodAllocationRequest (podName, podNamespace, mtpnc), PodAllocation (podName, podNamespace, allocatedIP, mtpnc), NICNetworkConfigStatus (status NNCStatus, ncID, primaryIP, macAddress, gatewayIP, subnetAddressSpace, availableIPs []string, podAllocations map[string]PodAllocation, errorMessage, deviceType DeviceType, accelnetEnabled bool), NNCStatus (Ready/Pending/Error)
      • Kubebuilder annotations: scope=Namespaced, subresource:status, metadata labels managed=/owner=, printer columns for NodeName/VNetID/SubnetID/Status
    • crd/multitenancy/manifests/multitenancy.acn.azure.com_nicnetworkconfigs.yaml (NEW):

      • Purpose: CRD manifest YAML for Kubernetes
      • Current State: Manually written (should be regenerated with controller-gen)
      • Contains full OpenAPI v3 schema, printer columns, validation enums
    • crd/multitenancy/api/v1alpha1/zz_generated.deepcopy.go (MODIFIED):

      • Purpose: Auto-generated deepcopy methods
      • Current State: Manually added deepcopy methods for NICNetworkConfig, NICNetworkConfigList, NICNetworkConfigSpec, NICNetworkConfigStatus, PodAllocation, P...

Created from Copilot CLI via the copilot delegate command.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add NIC NC CRD implementation under multitenancy Add NICNetworkConfig CRD for SwiftV2 multitenancy Feb 25, 2026
Copilot AI requested a review from kmurudi February 25, 2026 06:18
@kmurudi kmurudi marked this pull request as ready for review February 25, 2026 06:57
@kmurudi kmurudi requested a review from a team as a code owner February 25, 2026 06:57
Copilot AI review requested due to automatic review settings February 25, 2026 06:57
Copy link
Copy Markdown
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 adds a new NICNetworkConfig Custom Resource Definition (CRD) to support the SwiftV2 multitenancy feature in Azure Container Networking. The CRD is namespaced and placed under the multitenancy.acn.azure.com/v1alpha1 API group. The PR also fixes CI issues by regenerating the deepcopy code and CRD manifests using make regenerate-crd.

Changes:

  • Adds NICNetworkConfig CRD type definition with spec (podNetwork, podAllocations) and status fields (ncID, primaryIP, macAddress, gatewayIP, availableIPs, podAllocations map, deviceType, accelnetEnabled)
  • Changes PrefixBlockAllocationSize field to PrefixBlockCIDRLength in PodNetwork CRD - see how size is used /28 not 16 to mention number of IPs
  • Generates CRD manifest YAML with OpenAPIv3 schema and validation
  • Implements client methods for installing and updating the CRD
  • Adds embed functionality for downstream consumers
  • Regenerates all deepcopy code using controller-gen v0.18.0

Reviewed changes

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

Show a summary per file
File Description
crd/multitenancy/api/v1alpha1/nicnetworkconfig.go New CRD type definition with NICNetworkConfigSpec and NICNetworkConfigStatus
crd/multitenancy/manifests/multitenancy.acn.azure.com_nicnetworkconfigs.yaml Generated CRD manifest with OpenAPIv3 schema and printer columns
crd/multitenancy/api/v1alpha1/zz_generated.deepcopy.go Regenerated deepcopy methods for all types including new NICNetworkConfig types
crd/multitenancy/embed.go Added embed variable and getter function for NICNetworkConfig CRD
crd/multitenancy/embed_test.go Added tests for NICNetworkConfig embed functionality
crd/multitenancy/client.go Added InstallNICNetworkConfig and InstallOrUpdateNICNetworkConfig methods

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

type NICNetworkConfigStatus struct {
// Status indicates the current status of the NIC Network Config
// +kubebuilder:validation:Enum=Ready;Pending;Error
Status NNCStatus `json:"status,omitempty"`
Copy link
Copy Markdown
Contributor

@kmurudi kmurudi Mar 9, 2026

Choose a reason for hiding this comment

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

do we need to add a cooldownTime field now for NIC-NC status? if we decided on the deletion/cleanup path of NIC NC. @ravisraju @prmathur-microsoft

@kmurudi kmurudi force-pushed the copilot/positive-loon branch from d1cf31a to b75f3a2 Compare March 24, 2026 09:11
@kmurudi kmurudi force-pushed the copilot/positive-loon branch from bde4205 to b15850e Compare March 24, 2026 22:20
// NodeName is the name of the node this NIC belongs to
NodeName string `json:"nodeName"`
// NICName is the name of the physical NIC on the node (e.g., eth1)
NICName string `json:"nicName"`
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.

change to device-id or macaddress

kmurudi and others added 3 commits March 27, 2026 13:34
CEL rules referencing self.status.prefixBlockCIDRLength fail with
'no such key: status' on newly created PodNetwork objects that have
no status populated yet. Add !has(self.status) guard before accessing
nested status fields.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.

3 participants