Commit Graph

58 Commits

Author SHA1 Message Date
Adrian Chiris
5577822b36 Pass DeviceID to each plugin in configuration list
Until today, it was hardcoded that DeviceID will only be
injected for the first CNI in the chain.

This commit modifies multus to pass DeviceID to each network
configuration element in a network configuration list.
This will  allow multiple CNI's to act on DeviceID when CNI
plugins are being chained for a specific network.

The change is required to allow CNI's to ensure network
isolation (introduced in kernel >= 5.2.0 see [1]) for RDMA devices
when exist.

e.g for SR-IOV network:
sriov-cni moves network device associated with the provided DeviceID
to to the container's network namespace.
An "RDMA cni" would do the same for the corresponding RDMA device when
RDMA traffic is desired on the network.

[1] https://patchwork.kernel.org/cover/10810451/
2020-03-12 23:48:03 +09:00
Tomofumi Hayashi
9874c14e23 Replace multus code with NPWG client library code 2019-12-10 14:38:09 +09:00
dougbtv
3a9dd7ed76 Properly uses default-route in annotation to set the gateway. Fixes network status results. 2019-10-29 13:34:24 -04:00
Tomofumi Hayashi
165e23b72c Support gateway in NetworkSelectionElement
Changes config JSON from gateway to default-route, adds Readme, fixes lint

Co-authored-by: dougbtv <dosmith@redhat.com>
2019-10-29 13:34:24 -04:00
Tim Rozet
e8baccff16 Removes duplicate NetworkAttachment CRD ref
The CRD is now defined in the NetworkPlumbingWG org, along with
generated libs for client, listers, informers, and deep copy functions.
Therefore remove the duplicate definition here, and use the standard
definition.

