Skip to content

Add NICNetworkConfig CRD for SwiftV2 multitenancy#4239

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

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

Conversation

Copy link
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.

…o with correct alphabetical ordering

Co-authored-by: kmurudi <26335310+kmurudi@users.noreply.github.com>
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
Co-authored-by: kmurudi <26335310+kmurudi@users.noreply.github.com>
Copilot AI requested a review from kmurudi February 25, 2026 07:02
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 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)
  • 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.

Comment on lines +19 to +21
// +kubebuilder:printcolumn:name="NodeName",type=string,JSONPath=`.spec.nodeName`
// +kubebuilder:printcolumn:name="VNetID",type=string,JSONPath=`.spec.vnetID`
// +kubebuilder:printcolumn:name="SubnetID",type=string,JSONPath=`.spec.subnetID`
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The printer column annotations reference fields (nodeName, vnetID, subnetID) that do not exist in NICNetworkConfigSpec. This will cause kubectl commands to display empty values for these columns. Either these fields need to be added to the spec, or the printer column annotations should be removed or updated to reference existing fields.

Suggested change
// +kubebuilder:printcolumn:name="NodeName",type=string,JSONPath=`.spec.nodeName`
// +kubebuilder:printcolumn:name="VNetID",type=string,JSONPath=`.spec.vnetID`
// +kubebuilder:printcolumn:name="SubnetID",type=string,JSONPath=`.spec.subnetID`

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +29
- jsonPath: .spec.nodeName
name: NodeName
type: string
- jsonPath: .spec.vnetID
name: VNetID
type: string
- jsonPath: .spec.subnetID
name: SubnetID
type: string
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

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

The printer columns reference fields that do not exist in the spec (nodeName, vnetID, subnetID). This is a result of incorrect kubebuilder annotations in the Go type definition. This will cause kubectl get commands to show empty columns.

Suggested change
- jsonPath: .spec.nodeName
name: NodeName
type: string
- jsonPath: .spec.vnetID
name: VNetID
type: string
- jsonPath: .spec.subnetID
name: SubnetID
type: string

Copilot uses AI. Check for mistakes.
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