Skip to content

Commit d725b15

Browse files
authored
Merge pull request #343 from e0ne/update-examples
Update examples
2 parents fb4667d + 92109fa commit d725b15

11 files changed

+163
-13
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Copyright 2021 NVIDIA
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+
apiVersion: mellanox.com/v1alpha1
15+
kind: NicClusterPolicy
16+
metadata:
17+
name: nic-cluster-policy
18+
spec:
19+
ofedDriver:
20+
image: mofed
21+
repository: mellanox
22+
version: 5.5-1.0.3.2
23+
sriovDevicePlugin:
24+
config: |
25+
{
26+
"resourceList": [
27+
{
28+
"resourcePrefix": "nvidia.com",
29+
"resourceName": "hostdev",
30+
"selectors": {
31+
"vendors": ["15b3"],
32+
"isRdma": true
33+
}
34+
}
35+
]
36+
}

example/crs/mellanox.com_v1alpha1_nicclusterpolicy_cr-ocp.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spec:
3333
"resourceName": "rdma_shared_device_a",
3434
"rdmaHcaMax": 1000,
3535
"selectors": {
36-
"ifNames": ["ens2f0"]
36+
"vendors": ["15b3"]
3737
}
3838
}
3939
]

example/crs/mellanox.com_v1alpha1_nicclusterpolicy_cr.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ spec:
4242
"resourceName": "rdma_shared_device_a",
4343
"rdmaHcaMax": 1000,
4444
"selectors": {
45-
"ifNames": ["ens2f0"]
45+
"vendors": ["15b3"],
46+
"deviceIDs": ["101b"]
4647
}
4748
}
4849
]
@@ -59,6 +60,7 @@ spec:
5960
"resourceName": "hostdev",
6061
"selectors": {
6162
"vendors": ["15b3"],
63+
"deviceIDs": ["101d"]
6264
"isRdma": true
6365
}
6466
}

example/hostdevice-network-pod.yml renamed to example/hostdevice-network-pod1.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
apiVersion: v1
22
kind: Pod
33
metadata:
4-
name: test-hostdev-pod
4+
name: test-hostdev-pod-1
55
annotations:
66
k8s.v1.cni.cncf.io/networks: example-hostdevice-network
77
spec:
8+
nodeSelector:
9+
# Note: Replace hostname or remove selector altogether
10+
kubernetes.io/hostname: worker01
811
containers:
912
- name: test-hostdev-pod
1013
image: centos/tools
1114
imagePullPolicy: IfNotPresent
1215
command: [ "/bin/bash", "-c", "--" ]
1316
args: [ "while true; do sleep 300; done;" ]
17+
securityContext:
18+
capabilities:
19+
add: [ "IPC_LOCK" ]
1420
resources:
1521
requests:
1622
nvidia.com/hostdev: '1'
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
apiVersion: v1
2+
kind: Pod
3+
metadata:
4+
name: test-hostdev-pod-2
5+
annotations:
6+
k8s.v1.cni.cncf.io/networks: example-hostdevice-network
7+
spec:
8+
nodeSelector:
9+
# Note: Replace hostname or remove selector altogether
10+
kubernetes.io/hostname: worker02
11+
containers:
12+
- name: test-hostdev-pod
13+
image: centos/tools
14+
imagePullPolicy: IfNotPresent
15+
command: [ "/bin/bash", "-c", "--" ]
16+
args: [ "while true; do sleep 300; done;" ]
17+
securityContext:
18+
capabilities:
19+
add: [ "IPC_LOCK" ]
20+
resources:
21+
requests:
22+
nvidia.com/hostdev: '1'
23+
limits:
24+
nvidia.com/hostdev: '1'

example/sriov-network/infiniband/sriov-ib-network.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ spec:
3232
"log_file" : "/var/log/whereabouts.log",
3333
"log_level" : "info"
3434
}
35-
resourceName: mlnxics
35+
resourceName: mlnxnics
3636
linkState: enable
3737
networkNamespace: default

example/sriov-network/infiniband/sriov-network-node-policy.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ spec:
2828
# network.nvidia.com/operator.mofed.wait: "false"
2929
numVfs: 8
3030
priority: 90
31-
resourceName: mlnxics
31+
resourceName: mlnxnics

example/sriov-network/infiniband/sriov-network-pod.yaml renamed to example/sriov-network/infiniband/sriov-network-pod1.yaml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
apiVersion: v1
1515
kind: Pod
1616
metadata:
17-
name: test-sriov-ib-pod
17+
name: test-sriov-ib-pod-1
1818
annotations:
1919
k8s.v1.cni.cncf.io/networks: example-sriov-ib-network
2020

@@ -25,10 +25,14 @@ spec:
2525
imagePullPolicy: IfNotPresent
2626
command: [ "/bin/bash", "-c", "--" ]
2727
args: [ "while true; do sleep 300; done;" ]
28+
securityContext:
29+
capabilities:
30+
add: [ "IPC_LOCK" ]
2831
resources:
2932
requests:
30-
nvidia.com/mlnxics: "1"
33+
nvidia.com/mlnxnics: "1"
3134
limits:
32-
nvidia.com/mlnxics: "1"
33-
# nodeSelector:
34-
# kubernetes.io/hostname: <worker-node-name>
35+
nvidia.com/mlnxnics: "1"
36+
nodeSelector:
37+
# Note: Replace hostname or remove selector altogether
38+
kubernetes.io/hostname: worker01
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2021 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+
apiVersion: v1
15+
kind: Pod
16+
metadata:
17+
name: test-sriov-ib-pod-2
18+
annotations:
19+
k8s.v1.cni.cncf.io/networks: example-sriov-ib-network
20+
21+
spec:
22+
containers:
23+
- name: test-sriov-ib-pod
24+
image: centos/tools
25+
imagePullPolicy: IfNotPresent
26+
command: [ "/bin/bash", "-c", "--" ]
27+
args: [ "while true; do sleep 300; done;" ]
28+
securityContext:
29+
capabilities:
30+
add: [ "IPC_LOCK" ]
31+
resources:
32+
requests:
33+
nvidia.com/mlnxnics: "1"
34+
limits:
35+
nvidia.com/mlnxnics: "1"
36+
nodeSelector:
37+
# Note: Replace hostname or remove selector altogether
38+
kubernetes.io/hostname: worker02

example/sriov-network/sriov-network-pod.yaml renamed to example/sriov-network/sriov-network-pod1.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,24 @@
1414
apiVersion: v1
1515
kind: Pod
1616
metadata:
17-
name: test-sriov-pod
17+
name: test-sriov-pod-1
1818
annotations:
1919
k8s.v1.cni.cncf.io/networks: example-sriov-network
20-
2120
spec:
2221
containers:
2322
- name: test-sriov-pod
2423
image: centos/tools
2524
imagePullPolicy: IfNotPresent
2625
command: [ "/bin/bash", "-c", "--" ]
2726
args: [ "while true; do sleep 300; done;" ]
27+
securityContext:
28+
capabilities:
29+
add: [ "IPC_LOCK" ]
2830
resources:
2931
requests:
3032
nvidia.com/sriovlegacy: "1"
3133
limits:
3234
nvidia.com/sriovlegacy: "1"
3335
nodeSelector:
34-
feature.node.kubernetes.io/pci-15b3.sriov.capable: "true"
36+
# Note: Replace hostname or remove selector altogether
37+
kubernetes.io/hostname: worker01

0 commit comments

Comments
 (0)