31 Commits

Author SHA1 Message Date
Marcelo Guerrero Viveros
d71d0f2da1 Fix revive linter errors
Golangci-lint is now running version 1.52.1. This introduced some errors.

Signed-off-by: Marcelo Guerrero Viveros <marguerr@redhat.com>
2023-03-24 21:04:39 +01:00
Matthieu MOREL
d12b81dec5 ci(lint): setup golangci-lint
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2023-03-01 06:55:40 +00:00
SilverBut
a1051f3bf1 dhcp ipam: rename inconsistent options among files
Signed-off-by: SilverBut <SilverBut@users.noreply.github.com>
2021-10-02 23:49:59 +08:00
SilverBut
2bebd89aa2 dhcp ipam: support customizing dhcp options
Signed-off-by: SilverBut <SilverBut@users.noreply.github.com>
2021-10-02 22:48:05 +08:00
SilverBut
6d1f71e55a dhcp ipam: print error correctly without format string
Signed-off-by: SilverBut <SilverBut@users.noreply.github.com>
2021-10-02 22:40:44 +08:00
SilverBut
24259e7d21 dhcp ipam: using full config to regular the code
Signed-off-by: SilverBut <SilverBut@users.noreply.github.com>
2021-10-02 22:40:19 +08:00
SilverBut
7cb3453c36 dhcp: remove implemented TODO
Signed-off-by: SilverBut <SilverBut@users.noreply.github.com>
2021-09-30 13:10:45 +00:00
Dan Williams
dd3f6064f6 dhcp: add -resendmax option to limit lease acquisition time for testcases
The default lease acquisition timeout of 62 seconds is way too long when
running multiple testcases, overrunning the `go test` timeout of 10m. Let
testcases specify a shorter timeout.

Signed-off-by: Dan Williams <dcbw@redhat.com>
2021-02-12 14:41:38 -06:00
Dan Williams
7d8c767622 plugins: update to spec version 1.0.0
Signed-off-by: Dan Williams <dcbw@redhat.com>
2021-02-11 23:27:08 -06:00
Micah Hausler
fa48f7515b ipam/dhcp: Add broadcast flag
Signed-off-by: Micah Hausler <hausler.m@gmail.com>
2021-02-05 16:38:32 +01:00
toby lorne
a8d1f5cd1b dhcp: default dhcp clien timeout is 10s
Consistent with ef524ad9cb/client.go (L39)

Signed-off-by: toby lorne <toby@toby.codes>
Co-authored-by: bruce ma <brucema19901024@gmail.com>
2021-01-13 19:24:41 +00:00
toby lorne
25fc741e37 dhcp: daemon dhcp client timeout is configurable
Fixes #470

Signed-off-by: toby lorne <toby@toby.codes>
2021-01-11 22:13:54 +00:00
Casey Callendrello
72f2a1ffd4 plugins: correctly output build version, cosmetic cleanups
Now that libcni has the ability to print a version message, plumb it
through correctly.

While we're at it,
- fix import paths
- run gofmt
- add some more comments to sample
- add container runtime swappability for release
2019-04-15 16:52:07 +02:00
Casey Callendrello
fbd9accd14
Merge pull request #268 from s1061123/fix/dhcp_daemon_hostprefix
Fix -hostprefix option
2019-04-08 12:53:09 +02:00
Michael Cambria
74a2596573 Add check support for: bridge, ipvlan, macvlan, p2p, vlan and host-device main plugins
host-local and static ipam plugins
  tuning, bandwidth and portmap meta plugins

  Utility functions created for common PrevResult checking

  Fix windows build
