{"action":"closed","issue":{"url":"https://api.github.com/repos/coreos/rkt/issues/944","labels_url":"https://api.github.com/repos/coreos/rkt/issues/944/labels{/name}","comments_url":"https://api.github.com/repos/coreos/rkt/issues/944/comments","events_url":"https://api.github.com/repos/coreos/rkt/issues/944/events","html_url":"https://github.com/coreos/rkt/issues/944","id":81183695,"number":944,"title":"networking: allow passing of arbitrary parameters to CNI plugins","user":{"login":"steveeJ","id":1181362,"avatar_url":"https://avatars.githubusercontent.com/u/1181362?v=3","gravatar_id":"","url":"https://api.github.com/users/steveeJ","html_url":"https://github.com/steveeJ","followers_url":"https://api.github.com/users/steveeJ/followers","following_url":"https://api.github.com/users/steveeJ/following{/other_user}","gists_url":"https://api.github.com/users/steveeJ/gists{/gist_id}","starred_url":"https://api.github.com/users/steveeJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveeJ/subscriptions","organizations_url":"https://api.github.com/users/steveeJ/orgs","repos_url":"https://api.github.com/users/steveeJ/repos","events_url":"https://api.github.com/users/steveeJ/events{/privacy}","received_events_url":"https://api.github.com/users/steveeJ/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/coreos/rkt/labels/area/networking","name":"area/networking","color":"bfe5bf"},{"url":"https://api.github.com/repos/coreos/rkt/labels/component/stage0","name":"component/stage0","color":"0052cc"},{"url":"https://api.github.com/repos/coreos/rkt/labels/component/stage1","name":"component/stage1","color":"0052cc"}],"state":"closed","locked":false,"assignee":{"login":"steveeJ","id":1181362,"avatar_url":"https://avatars.githubusercontent.com/u/1181362?v=3","gravatar_id":"","url":"https://api.github.com/users/steveeJ","html_url":"https://github.com/steveeJ","followers_url":"https://api.github.com/users/steveeJ/followers","following_url":"https://api.github.com/users/steveeJ/following{/other_user}","gists_url":"https://api.github.com/users/steveeJ/gists{/gist_id}","starred_url":"https://api.github.com/users/steveeJ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steveeJ/subscriptions","organizations_url":"https://api.github.com/users/steveeJ/orgs","repos_url":"https://api.github.com/users/steveeJ/repos","events_url":"https://api.github.com/users/steveeJ/events{/privacy}","received_events_url":"https://api.github.com/users/steveeJ/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/coreos/rkt/milestones/20","html_url":"https://github.com/coreos/rkt/milestones/v0.8.1","labels_url":"https://api.github.com/repos/coreos/rkt/milestones/20/labels","id":1297984,"number":20,"title":"v0.8.1","description":"","creator":{"login":"jonboulle","id":2601015,"avatar_url":"https://avatars.githubusercontent.com/u/2601015?v=3","gravatar_id":"","url":"https://api.github.com/users/jonboulle","html_url":"https://github.com/jonboulle","followers_url":"https://api.github.com/users/jonboulle/followers","following_url":"https://api.github.com/users/jonboulle/following{/other_user}","gists_url":"https://api.github.com/users/jonboulle/gists{/gist_id}","starred_url":"https://api.github.com/users/jonboulle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonboulle/subscriptions","organizations_url":"https://api.github.com/users/jonboulle/orgs","repos_url":"https://api.github.com/users/jonboulle/repos","events_url":"https://api.github.com/users/jonboulle/events{/privacy}","received_events_url":"https://api.github.com/users/jonboulle/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":12,"state":"open","created_at":"2015-09-09T16:14:38Z","updated_at":"2015-09-11T23:10:48Z","due_on":"2015-09-11T07:00:00Z","closed_at":null},"comments":11,"created_at":"2015-05-26T23:29:22Z","updated_at":"2015-09-11T23:10:48Z","closed_at":"2015-09-11T23:10:48Z","body":"##### EDIT:\r\nThe original issue has been changed semantically and syntactically. It is now about being able to pass `CNI_ARGS` from rkt to the respective CNI plugins.\r\n\r\n---\r\n\r\n##### Deprecated:\r\nA good name for this argument would be `-private-net-args=...`. It should imply `-private-net` if that has not already been passed. This defaults to loading all configured networks and additionally allows to pass arguments specified. \r\n\r\nThe new parameter would allow arbitrary argument passing to network configurations for both main and ipam options. What makes it tricky is that we don't know the options of the plugins upfront. That means that we either restrict this to options that are already defined and we can parse explicitly, or we provide a more generic way. I prefer the latter and that's why I propose the following syntax: JSON, just as in the network definition file.\r\nThis might look and feel chunky but it provides the best functionality to override values, add new options and would even allow to even specify network definitions purely on the command-line.\r\n\r\nThe implementation would roughly look like this:\r\n1. autocomplete string and check if JSON string is valid. (i)\r\n2. check if network name is already defined\r\n    - yes: update the network configuration (in memory or in a tmpfile) and add to userNets. This should be a deep update on the parsed JSON object which would add new key/value pairs and override existing keys.\r\n    - no: create new network configuration (in memory or in a tmpfile) and add to userNets\r\n3. sanity checks on the defined/updated networks (already implemented. it would be convenient to adapt the structure to allow overriding the networks beforehand)\r\n\r\n*Notes:\r\n(i) What I'm still thinking about is if the JSON strings should be quoted on the command line or if we should add the quotes programmatically, and if the whole argument after `=` should be quotes on the command line. I can only see the advantages of being able to specify strings that contain spaces when quoting the strings on the command line.*\r\n\r\nFor the examples assume that network *lan* already exists as a ipvlan network with host-local ipam. In order for the examples to take effect at all `-private-net` would have to be present with either no arguments or the respective network name.\r\n\r\n##### Example 1: override IP for ipam host-local\r\nThis would simply change the IP address.\r\n`-private-net-args=name:lan,ipam:{ip:192.168.0.34}`\r\n\r\n##### Example 2: override main mode and add one ipam host-local route\r\nThis would override the ipvlan mode and add a route for a specific subnet via a specific host.\r\n`-private-net-args=name:lan,mode:l3,ipam:{routes:[{dst:10.0.99.0/16,gw:192.168.0.99}]}`\r\n\r\n##### Example 3: add a new network\r\nThis would add a new bridge network on eth1 without an IPAM plugin.\r\n`-private-net-args=name:eth1-bridge,type:macvlan,master:eth1`"}}