Skip to content

Commit 3ceaadf

Browse files
committed
feat: add nicinterfacenametemplates
Signed-off-by: Fred Rolland <[email protected]>
1 parent cb356ca commit 3ceaadf

File tree

5 files changed

+186
-0
lines changed

5 files changed

+186
-0
lines changed

config/rbac/role.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ rules:
131131
- nicdevices
132132
- nicfirmwaresources
133133
- nicfirmwaretemplates
134+
- nicinterfacenametemplates
134135
verbs:
135136
- create
136137
- delete
@@ -155,6 +156,7 @@ rules:
155156
- nicdevices/status
156157
- nicfirmwaresources/status
157158
- nicfirmwaretemplates/status
159+
- nicinterfacenametemplates/status
158160
verbs:
159161
- get
160162
- patch

controllers/nicclusterpolicy_controller.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ type NicClusterPolicyReconciler struct {
103103
// +kubebuilder:rbac:groups=configuration.net.nvidia.com,resources=nicfirmwaresources/status,verbs=get;update;patch
104104
// +kubebuilder:rbac:groups=configuration.net.nvidia.com,resources=nicfirmwaresources,verbs=get;list;watch;create;update;patch;delete
105105
// +kubebuilder:rbac:groups=configuration.net.nvidia.com,resources=nicfirmwaresources/finalizers,verbs=update
106+
//+kubebuilder:rbac:groups=configuration.net.nvidia.com,resources=nicinterfacenametemplates,verbs=get;list;watch;create;update;patch;delete
107+
//+kubebuilder:rbac:groups=configuration.net.nvidia.com,resources=nicinterfacenametemplates/status,verbs=get;update;patch
106108
// +kubebuilder:rbac:groups=maintenance.nvidia.com,resources=nodemaintenances,verbs=get;list;watch;create;update;patch;delete
107109
// +kubebuilder:rbac:groups=maintenance.nvidia.com,resources=nodemaintenances/status,verbs=get
108110
// +kubebuilder:rbac:groups=spectrumx.nvidia.com,resources=spectrumxrailpoolconfigs,verbs=get;list;watch;create;update;patch;delete

deployment/network-operator/templates/role.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ rules:
148148
- nicdevices
149149
- nicfirmwaresources
150150
- nicfirmwaretemplates
151+
- nicinterfacenametemplates
151152
verbs:
152153
- create
153154
- delete
@@ -172,6 +173,7 @@ rules:
172173
- nicdevices/status
173174
- nicfirmwaresources/status
174175
- nicfirmwaretemplates/status
176+
- nicinterfacenametemplates/status
175177
verbs:
176178
- get
177179
- patch

manifests/state-nic-configuration-operator/002-configuration.net.nvidia.com_nicdevices.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,25 @@ spec:
168168
enabled:
169169
description: Optimize Spectrum X
170170
type: boolean
171+
multiplaneMode:
172+
default: none
173+
description: |-
174+
Multiplane mode to be configured
175+
Can be "none", "swplb", "hwplb", or "uniplane"
176+
enum:
177+
- none
178+
- swplb
179+
- hwplb
180+
- uniplane
181+
type: string
182+
numberOfPlanes:
183+
default: 1
184+
description: Number of planes to be configured
185+
enum:
186+
- 1
187+
- 2
188+
- 4
189+
type: integer
171190
overlay:
172191
default: none
173192
description: |-
@@ -183,11 +202,29 @@ spec:
183202
enum:
184203
- RA1.3
185204
- RA2.0
205+
- RA2.1
186206
type: string
187207
required:
188208
- enabled
189209
- version
190210
type: object
211+
x-kubernetes-validations:
212+
- message: when MultiplaneMode is none, numberOfPlanes must
213+
be 1
214+
rule: '!has(self.multiplaneMode) || !has(self.numberOfPlanes)
215+
|| self.multiplaneMode != ''none'' || self.numberOfPlanes
216+
== 1'
217+
- message: when MultiplaneMode is not none, numberOfPlanes
218+
must not be 1
219+
rule: '!has(self.multiplaneMode) || !has(self.numberOfPlanes)
220+
|| self.multiplaneMode == ''none'' || self.numberOfPlanes
221+
!= 1'
222+
- message: when Version is RA1.3 or RA2.0, MultiplaneMode
223+
must be none and numberOfPlanes must be 1
224+
rule: '!has(self.version) || !has(self.multiplaneMode) ||
225+
!has(self.numberOfPlanes) || !(self.version == ''RA1.3''
226+
|| self.version == ''RA2.0'') || (self.multiplaneMode
227+
== ''none'' && self.numberOfPlanes == 1)'
191228
required:
192229
- linkType
193230
- numVfs
@@ -225,6 +262,40 @@ spec:
225262
- nicFirmwareSourceRef
226263
- updatePolicy
227264
type: object
265+
interfaceNameTemplate:
266+
description: InterfaceNameTemplate specifies the interface name template
267+
to be applied to the NIC
268+
properties:
269+
netDevicePrefix:
270+
description: NetDevicePrefix specifies the prefix for the net
271+
device name
272+
type: string
273+
nicIndex:
274+
description: NicIndex is the index of the NIC in the flattened
275+
list of NICs based on the Template
276+
type: integer
277+
planeIndices:
278+
description: PlaneIndices is the indices of the planes for the
279+
given NIC based on the Template
280+
items:
281+
type: integer
282+
type: array
283+
railIndex:
284+
description: RailIndex is the index of the rail where the given
285+
NIC belongs to based on the Template
286+
type: integer
287+
rdmaDevicePrefix:
288+
description: |-
289+
--- Parameters from the NicInterfaceNameTemplate CR ---
290+
RdmaDevicePrefix specifies the prefix for the rdma device name
291+
type: string
292+
required:
293+
- netDevicePrefix
294+
- nicIndex
295+
- planeIndices
296+
- railIndex
297+
- rdmaDevicePrefix
298+
type: object
228299
type: object
229300
status:
230301
description: NicDeviceStatus defines the observed state of NicDevice
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# 2026 NVIDIA CORPORATION & AFFILIATES
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
---
15+
apiVersion: apiextensions.k8s.io/v1
16+
kind: CustomResourceDefinition
17+
metadata:
18+
annotations:
19+
controller-gen.kubebuilder.io/version: v0.14.0
20+
name: nicinterfacenametemplates.configuration.net.nvidia.com
21+
spec:
22+
group: configuration.net.nvidia.com
23+
names:
24+
kind: NicInterfaceNameTemplate
25+
listKind: NicInterfaceNameTemplateList
26+
plural: nicinterfacenametemplates
27+
singular: nicinterfacenametemplate
28+
scope: Namespaced
29+
versions:
30+
- name: v1alpha1
31+
schema:
32+
openAPIV3Schema:
33+
description: NicInterfaceNameTemplate is the Schema for the nicinterfacenametemplates
34+
API
35+
properties:
36+
apiVersion:
37+
description: |-
38+
APIVersion defines the versioned schema of this representation of an object.
39+
Servers should convert recognized schemas to the latest internal value, and
40+
may reject unrecognized values.
41+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
42+
type: string
43+
kind:
44+
description: |-
45+
Kind is a string value representing the REST resource this object represents.
46+
Servers may infer this from the endpoint the client submits requests to.
47+
Cannot be updated.
48+
In CamelCase.
49+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
50+
type: string
51+
metadata:
52+
type: object
53+
spec:
54+
description: NicInterfaceNameTemplateSpec defines the desired state of
55+
NicInterfaceNameTemplate
56+
properties:
57+
netDevicePrefix:
58+
description: |-
59+
NetDevicePrefix specifies the prefix for the net device name
60+
%nic_id%, %plane_id% and %rail_id% placeholders can be used to construct the device name
61+
%nic_id% is the index of the NIC in the flattened list of NICs
62+
%plane_id% is the index of the plane of the specific NIC
63+
%rail_id% is the index of the rail where the given NIC belongs to
64+
type: string
65+
nodeSelector:
66+
additionalProperties:
67+
type: string
68+
description: NodeSelector contains labels required on the node. When
69+
empty, the template will be applied to matching devices on all nodes.
70+
type: object
71+
pfsPerNic:
72+
description: |-
73+
PfsPerNic specifies the number of PFs per NIC
74+
Used to calculate the number of planes per NIC
75+
type: integer
76+
railPciAddresses:
77+
description: |-
78+
RailPciAddresses defines the PCI address to rail mapping and order
79+
The first dimension is the rail index, the second dimension is the PCI addresses of the NICs in the rail.
80+
The PCI addresses must be sorted in the order of the rails.
81+
Example: [["0000:1a:00.0", "0000:2a:00.0"], ["0000:3a:00.0", "0000:4a:00.0"]] specifies 2 rails with 2 NICs each.
82+
items:
83+
items:
84+
type: string
85+
type: array
86+
type: array
87+
rdmaDevicePrefix:
88+
description: |-
89+
RdmaDevicePrefix specifies the prefix for the rdma device name
90+
%nic_id%, %plane_id% and %rail_id% placeholders can be used to construct the device name
91+
%nic_id% is the index of the NIC in the flattened list of NICs
92+
%plane_id% is the index of the plane of the specific NIC
93+
%rail_id% is the index of the rail where the given NIC belongs to
94+
type: string
95+
required:
96+
- netDevicePrefix
97+
- pfsPerNic
98+
- railPciAddresses
99+
- rdmaDevicePrefix
100+
type: object
101+
status:
102+
description: NicInterfaceNameTemplateStatus defines the observed state
103+
of NicInterfaceNameTemplate
104+
type: object
105+
type: object
106+
served: true
107+
storage: true
108+
subresources:
109+
status: {}

0 commit comments

Comments
 (0)