2019-04-03 13:08:07 -04:00
Tomofumi Hayashi
4ec62ac295 Fix -hostprefix option
Fix #267
2019-03-26 18:27:46 +09:00
Michael Cambria
22b11bb367 Keep defaultSocketPath the same as before 2018-10-10 11:35:57 -04:00
Michael Cambria
6d3215a256 Allow socket path used by dhcp plugin to be supplied via dhcp ipam configuration
Allow socket path to be supplied as flag when starting dhcp daemon
2018-10-08 11:30:01 -04:00
Casey Callendrello
68b4efb405 plugins/* stub-out GET functions so plugins build with v0.7 2018-06-15 15:28:53 +02:00
Jizhong Jiang
fdc602c0f0 clean duplicated error message 2018-02-12 16:47:53 +08:00
Tomofumi Hayashi
9604565b22 Add -hostprefix in DHCP daemon to run the daemon as container
This diff adds -hostprefix option in dhcp daemon. This option
could be used to run dhcp daemon as container because container
cannot touch host's netns directly. The diff changes dhcp daemon
to touch procfs mounted to another path, like '/hostfs/proc'.
2018-01-25 02:00:43 +09:00
Dan Williams
a38dd5f7a0 dhcp: add --pidfile option to DHCP client daemon 2017-06-14 21:41:43 -05:00
Dan Williams
d5acb127b8 spec/plugins: return interface details and multiple IP addresses to runtime
Updates the spec and plugins to return an array of interfaces and IP details
to the runtime including:

- interface names and MAC addresses configured by the plugin
- whether the interfaces are sandboxed (container/VM) or host (bridge, veth, etc)
- multiple IP addresses configured by IPAM and which interface they
have been assigned to

Returning interface details is useful for runtimes, as well as allowing
more flexible chaining of CNI plugins themselves.  For example, some
meta plugins may need to know the host-side interface to be able to
apply firewall or traffic shaping rules to the container.
2017-01-25 11:31:18 -06:00
Dan Williams
befb95977c types: make Result an interface and move existing Result to separate package 2017-01-25 11:31:18 -06:00
Gabe Rosenhouse
536cb5b99b versioning: plugins report a list of supported versions
Further progress on versioning support (Issue #266).
Bump CNI spec version to 0.3.0
2016-09-02 11:26:17 -04:00
Stefan Junker
ed5f8dfeb2 *: appc/cni -> containernetworking/cni
The project has been moved so internally we simply rename everything.
Consumers are recommended to update their vendored version of cni.
2016-05-06 16:40:27 +02:00
Eugene Yakubovich
0becca2e96 Change copyright from CoreOS to CNI authors
CNI is developed by more than just CoreOS, Inc
and the copyright is retained by all CNI
contributors (for their respective contributed code).
2015-09-29 11:51:33 -07:00
Michael Bridgen
b88f173c43 Factor an API out into a module
This takes some of the machinery from CNI and from the rkt networking
code, and turns it into a library that can be linked into go apps.

Included is an example command-line application that uses the library,
called `cnitool`.

Other headline changes:

 * Plugin exec'ing is factored out

The motivation here is to factor out the protocol for invoking
plugins. To that end, a generalisation of the code from api.go and
pkg/plugin/ipam.go goes into pkg/invoke/exec.go.

 * Move argument-handling and conf-loading into public API

The fact that the arguments get turned into an environment for the
plugin is incidental to the API; so, provide a way of supplying them
as a struct or saying "just use the same arguments as I got" (the
latter is for IPAM plugins).
2015-09-16 10:14:39 +01:00
Eugene Yakubovich
30316e3fa9 dhcp: make netns path absolute prior to RPC
The dhcp daemon may be running with a different cwd
and so the netns paths need to be absolute. This patch
also refactors the code to pull out the common, RPC
parts, out into a separate function.
2015-06-15 12:44:43 -07:00
Eugene Yakubovich
33a575f49d Propagate json error object to the caller
When plugin errors out, it prints out a JSON object to stdout
describing the failure. This object needs to be propagated out
through the plugins and to the container runtime. This change
also adds Print method to both the result and error structs
for easy serialization to stdout.
2015-06-09 10:46:28 -07:00
Eugene Yakubovich
c70320b5ed add DHCP IPAM plugin
The plugin binary actually functions in two modes. The first mode
is a regular CNI plugin. The second mode (when stared with "daemon" arg)
runs a DHCP client daemon. When executed as a CNI plugin, it issues
an RPC request to the daemon for actual processing. The daemon is
required since a DHCP lease needs to be maintained by periodically
renewing it. One instance of the daemon can server arbitrary number
of containers/leases.
2015-05-21 13:36:51 -07:00