mirror of
https://github.com/k8snetworkplumbingwg/multus-cni.git
synced 2025-10-21 23:48:25 +00:00
Unit tests and update to quickstart guide (#354)
* Added a test for GetLoggingLevel * Added up to 96% coverage for checkpoint.go * Improved coverage of checkpoint.go to 96.4% * Improved coverage of checkpoint.go to 96.4% * Adding changes so i will have them saved for my remote fork thingy * Fixed unit tests in checkpoint_test.go and conf_test.go * Removed unnecessary comments * improved conf code coverage by an amount that is greater than 0! * improved coverage, but line 144 of conf.go needs a look * Added unit tests to multus and types, also fixed a bug in conf.go * added label to import types/020 in types.go * hopefully resolved merge conflicts * increased code coverage in multus.go and conf.go, also added bug fixes and formatting * addressed all comments in review * Updated testing.go with better comments * changed 'thejohn' to '_not_type' for readability * added additional unit tests * added tests to kubeletclient.go * added more unit tests to k8sclient.go and kubeletclient.go * Added network status annotations section to quickstart and added more unit tests * made changes to tests based on code review
This commit is contained in:
@@ -176,6 +176,33 @@ You should note that there's 3 interfaces:
|
||||
* `eth0` our default network
|
||||
* `net1` the new interface we created with the macvlan configuration.
|
||||
|
||||
### Network Status Annotations
|
||||
|
||||
For additional confirmation, use `kubectl describe pod samplepod` and there will be an annotations section, similar to the following:
|
||||
|
||||
```
|
||||
Annotations: k8s.v1.cni.cncf.io/networks: macvlan-conf
|
||||
k8s.v1.cni.cncf.io/networks-status:
|
||||
[{
|
||||
"name": "cbr0",
|
||||
"ips": [
|
||||
"10.244.1.73"
|
||||
],
|
||||
"default": true,
|
||||
"dns": {}
|
||||
},{
|
||||
"name": "macvlan-conf",
|
||||
"interface": "net1",
|
||||
"ips": [
|
||||
"192.168.1.205"
|
||||
],
|
||||
"mac": "86:1d:96:ff:55:0d",
|
||||
"dns": {}
|
||||
}]
|
||||
```
|
||||
|
||||
This metadata tells us that we have two CNI plugins running successfully.
|
||||
|
||||
### What if I want more interfaces?
|
||||
|
||||
You can add more interfaces to a pod by creating more custom resources and then referring to them in pod's annotation. You can also reuse configurations, so for example, to attach two macvlan interfaces to a pod, you could create a pod like so:
|
||||
@@ -198,4 +225,4 @@ EOF
|
||||
|
||||
Note that the annotation now reads `k8s.v1.cni.cncf.io/networks: macvlan-conf,macvlan-conf`. Where we have the same configuration used twice, separated by a comma.
|
||||
|
||||
If you were to create another custom resource with the name `foo` you could use that such as: `k8s.v1.cni.cncf.io/networks: foo,macvlan-conf`, and use any number of attachments.
|
||||
If you were to create another custom resource with the name `foo` you could use that such as: `k8s.v1.cni.cncf.io/networks: foo,macvlan-conf`, and use any number of attachments.
|
Reference in New Issue
Block a user