contiv / netplugin

Container networking for various use cases
Apache License 2.0
513 stars 177 forks source link

Refactor netplugin CLI #1078

Closed tiewei closed 6 years ago

tiewei commented 6 years ago

This commit refactors netplugin CLI, it uses "github.com/urfave/cli" now in order to provide configuration from CLI and environment vars, and provides easy way to load from config files too. In details, this commit introduced:

  1. New configs for netmode and fwdmode settings, which needs to match what in etcd;
  2. Improved validation for all CLI/ENV inputs before starting netplugin;
  3. Removed requirement of running as root user, as long as the running user has privilege to run ovs and most networking related CLIs, is good enough;
  4. Option "-cluster-store" has been reworked, replaced by "--etcd-endpoints" and "--consul-endpoints", so that it will be easy to enable https endpoints and adding more than one endpoints for HA;
  5. Option "-config" which reads configuration from stdin has been removed, it will soon be replaced by reading configuration from a real file instead;
  6. Option "-debug" has been replaced by "--log-level", this will allow user to set loglevel to higher level if doesn't want to use INFO level;
  7. Option "-syslog" has been replaced by "--use-syslog" and "--syslog-url", this will make it more clear on syslog settings and endpoint.
  8. Removed Option "-net-driver", because netplugin currently only supports OVS, will add it back when there are second backend type.
  9. Rework state driver and objdb client, make them more flexible to support multi-endpoints model of etcd and consul, and http/https as URL schema.
  10. Updated testing cases in react of all above changes.

Signed-off-by: Wei Tie wtie@cisco.com

tiewei commented 6 years ago

build PR

tiewei commented 6 years ago

build PR

tiewei commented 6 years ago

build PR

tiewei commented 6 years ago

build PR

vhosakot commented 6 years ago

Nice work! Had some comments. Also, did not review the 21 new files vendored in vendor/github.com/urfave.

vhosakot commented 6 years ago

The error Error message did not yield stack trace with CONTIV_TRACE set in core/error_test.go need to refer CONTIV_TRACE as CONTIV_TRACE is not used anymore. Can be corrected in a follow-up PR.