{"action":"created","comment":{"url":"https://api.github.com/repos/miekg/coredns/pulls/comments/65799181","id":65799181,"diff_hunk":"@@ -0,0 +1,147 @@\n+package k8sclient\n+\n+import (\n+//    \"fmt\"\n+    \"net/url\"\n+)\n+\n+// API strings\n+const (\n+    api_base   = \"/api/v1\"\n+    api_namespaces = \"/namespaces\"\n+    api_services   = \"/services\"\n+)\n+\n+// Defaults\n+const (\n+    default_baseurl = \"http://localhost:8080\"\n+)\n+\n+\n+type K8sConnector struct {\n+    baseUrl string\n+}\n+\n+func (self *K8sConnector) SetBaseUrl(u string) error {\n+    valid_url, error := url.Parse(u)\n+\n+    if error != nil {\n+        return error\n+    }\n+    self.baseUrl = valid_url.String()\n+\n+    return nil\n+}\n+\n+func (self *K8sConnector) GetBaseUrl() string {\n+    return self.baseUrl\n+}\n+\n+\n+func (self *K8sConnector) GetResourceList() *ResourceList {\n+    resources := new(ResourceList)\n+    \n+    error := getJson((self.baseUrl + api_base), resources)\n+    if error != nil {\n+        return nil\n+    }\n+\n+    return resources\n+}\n+\n+\n+func (self *K8sConnector) GetNamespaceList() *NamespaceList {\n+    namespaces := new(NamespaceList)\n+\n+    error := getJson((self.baseUrl + api_base + api_namespaces), namespaces)\n+    if error != nil {\n+        return nil\n+    }\n+\n+    return namespaces\n+}\n+\n+\n+func (self *K8sConnector) GetServiceList() *ServiceList {\n+    services := new(ServiceList)\n+\n+    error := getJson((self.baseUrl + api_base + api_services), services)\n+    if error != nil {\n+        return nil\n+    }\n+\n+    return services\n+}\n+\n+\n+func (self *K8sConnector) GetNamespaceNames() []string {\n+    /*\n+     * Return list of namespace names found in k8s.\n+     */\n+    var namespaces []string\n+    return namespaces\n+}\n+\n+\n+func (self *K8sConnector) NamespaceExists(name string) bool {\n+    /*\n+     * Return true if namespace exists in k8s\n+     */\n+    var exists bool\n+    return exists\n+}\n+\n+\n+func (self *K8sConnector) ServiceExists(namespace string, name string) bool {\n+    var exists bool\n+    return exists\n+}\n+\n+\n+func (self *K8sConnector) GetServiceNamesInNamespace(namespace string) []string {\n+    var names []string\n+    return names","path":"middleware/kubernetes/k8sclient/k8sclient.go","position":103,"original_position":103,"commit_id":"278c2f93635346dcfd134c7ed49cbdd789693137","original_commit_id":"278c2f93635346dcfd134c7ed49cbdd789693137","user":{"login":"miekg","id":353371,"avatar_url":"https://avatars.githubusercontent.com/u/353371?v=3","gravatar_id":"","url":"https://api.github.com/users/miekg","html_url":"https://github.com/miekg","followers_url":"https://api.github.com/users/miekg/followers","following_url":"https://api.github.com/users/miekg/following{/other_user}","gists_url":"https://api.github.com/users/miekg/gists{/gist_id}","starred_url":"https://api.github.com/users/miekg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miekg/subscriptions","organizations_url":"https://api.github.com/users/miekg/orgs","repos_url":"https://api.github.com/users/miekg/repos","events_url":"https://api.github.com/users/miekg/events{/privacy}","received_events_url":"https://api.github.com/users/miekg/received_events","type":"User","site_admin":false},"body":"uhm, placeholder empty function?","created_at":"2016-06-04T07:49:45Z","updated_at":"2016-06-04T07:49:45Z","html_url":"https://github.com/miekg/coredns/pull/153#discussion_r65799181","pull_request_url":"https://api.github.com/repos/miekg/coredns/pulls/153","_links":{"self":{"href":"https://api.github.com/repos/miekg/coredns/pulls/comments/65799181"},"html":{"href":"https://github.com/miekg/coredns/pull/153#discussion_r65799181"},"pull_request":{"href":"https://api.github.com/repos/miekg/coredns/pulls/153"}}},"pull_request":{"url":"https://api.github.com/repos/miekg/coredns/pulls/153","id":72416485,"html_url":"https://github.com/miekg/coredns/pull/153","diff_url":"https://github.com/miekg/coredns/pull/153.diff","patch_url":"https://github.com/miekg/coredns/pull/153.patch","issue_url":"https://api.github.com/repos/miekg/coredns/issues/153","number":153,"state":"open","locked":false,"title":"BK8s datasource middleware -- PoC for A records","user":{"login":"mrichmon","id":708759,"avatar_url":"https://avatars.githubusercontent.com/u/708759?v=3","gravatar_id":"","url":"https://api.github.com/users/mrichmon","html_url":"https://github.com/mrichmon","followers_url":"https://api.github.com/users/mrichmon/followers","following_url":"https://api.github.com/users/mrichmon/following{/other_user}","gists_url":"https://api.github.com/users/mrichmon/gists{/gist_id}","starred_url":"https://api.github.com/users/mrichmon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrichmon/subscriptions","organizations_url":"https://api.github.com/users/mrichmon/orgs","repos_url":"https://api.github.com/users/mrichmon/repos","events_url":"https://api.github.com/users/mrichmon/events{/privacy}","received_events_url":"https://api.github.com/users/mrichmon/received_events","type":"User","site_admin":false},"body":"Initial PoC for kubernetes middleware.\r\n\r\nImplementation is rough but demonstrates A record lookup based on kubernetes service name. The CoreFile defines the zone that maps to the kubernetes middleware. For example, the zone \"coredns.local\". If a service is launched in kubernetes with the name \"mynginx\" in the namespace \"demo\", then the container IP will be resolved by looking up \"mynginx.demo.coredns.local\".\r\n\r\nMore details provided in the file middleware/kubernetes/README.md\r\n\r\nMany outstanding TODO items are described in the README. Additionally: code cleanup, removing remaining etcd-focused code, and providing unittests.","created_at":"2016-06-02T20:59:07Z","updated_at":"2016-06-04T07:49:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2bd00734eab28118f0256a28b453c06a6aa3593c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/miekg/coredns/pulls/153/commits","review_comments_url":"https://api.github.com/repos/miekg/coredns/pulls/153/comments","review_comment_url":"https://api.github.com/repos/miekg/coredns/pulls/comments{/number}","comments_url":"https://api.github.com/repos/miekg/coredns/issues/153/comments","statuses_url":"https://api.github.com/repos/miekg/coredns/statuses/278c2f93635346dcfd134c7ed49cbdd789693137","head":{"label":"Infoblox-CTO:k8s-datasource-middleware","ref":"k8s-datasource-middleware","sha":"278c2f93635346dcfd134c7ed49cbdd789693137","user":{"login":"Infoblox-CTO","id":12451624,"avatar_url":"https://avatars.githubusercontent.com/u/12451624?v=3","gravatar_id":"","url":"https://api.github.com/users/Infoblox-CTO","html_url":"https://github.com/Infoblox-CTO","followers_url":"https://api.github.com/users/Infoblox-CTO/followers","following_url":"https://api.github.com/users/Infoblox-CTO/following{/other_user}","gists_url":"https://api.github.com/users/Infoblox-CTO/gists{/gist_id}","starred_url":"https://api.github.com/users/Infoblox-CTO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Infoblox-CTO/subscriptions","organizations_url":"https://api.github.com/users/Infoblox-CTO/orgs","repos_url":"https://api.github.com/users/Infoblox-CTO/repos","events_url":"https://api.github.com/users/Infoblox-CTO/events{/privacy}","received_events_url":"https://api.github.com/users/Infoblox-CTO/received_events","type":"Organization","site_admin":false},"repo":{"id":57403233,"name":"coredns","full_name":"Infoblox-CTO/coredns","owner":{"login":"Infoblox-CTO","id":12451624,"avatar_url":"https://avatars.githubusercontent.com/u/12451624?v=3","gravatar_id":"","url":"https://api.github.com/users/Infoblox-CTO","html_url":"https://github.com/Infoblox-CTO","followers_url":"https://api.github.com/users/Infoblox-CTO/followers","following_url":"https://api.github.com/users/Infoblox-CTO/following{/other_user}","gists_url":"https://api.github.com/users/Infoblox-CTO/gists{/gist_id}","starred_url":"https://api.github.com/users/Infoblox-CTO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Infoblox-CTO/subscriptions","organizations_url":"https://api.github.com/users/Infoblox-CTO/orgs","repos_url":"https://api.github.com/users/Infoblox-CTO/repos","events_url":"https://api.github.com/users/Infoblox-CTO/events{/privacy}","received_events_url":"https://api.github.com/users/Infoblox-CTO/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Infoblox-CTO/coredns","description":"CoreDNS is a DNS server that runs middleware","fork":true,"url":"https://api.github.com/repos/Infoblox-CTO/coredns","forks_url":"https://api.github.com/repos/Infoblox-CTO/coredns/forks","keys_url":"https://api.github.com/repos/Infoblox-CTO/coredns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Infoblox-CTO/coredns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Infoblox-CTO/coredns/teams","hooks_url":"https://api.github.com/repos/Infoblox-CTO/coredns/hooks","issue_events_url":"https://api.github.com/repos/Infoblox-CTO/coredns/issues/events{/number}","events_url":"https://api.github.com/repos/Infoblox-CTO/coredns/events","assignees_url":"https://api.github.com/repos/Infoblox-CTO/coredns/assignees{/user}","branches_url":"https://api.github.com/repos/Infoblox-CTO/coredns/branches{/branch}","tags_url":"https://api.github.com/repos/Infoblox-CTO/coredns/tags","blobs_url":"https://api.github.com/repos/Infoblox-CTO/coredns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Infoblox-CTO/coredns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Infoblox-CTO/coredns/git/refs{/sha}","trees_url":"https://api.github.com/repos/Infoblox-CTO/coredns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Infoblox-CTO/coredns/statuses/{sha}","languages_url":"https://api.github.com/repos/Infoblox-CTO/coredns/languages","stargazers_url":"https://api.github.com/repos/Infoblox-CTO/coredns/stargazers","contributors_url":"https://api.github.com/repos/Infoblox-CTO/coredns/contributors","subscribers_url":"https://api.github.com/repos/Infoblox-CTO/coredns/subscribers","subscription_url":"https://api.github.com/repos/Infoblox-CTO/coredns/subscription","commits_url":"https://api.github.com/repos/Infoblox-CTO/coredns/commits{/sha}","git_commits_url":"https://api.github.com/repos/Infoblox-CTO/coredns/git/commits{/sha}","comments_url":"https://api.github.com/repos/Infoblox-CTO/coredns/comments{/number}","issue_comment_url":"https://api.github.com/repos/Infoblox-CTO/coredns/issues/comments{/number}","contents_url":"https://api.github.com/repos/Infoblox-CTO/coredns/contents/{+path}","compare_url":"https://api.github.com/repos/Infoblox-CTO/coredns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Infoblox-CTO/coredns/merges","archive_url":"https://api.github.com/repos/Infoblox-CTO/coredns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Infoblox-CTO/coredns/downloads","issues_url":"https://api.github.com/repos/Infoblox-CTO/coredns/issues{/number}","pulls_url":"https://api.github.com/repos/Infoblox-CTO/coredns/pulls{/number}","milestones_url":"https://api.github.com/repos/Infoblox-CTO/coredns/milestones{/number}","notifications_url":"https://api.github.com/repos/Infoblox-CTO/coredns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Infoblox-CTO/coredns/labels{/name}","releases_url":"https://api.github.com/repos/Infoblox-CTO/coredns/releases{/id}","deployments_url":"https://api.github.com/repos/Infoblox-CTO/coredns/deployments","created_at":"2016-04-29T17:55:23Z","updated_at":"2016-04-29T17:55:24Z","pushed_at":"2016-06-03T18:27:20Z","git_url":"git://github.com/Infoblox-CTO/coredns.git","ssh_url":"git@github.com:Infoblox-CTO/coredns.git","clone_url":"https://github.com/Infoblox-CTO/coredns.git","svn_url":"https://github.com/Infoblox-CTO/coredns","homepage":"https://miek.nl/tags/coredns/","size":576,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"miekg:master","ref":"master","sha":"446eaa957d12a9114d4ca467312efb900bc40d5e","user":{"login":"miekg","id":353371,"avatar_url":"https://avatars.githubusercontent.com/u/353371?v=3","gravatar_id":"","url":"https://api.github.com/users/miekg","html_url":"https://github.com/miekg","followers_url":"https://api.github.com/users/miekg/followers","following_url":"https://api.github.com/users/miekg/following{/other_user}","gists_url":"https://api.github.com/users/miekg/gists{/gist_id}","starred_url":"https://api.github.com/users/miekg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miekg/subscriptions","organizations_url":"https://api.github.com/users/miekg/orgs","repos_url":"https://api.github.com/users/miekg/repos","events_url":"https://api.github.com/users/miekg/events{/privacy}","received_events_url":"https://api.github.com/users/miekg/received_events","type":"User","site_admin":false},"repo":{"id":54230994,"name":"coredns","full_name":"miekg/coredns","owner":{"login":"miekg","id":353371,"avatar_url":"https://avatars.githubusercontent.com/u/353371?v=3","gravatar_id":"","url":"https://api.github.com/users/miekg","html_url":"https://github.com/miekg","followers_url":"https://api.github.com/users/miekg/followers","following_url":"https://api.github.com/users/miekg/following{/other_user}","gists_url":"https://api.github.com/users/miekg/gists{/gist_id}","starred_url":"https://api.github.com/users/miekg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miekg/subscriptions","organizations_url":"https://api.github.com/users/miekg/orgs","repos_url":"https://api.github.com/users/miekg/repos","events_url":"https://api.github.com/users/miekg/events{/privacy}","received_events_url":"https://api.github.com/users/miekg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/miekg/coredns","description":"CoreDNS is a DNS server that runs middleware","fork":false,"url":"https://api.github.com/repos/miekg/coredns","forks_url":"https://api.github.com/repos/miekg/coredns/forks","keys_url":"https://api.github.com/repos/miekg/coredns/keys{/key_id}","collaborators_url":"https://api.github.com/repos/miekg/coredns/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/miekg/coredns/teams","hooks_url":"https://api.github.com/repos/miekg/coredns/hooks","issue_events_url":"https://api.github.com/repos/miekg/coredns/issues/events{/number}","events_url":"https://api.github.com/repos/miekg/coredns/events","assignees_url":"https://api.github.com/repos/miekg/coredns/assignees{/user}","branches_url":"https://api.github.com/repos/miekg/coredns/branches{/branch}","tags_url":"https://api.github.com/repos/miekg/coredns/tags","blobs_url":"https://api.github.com/repos/miekg/coredns/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/miekg/coredns/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/miekg/coredns/git/refs{/sha}","trees_url":"https://api.github.com/repos/miekg/coredns/git/trees{/sha}","statuses_url":"https://api.github.com/repos/miekg/coredns/statuses/{sha}","languages_url":"https://api.github.com/repos/miekg/coredns/languages","stargazers_url":"https://api.github.com/repos/miekg/coredns/stargazers","contributors_url":"https://api.github.com/repos/miekg/coredns/contributors","subscribers_url":"https://api.github.com/repos/miekg/coredns/subscribers","subscription_url":"https://api.github.com/repos/miekg/coredns/subscription","commits_url":"https://api.github.com/repos/miekg/coredns/commits{/sha}","git_commits_url":"https://api.github.com/repos/miekg/coredns/git/commits{/sha}","comments_url":"https://api.github.com/repos/miekg/coredns/comments{/number}","issue_comment_url":"https://api.github.com/repos/miekg/coredns/issues/comments{/number}","contents_url":"https://api.github.com/repos/miekg/coredns/contents/{+path}","compare_url":"https://api.github.com/repos/miekg/coredns/compare/{base}...{head}","merges_url":"https://api.github.com/repos/miekg/coredns/merges","archive_url":"https://api.github.com/repos/miekg/coredns/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/miekg/coredns/downloads","issues_url":"https://api.github.com/repos/miekg/coredns/issues{/number}","pulls_url":"https://api.github.com/repos/miekg/coredns/pulls{/number}","milestones_url":"https://api.github.com/repos/miekg/coredns/milestones{/number}","notifications_url":"https://api.github.com/repos/miekg/coredns/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/miekg/coredns/labels{/name}","releases_url":"https://api.github.com/repos/miekg/coredns/releases{/id}","deployments_url":"https://api.github.com/repos/miekg/coredns/deployments","created_at":"2016-03-18T20:56:45Z","updated_at":"2016-05-30T17:17:32Z","pushed_at":"2016-06-03T18:27:20Z","git_url":"git://github.com/miekg/coredns.git","ssh_url":"git@github.com:miekg/coredns.git","clone_url":"https://github.com/miekg/coredns.git","svn_url":"https://github.com/miekg/coredns","homepage":"https://miek.nl/tags/coredns/","size":546,"stargazers_count":144,"watchers_count":144,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":13,"forks":11,"open_issues":13,"watchers":144,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/miekg/coredns/pulls/153"},"html":{"href":"https://github.com/miekg/coredns/pull/153"},"issue":{"href":"https://api.github.com/repos/miekg/coredns/issues/153"},"comments":{"href":"https://api.github.com/repos/miekg/coredns/issues/153/comments"},"review_comments":{"href":"https://api.github.com/repos/miekg/coredns/pulls/153/comments"},"review_comment":{"href":"https://api.github.com/repos/miekg/coredns/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/miekg/coredns/pulls/153/commits"},"statuses":{"href":"https://api.github.com/repos/miekg/coredns/statuses/278c2f93635346dcfd134c7ed49cbdd789693137"}}}}
{"actor":{"display_login":"miekg"}}