-
Notifications
You must be signed in to change notification settings - Fork 265
Add NICNetworkConfig CRD for SwiftV2 multitenancy #4239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
13
commits into
master
Choose a base branch
from
copilot/positive-loon
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+527
−7
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
4fc6352
Checkpoint from Copilot CLI for coding agent session
kmurudi a6e0a93
Run make regenerate-crd to fix CI: regenerate zz_generated.deepcopy.g…
Copilot b6fd980
Use require instead of assert for error assertions in NIC NC tests
Copilot b8f8401
Apply suggestions from code review
kmurudi 11f92cc
feat: add podnetwork to display column in NIC-NC
kmurudi 35491b6
feat:add more fields for subnetid networkid
kmurudi 276ae06
fix: change shortname for nicnc
kmurudi eb17ca7
feat: update all nnc fields to nicnc
kmurudi b75f3a2
feat:update CRD fiels as per design review
kmurudi b15850e
feat: validate prefixblocklength check to be 0 or 28 based on subneta…
kmurudi ad7745b
fix: guard PodNetwork CEL validation rules for missing status
kmurudi 630a8c8
Revert "fix: guard PodNetwork CEL validation rules for missing status"
kmurudi 49a527d
Revert "feat: validate prefixblocklength check to be 0 or 28 based on…
kmurudi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| //go:build !ignore_uncovered | ||
| // +build !ignore_uncovered | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| // Important: Run "make" to regenerate code after modifying this file | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // NICNetworkConfig is the Schema for the nicnetworkconfigs API | ||
| // +kubebuilder:resource:shortName=nicnc,scope=Namespaced | ||
| // +kubebuilder:subresource:status | ||
| // +kubebuilder:metadata:labels=managed= | ||
| // +kubebuilder:metadata:labels=owner= | ||
| // +kubebuilder:printcolumn:name="Node",type=string,JSONPath=`.spec.nodeName` | ||
| // +kubebuilder:printcolumn:name="NIC",type=string,JSONPath=`.spec.nicName` | ||
| // +kubebuilder:printcolumn:name="PodNetwork",type=string,JSONPath=`.spec.podNetwork` | ||
| // +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.status` | ||
| type NICNetworkConfig struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Spec NICNetworkConfigSpec `json:"spec,omitempty"` | ||
| Status NICNetworkConfigStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // NICNetworkConfigList contains a list of NICNetworkConfig | ||
| type NICNetworkConfigList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []NICNetworkConfig `json:"items"` | ||
| } | ||
|
|
||
| // NICNetworkConfigSpec defines the desired state of NICNetworkConfig | ||
| type NICNetworkConfigSpec struct { | ||
| // PodNetwork is the name of the PodNetwork | ||
| PodNetwork string `json:"podNetwork"` | ||
| // 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"` | ||
| // SubnetID is the ARM resource ID of the subnet (e.g., /subscriptions/.../subnets/pod-subnet) | ||
| SubnetID string `json:"subnetID"` | ||
| // NetworkID is the VNET GUID or network identifier | ||
| NetworkID string `json:"networkID"` | ||
| // PodAllocations tracks which pods are allocated on this NIC | ||
| // +kubebuilder:validation:Optional | ||
| PodAllocations []PodAllocationRequest `json:"podAllocations,omitempty"` | ||
kmurudi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| // PodAllocationRequest represents a pod's IP allocation request on this NIC | ||
| type PodAllocationRequest struct { | ||
| // PodName is the name of the pod | ||
| PodName string `json:"podName"` | ||
| // PodNamespace is the namespace of the pod | ||
| PodNamespace string `json:"podNamespace"` | ||
| // MTPNC is the name of the MultitenantPodNetworkConfig | ||
| MTPNC string `json:"mtpnc"` | ||
| } | ||
|
|
||
| // PodAllocation represents a pod's IP allocation on this NIC | ||
| type PodAllocation struct { | ||
| // PodName is the name of the pod | ||
| PodName string `json:"podName"` | ||
| // PodNamespace is the namespace of the pod | ||
| PodNamespace string `json:"podNamespace"` | ||
| // AllocatedIP is the IP address allocated to the pod | ||
| AllocatedIP string `json:"allocatedIP"` | ||
| // MTPNC is the name of the MultitenantPodNetworkConfig | ||
| MTPNC string `json:"mtpnc"` | ||
| } | ||
|
|
||
| // NICNetworkConfigStatus defines the observed state of NICNetworkConfig | ||
| type NICNetworkConfigStatus struct { | ||
| // Status indicates the current status of the NIC Network Config | ||
| // +kubebuilder:validation:Enum=Ready;Pending;Error | ||
| Status NICNC `json:"status,omitempty"` | ||
| // NCID is the network container id created for this NIC | ||
| // +kubebuilder:validation:Optional | ||
| NCID string `json:"ncID,omitempty"` | ||
| // PrimaryIP is the primary IP allocated to the network container | ||
| // +kubebuilder:validation:Optional | ||
| PrimaryIP string `json:"primaryIP,omitempty"` | ||
| // MacAddress is the MAC Address of the VM's NIC | ||
| MacAddress string `json:"macAddress,omitempty"` | ||
| // GatewayIP is the gateway ip of the injected subnet | ||
| // +kubebuilder:validation:Optional | ||
| GatewayIP string `json:"gatewayIP,omitempty"` | ||
| // SubnetAddressSpace is the subnet address space of the injected subnet | ||
| // +kubebuilder:validation:Optional | ||
| SubnetAddressSpace string `json:"subnetAddressSpace,omitempty"` | ||
| // AvailableIPs tracks the available IP addresses in this NC block | ||
| // +kubebuilder:validation:Optional | ||
| AvailableIPs []string `json:"availableIPs,omitempty"` | ||
| // PodAllocations tracks the allocated IP addresses to pod mapping. | ||
| // +kubebuilder:validation:Optional | ||
| PodAllocations map[string]PodAllocation `json:"podAllocations,omitempty"` | ||
| // ErrorMessage contains error details if status is Error | ||
| // +kubebuilder:validation:Optional | ||
| ErrorMessage string `json:"errorMessage,omitempty"` | ||
| // CooldownPeriodInSeconds is the cooldown duration before retrying NIC NC operations. | ||
| // +kubebuilder:default=30 | ||
| CooldownPeriodInSeconds int `json:"cooldownPeriodInSeconds,omitempty"` | ||
| // DeviceType is the device type that this NC was created for | ||
| DeviceType DeviceType `json:"deviceType,omitempty"` | ||
| // AccelnetEnabled determines if the CNI will provision the NIC with accelerated networking enabled | ||
| // +kubebuilder:validation:Optional | ||
| AccelnetEnabled bool `json:"accelnetEnabled,omitempty"` | ||
| } | ||
|
|
||
| // NICNC indicates the status of NIC Network Config | ||
| type NICNC string | ||
|
|
||
| const ( | ||
| NICNCReady NICNC = "Ready" | ||
| NICNCPending NICNC = "Pending" | ||
| NICNCError NICNC = "Error" | ||
| ) | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&NICNetworkConfig{}, &NICNetworkConfigList{}) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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