{"action":"created","issue":{"url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/555","repository_url":"https://api.github.com/repos/BuoyantIO/linkerd","labels_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/555/labels{/name}","comments_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/555/comments","events_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/555/events","html_url":"https://github.com/BuoyantIO/linkerd/pull/555","id":167121185,"number":555,"title":"Use recursive fetch strategy in ConsulDtabStore","user":{"login":"Ashald","id":397987,"avatar_url":"https://avatars.githubusercontent.com/u/397987?v=3","gravatar_id":"","url":"https://api.github.com/users/Ashald","html_url":"https://github.com/Ashald","followers_url":"https://api.github.com/users/Ashald/followers","following_url":"https://api.github.com/users/Ashald/following{/other_user}","gists_url":"https://api.github.com/users/Ashald/gists{/gist_id}","starred_url":"https://api.github.com/users/Ashald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ashald/subscriptions","organizations_url":"https://api.github.com/users/Ashald/orgs","repos_url":"https://api.github.com/users/Ashald/repos","events_url":"https://api.github.com/users/Ashald/events{/privacy}","received_events_url":"https://api.github.com/users/Ashald/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2016-07-22T20:02:43Z","updated_at":"2016-07-25T21:52:40Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/BuoyantIO/linkerd/pulls/555","html_url":"https://github.com/BuoyantIO/linkerd/pull/555","diff_url":"https://github.com/BuoyantIO/linkerd/pull/555.diff","patch_url":"https://github.com/BuoyantIO/linkerd/pull/555.patch"},"body":"This change gives us \"composite\" dtabs support with Consul.\r\nGiven the namespace `ConsulDtabStore` will fetch all the keys\r\nbelow the namespace recursively and combine then in alphabetical\r\norder of keys while dropping empty ones.\r\nIt watches for changes the whole tree of keys."},"comment":{"url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/comments/235097525","html_url":"https://github.com/BuoyantIO/linkerd/pull/555#issuecomment-235097525","issue_url":"https://api.github.com/repos/BuoyantIO/linkerd/issues/555","id":235097525,"user":{"login":"Ashald","id":397987,"avatar_url":"https://avatars.githubusercontent.com/u/397987?v=3","gravatar_id":"","url":"https://api.github.com/users/Ashald","html_url":"https://github.com/Ashald","followers_url":"https://api.github.com/users/Ashald/followers","following_url":"https://api.github.com/users/Ashald/following{/other_user}","gists_url":"https://api.github.com/users/Ashald/gists{/gist_id}","starred_url":"https://api.github.com/users/Ashald/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ashald/subscriptions","organizations_url":"https://api.github.com/users/Ashald/orgs","repos_url":"https://api.github.com/users/Ashald/repos","events_url":"https://api.github.com/users/Ashald/events{/privacy}","received_events_url":"https://api.github.com/users/Ashald/received_events","type":"User","site_admin":false},"created_at":"2016-07-25T21:52:40Z","updated_at":"2016-07-25T21:52:40Z","body":"For convenience, here is the quote from updated readme for Consul storage:\r\n\r\n## Consul\r\n\r\n`io.l5d.consul`\r\n\r\n*experimental*\r\n\r\nStores the dtab in Consul KV storage.  Supports the following options\r\n\r\n* *host* -- Optional. The location of the etcd API.  (default: localhost)\r\n* *port* -- Optional. The port used to connect to the etcd API.  (default: 8500)\r\n* *pathPrefix* -- Optional.  The key path under which dtabs should be stored.  (default: \"/namerd/dtabs\")\r\n* *recursive* -- Optional.  Whether to use recursive strategy to fetch namespaces.  (default: \"false\")\r\n\r\nIn `recursive` mode the storage will look not only at keys that are immediate children of the `pathPrefix`\r\nbut it will traverse the whole tree beneath recursively. The resulting dtab is composed from all non-empty\r\nvalid values beneath the given namespace (sorted in alphabetical order of keys).\r\n\r\nThis may be very useful when you need to modify your dtab in runtime in automated manner and you don't want\r\nto bother with dealing with dtabs syntax - you can just put mutable parts into separate keys and update them as needed.  \r\n\r\nAlthough `recursive` strategy may sound as something complicated at first it's actually very simple. Let's just\r\nlook at an example and see how it will work in `recusrive` and non-`recursive` modes. \r\n\r\nLet's assume that we configured storage `pathPrefix=/namerd/dtabs` and the KV in Consul is as below:\r\n\r\n```\r\nnamerd/\r\n       dtabs/\r\n             sample = \"/foo=>/bar\"\r\n             nested/\r\n                    example = \"/fiz=>/baz\"\r\n                    broken = \"invalid dtab\"\r\n             mydtab = \"/1st=>line\"\r\n             mydtab/\r\n                    a = \"/2nd=>/line\"\r\n                    a/\r\n                      a = \"/3rd=>/line\"\r\n                      b = \"/4th=>/line\"\r\n                    b = \"/5th=>/line\"\r\n                    c/\r\n                      1 = \"/6th=>/line\"\r\n                    empty = \"\"\r\n```\r\n\r\nIf we will list namespaces in non-recursive mode we will see just 2 of them (with their Dtabs given in brackets):\r\n* `sample` (`\"/foo=>/bar\"`)\r\n* `mydtab` (`\"/1st=>line\"`)\r\n\r\nOn the other hand in recursive mode we will see slightly bigger list of namespaces:\r\n* `sample` (`\"/foo=>/bar\"`)\r\n* `nested/` (`\"/fiz=>/baz\"`)\r\n* `nested/example` (`\"/fiz=>/baz\"`)\r\n* `nested/broken` (`\"\"`)\r\n* `mydtab` (`\"/1st=>line\"`)\r\n* `mydtab/` (`/1st=>/line;/2nd=>/line;/3rd=>/line;/4th=>/line;/5th=>/line;/6th=>/line;`)\r\n* `mydtab/a` (`\"/2nd=>/line\"`)\r\n* `mydtab/a/` (`\"/3rd=>/line;/4th=>/line\"`)\r\n* `mydtab/a/a` (`\"/3rd=>/line\"`)\r\n* `mydtab/a/b` (`\"/4th=>/line\"`)\r\n* `mydtab/b` (`\"/5th=>/line\"`)\r\n* `mydtab/c/` (`\"/6th=>/line\"`)\r\n* `mydtab/c/1` (`\"/6th=>/line\"`)\r\n* `mydtab/empty` (`\"\"`)\r\n\r\nSo the rule is simple: everything that doesn't end with `/` is a key that can has some value.\r\nEverything that ends with `/` is a 'virtual namespace' that aggregates other keys.\r\n \r\nWith regards to `namerd` API there is only 1 restriction - you cannot create/update 'virtual namespaces'.\r\nBut you can read and delete them (removal of a 'virtual namespace' will recursively remove everything beneath it).\r\n"}}
{"actor":{"display_login":"Ashald"}}