Signed-off-by: Tim Rozet <trozet@redhat.com>
2019-10-21 10:42:49 -04:00
Tomofumi Hayashi
2745e46ed8 Support 'cni-args' in NetworkSelectionElement 2019-10-21 21:33:07 +09:00
Tomofumi Hayashi
adec211ae1 Support CNI RuntimeConfig for portmap/bandwidth/ip/mac
This changes introduce CNI RuntimeConfig for portmap, bandwidth,
ip and mac for latest specification. IP and Mac is previously
applied through CNI_ARGS, but it is changed to RuntimeConfig
for now.
2019-10-16 09:20:11 -04:00
Tomofumi Hayashi
0a2f7b18d3 Improve error/debug message
This diff changes error message with fixed format for easy-to-read
for users.
2019-10-10 10:32:45 -04:00
Tomofumi Hayashi
05df28a58c Remove UnmarshalJSON() for NetworkSelectionElement (#362)
To support non-string variable in NetworkSelectionElement, remove
UnmarshalJSON(). interfaceRequest json is still supported in the
changes.
2019-08-22 11:19:06 -04:00
nicklesimba
9085c84672 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
2019-08-05 15:04:35 -04:00
giovanism
3568756adb Implement custom NetworkSelectionElement Unmarshaler
This Unmarshaler bring back support for pre v3.2 "interfaceRequest"
property.

Signed-off-by: giovanism <giovanism@outlook.co.id>
2019-07-30 07:59:05 +09:00
Nikhil
aeb7870c3f changed 'thejohn' to '_not_type' for readability 2019-07-26 22:10:51 +09:00
Nikhil
989daf4091 hopefully resolved merge conflicts 2019-07-26 22:10:51 +09:00
Nikhil
d4a7aae89c increased code coverage in multus.go and conf.go, also added bug fixes and formatting 2019-07-26 22:10:51 +09:00
Nikhil
f5524e0b9c Fixed unit tests in checkpoint_test.go and conf_test.go 2019-06-28 10:15:21 +09:00
Nikhil
b0e3b05b3c Adding changes so i will have them saved for my remote fork thingy 2019-06-28 10:15:21 +09:00
Tomofumi Hayashi
2fe42c11c7 Fix golint error and make it enable again in travis 2019-06-26 09:30:46 +09:00
Zenghui Shi
6c23cad08d add test cases for device id assignment 2019-05-16 10:05:12 -04:00
Zenghui Shi
91d9964d07 assign device id to pciBusID in delegated config
This allows host-device plugin to recognize
Device PCI address passed from Multus.
It is related to the change in host-device which
enables use of device pci address as a config option:
https://github.com/containernetworking/plugins/pull/300
2019-05-16 10:05:12 -04:00
Abdul Halim
175f7b2f04 fix missing deviceID in NetConfList
This patch fixes the issue described in #289 where deviceID for
delegate plugin was not adding properly if the plugin conf inside
NetConfList.

Change-Id: I1d221f6b0e60a5b888b8e823611dfe12635e6897
Signed-off-by: Abdul Halim <abdul.halim@intel.com>
2019-03-26 12:39:44 +00:00
Abdul Halim
d3c92b4aa2 add kubelet client for Pod resource info
This change introduces kubelet client to get allocated device
information of a Pod from newly added Kubelet grpc service.
For more information please see:
[kubernetes/kubernetes#70508](https://github.com/kubernetes/kubernetes/pull/70508)

Change-Id: I11e58ccdd52662601f445fa24c7d55c225441efc
Signed-off-by: Abdul Halim <abdul.halim@intel.com>
2019-03-22 09:50:53 -04:00
Tomofumi Hayashi
f0bc4fb475 Add multusNamespace/systemNamespaces config
This change provides new configuration parameters, multusNamespace
and systemNamespaces for flexible namespace management.
The change addresses issue #252 and issue #253.
2019-02-08 00:25:35 +09:00
Doug Smith
d9188e4463
Merge pull request #258 from dcbw/teardown-add-cleanup
multus: simplify teardown on add error and clarify error message
2019-02-07 10:10:32 -05:00
Abdul Halim
34231166ae create empty NetworkStatus for empty Result struct
This fixes the issue described in #211 where LoadNetworkStatus is
throwing in errors if a delegate plugin returns empty Result that
contains in IPAM information.

This change will allow ignoreing the errors propagated from parsing
an empty Result and continue with next one.

Change-Id: Ife4b6103de044256233d581fa74759423ed94ff5
2019-02-05 16:16:32 +00:00
Dan Williams
063a3593b8 multus: simplify teardown on add error and clarify error message
Signed-off-by: Dan Williams <dcbw@redhat.com>
2019-02-04 10:55:08 -06:00
Tomofumi Hayashi
e55832cae0 Merge branch 'master' of github.com:intel/multus-cni 2018-12-27 12:20:36 +09:00
dougbtv
de4bed7a60 [feature] Adds a namespace isolation security feature 2018-12-20 06:43:59 +09:00
Tomofumi Hayashi
dd9355c3aa Fix go fmt issue. 2018-12-06 13:42:17 +09:00
Tomofumi Hayashi
a9b40c7841 Fix go vet issue. 2018-12-06 13:34:08 +09:00
Alona Kaplan
f4068d18bd Support IPRequest to specify IP address for interface 2018-11-30 00:16:11 +09:00
Dan Williams
5ef87bfd71 CRD: interfaceRequest -> interface (v1 spec conformance)
Change the Network Attachment Selection Annotation long-form
interface name request JSON key from 'interfaceRequest' to
'interface' to conform with the V1 NPWG spec.
2018-11-09 13:20:51 +09:00
Tomofumi Hayashi
9f00ea47f5 Fix rebase conflicts. 2018-11-09 00:15:35 +09:00
Tomofumi Hayashi
dccb303d6e Remove unnecessary else clause 2018-11-09 00:15:35 +09:00
Tomofumi Hayashi
e505174d94 Change json field name to align with NPWG spec v1. 2018-11-09 00:15:35 +09:00
Tomofumi Hayashi
deb2f2f64c Support MacRequest to specify MAC address for interface 2018-11-09 00:15:35 +09:00
Tomofumi Hayashi
8b94703a4c Add clusterNetwork/defaultNetwork into multus
To support CRD/file/directory, add clusterNetwork/defaultNetwork
in multus.conf file.
2018-11-02 22:54:39 +09:00
Tomofumi Hayashi
4b231c6855 Add unit tests for clusterNetwork/defaultNetworks 2018-11-02 22:54:39 +09:00
Tomofumi Hayashi
5871c8744a Add clusterNetwork/defaultNetwork into multus
To support CRD/file/directory, add clusterNetwork/defaultNetwork
in multus.conf file.
2018-11-02 22:54:39 +09:00
Doug Smith
21cdfe5485 Default network readiness fix conflicts after rebase 2018-10-11 11:27:18 +09:00
Abdul Halim
e3d14b2732 parse kubelet checkpoint file for pod devices
Enabling kubelete checkpoint file  parsing to get Pod device info
so that these device information can be passed into CNI plugins
that need specific device information to work on.

Change-Id: I6630f56adc0a8307f575fc09ce9090c1ffca0337
2018-10-10 11:52:58 +01:00
Mathieu Rohon
a4f5fd4bf0 Add portmap capability support
Signed-off-by: Mathieu Rohon <mathieu.rohon@orange.com>
2018-10-01 06:48:24 +02:00
Tomofumi Hayashi
8e4c092192 Convert bytes to string in Debugf() 2018-08-17 00:43:31 +01:00
Tomofumi Hayashi
7d3626a5c0 Add logging message for debug/error
This changes adds logging message:debug and error. fmt.Errorf() is
wrapped by logging.Errorf() hence all error message is also put to
log file. logging.Debugf() is called at almost function call, so
we could track the code by logging message.
2018-08-17 00:43:31 +01:00
rkamudhan
8bb09518df adding network status features 2018-07-30 14:58:30 +01:00
rkamudhan
707007abba adding k8sclient bug fixes 2018-07-27 23:43:17 +01:00
rkamudhan
7372922617 adding conflist support 2018-07-27 23:43:17 +01:00
Dan Williams
6e440b4fa8 k8sclient: update for removal of Plugin field from NetworkAttachmentDefinition
Plugin went away, replaced by a minimal Spec.Config field so that the CNI
version the thick plugin supports could be indicated. This means we need
to also inject the network name into the minimal CNI JSON config when
loading the Spec.Config if the network name isn't there already.
2018-07-24 14:02:48 +01:00
Dan Williams
4f8c285520 k8sclient: Network -> NetworkAttachmentDefinition
To align with latest spec change clarifying the name of the CRD object.
2018-07-24 14:02:48 +01:00
Tomofumi Hayashi
371b27b16a Incorporate rkamudhan's comment. 2018-07-13 15:10:53 +09:00
Tomofumi Hayashi
6e33bf9921 Add logging feature for debug
This diff adds logging feature for debug.
2018-07-06 14:50:48 +09:00