You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is not necessary to mount host `/sys/` or host `/dev/` directories as a volume in a pod in order to use a network device such as SR-IOV VF. The moving of a network interface into the pod network namespace is done automatically by CNI. Mounting the whole `/sys/` or `/dev/` directory in the container will overwrite the network device descriptor inside the container which causes `device not found` or `no such file or directory` error.
5
+
6
+
Network interface statistics can be queried inside the container using the same `/sys/` path as was done when running directly on the host. When running network interfaces in containers, relevant `/sys/` statistics interfaces are available inside the container, such as `/sys/class/net/net1/statistics/`, `/proc/net/tcp` and `/proc/net/tcp6`.
7
+
8
+
For running DPDK applications with SR-IOV VF, device specs (in case of vfio-pci) are automatically attached to the container via the Device Plugin. There is no need to mount the /dev/ directory as a volume in the container as the application can find device specs under `/dev/vfio/` in the container.
Application pods must avoid using `hostNetwork`. Applications may not use the host network, including `nodePort` for network communication. Any networking needs beyond the functions provided by the pod network and ingress/egress proxy must be serviced via a MULTUS connected interface.
5
+
6
+
.CNF requirement
7
+
[IMPORTANT]
8
+
====
9
+
Applications may not use `NodePorts` or the `hostNetwork`.
10
+
11
+
See test case link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-service-type[access-control-service-type]
In OCP, it is possible to run privileged containers that have all of the root capabilities on a host machine, allowing the ability to access resources which are not accessible in ordinary containers. This, however, increases the security risk to the whole cluster. Containers should only request those privileges they need to run their legitimate functions. No containers will be allowed to run with full privileges without an exception.
5
+
6
+
The general guidelines are:
7
+
8
+
. Only ask for the necessary privileges and access control settings for your application.
9
+
10
+
. If the function required by your CNF can be fulfilled by OCP components, your application should not be requesting escalated privilege to perform this function.
11
+
12
+
. Avoid using any host system resource if possible.
13
+
14
+
. Leveraging read only root filesystem when possible.
15
+
16
+
.CNF requirement
17
+
[IMPORTANT]
18
+
====
19
+
Only ask for the necessary privileges and access control settings for your application
20
+
21
+
See test case link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-security-context-non-root-user-check[access-control-security-context-non-root-user-check]
22
+
====
23
+
24
+
.CNF requirement
25
+
[IMPORTANT]
26
+
====
27
+
If the function required by your CNF can be fulfilled by OCP components, your application should not be
28
+
requesting escalated privilege to perform this function.
29
+
30
+
See test case link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-security-context-privilege-escalation[access-control-security-context-privilege-escalation]
31
+
====
32
+
33
+
.CNF requirement
34
+
[IMPORTANT]
35
+
====
36
+
Avoid using any host system resource.
37
+
38
+
See test cases link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-pod-host-ipc[access-control-pod-host-ipc],
See test case link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-pod-host-path[access-control-pod-host-path]
48
+
====
49
+
50
+
.CNF requirement
51
+
[IMPORTANT]
52
+
====
53
+
Do not use host network namespace.
54
+
55
+
See test case link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-namespace[access-control-namespace]
56
+
====
57
+
58
+
.CNF requirement
59
+
[IMPORTANT]
60
+
====
61
+
CNFs may not modify the platform in any way.
62
+
63
+
See test cases link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#platform-alteration-base-image[platform-alteration-base-image], link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#platform-alteration-sysctl-config[platform-alteration-sysctl-config]
Copy file name to clipboardExpand all lines: modules/cnf-best-practices-developer-guide.adoc
+1-106Lines changed: 1 addition & 106 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,109 +16,4 @@ This document is mainly for the developers of CNFs, who need to build high-perfo
16
16
[id="cnf-best-practices-non-goal"]
17
17
== Non-goal
18
18
19
-
This is not a guide on how to build CNF’s functionality.
20
-
21
-
[id="cnf-best-practices-refactoring"]
22
-
== Refactoring
23
-
24
-
NFs should break their software down into the smallest set of microservices as possible. Running monolithic applications inside of a container is not the operating model to be in.
25
-
26
-
It is hard to move a 1000LB boulder. However, it is easy when that boulder is broken down into many pieces (pebbles). All containerized network functions (CNFs) should break apart each piece of the functions/services/processes into separate containers. These containers will still be within kubernetes pods and all of the functions that perform a single task should be within the same namespace.
27
-
28
-
There is a link:https://martinfowler.com/microservices/[quote] from Lewis and Fowler that describes this best:
29
-
30
-
[quote, Lewis and Fowler]
31
-
The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.These services are built around business capabilities and independently deployable by fully automated deployment machinery.
32
-
33
-
[id="cnf-best-practices-cnf-security"]
34
-
== CNF security
35
-
36
-
In OCP, it is possible to run privileged containers that have all of the root capabilities on a host machine, allowing the ability to access resources which are not accessible in ordinary containers. This, however, increases the security risk to the whole cluster. Containers should only request those privileges they need to run their legitimate functions. No containers will be allowed to run with full privileges without an exception.
37
-
38
-
The general guidelines are:
39
-
40
-
. Only ask for the necessary privileges and access control settings for your application.
41
-
42
-
. If the function required by your CNF can be fulfilled by OCP components, your application should not be requesting escalated privilege to perform this function.
43
-
44
-
. Avoid using any host system resource if possible.
45
-
46
-
. Leveraging read only root filesystem when possible.
47
-
48
-
.CNF requirement
49
-
[IMPORTANT]
50
-
====
51
-
Only ask for the necessary privileges and access control settings for your application
52
-
53
-
See test case link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-security-context-non-root-user-check[access-control-security-context-non-root-user-check]
54
-
====
55
-
56
-
.CNF requirement
57
-
[IMPORTANT]
58
-
====
59
-
If the function required by your CNF can be fulfilled by OCP components, your application should not be
60
-
requesting escalated privilege to perform this function.
61
-
62
-
See test case link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-security-context-privilege-escalation[access-control-security-context-privilege-escalation]
63
-
====
64
-
65
-
.CNF requirement
66
-
[IMPORTANT]
67
-
====
68
-
Avoid using any host system resource.
69
-
70
-
See test cases link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-pod-host-ipc[access-control-pod-host-ipc],
See test case link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-pod-host-path[access-control-pod-host-path]
80
-
====
81
-
82
-
.CNF requirement
83
-
[IMPORTANT]
84
-
====
85
-
Do not use host network namespace.
86
-
87
-
See test case link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-namespace[access-control-namespace]
88
-
====
89
-
90
-
.CNF requirement
91
-
[IMPORTANT]
92
-
====
93
-
CNFs may not modify the platform in any way.
94
-
95
-
See test cases link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#platform-alteration-base-image[platform-alteration-base-image], link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#platform-alteration-sysctl-config[platform-alteration-sysctl-config]
It is not necessary to mount host `/sys/` or host `/dev/` directories as a volume in a pod in order to use a network device such as SR-IOV VF. The moving of a network interface into the pod network namespace is done automatically by CNI. Mounting the whole `/sys/` or `/dev/` directory in the container will overwrite the network device descriptor inside the container which causes `device not found` or `no such file or directory` error.
107
-
108
-
Network interface statistics can be queried inside the container using the same `/sys/` path as was done when running directly on the host. When running network interfaces in containers, relevant `/sys/` statistics interfaces are available inside the container, such as `/sys/class/net/net1/statistics/`, `/proc/net/tcp` and `/proc/net/tcp6`.
109
-
110
-
For running DPDK applications with SR-IOV VF, device specs (in case of vfio-pci) are automatically attached to the container via the Device Plugin. There is no need to mount the /dev/ directory as a volume in the container as the application can find device specs under `/dev/vfio/` in the container.
Application pods must avoid using `hostNetwork`. Applications may not use the host network, including `nodePort` for network communication. Any networking needs beyond the functions provided by the pod network and ingress/egress proxy must be serviced via a MULTUS connected interface.
116
-
117
-
.CNF requirement
118
-
[IMPORTANT]
119
-
====
120
-
Applications may not use `NodePorts` or the `hostNetwork`.
121
-
122
-
See test case link:https://github.com/test-network-function/cnf-certification-test/blob/main/CATALOG.md#access-control-service-type[access-control-service-type]
123
-
====
124
-
19
+
This is not a guide on how to build CNF functionality.
NFs should break their software down into the smallest set of microservices as possible. Running monolithic applications inside of a container is not the operating model to be in.
5
+
6
+
It is hard to move a 1000LB boulder. However, it is easy when that boulder is broken down into many pieces (pebbles). All containerized network functions (CNFs) should break apart each piece of the functions/services/processes into separate containers. These containers will still be within kubernetes pods and all of the functions that perform a single task should be within the same namespace.
7
+
8
+
There is a link:https://martinfowler.com/microservices/[quote] from Lewis and Fowler that describes this best:
9
+
10
+
[quote, Lewis and Fowler]
11
+
The microservice architectural style is an approach to developing a single application as a suite of small services, each running in its own process and communicating with lightweight mechanisms, often an HTTP resource API.These services are built around business capabilities and independently deployable by fully automated deployment machinery.
0 commit comments