{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/54945170","id":54945170,"diff_hunk":"@@ -23,6 +23,18 @@ import (\n \t\"k8s.io/kubernetes/pkg/util/intstr\"\n )\n \n+const (\n+\t// The annotation value is a string specifying the hostname to be used for the pod e.g 'my-webserver-1'\n+\tPodHostnameAnnotation = \"pod.beta.kubernetes.io/hostname\"\n+\n+\t// The annotation value is a string specifying the subdomain e.g. \"my-web-service\"\n+\t// If specified, on the the pod itself, \"<hostname>.my-web-service.<namespace>.svc.<cluster domain>\" would resolve to\n+\t// the pod's IP.\n+\t// If there is a headless service named \"my-web-service\" in the same namespace as the pod, then,\n+\t// <hostname>.my-web-service.<namespace>.svc.<cluster domain>\" would be resolved by the cluster DNS Server.\n+\tPodSubdomainAnnotation = \"pod.beta.kubernetes.io/subdomain\"","path":"pkg/api/pod/util.go","position":13,"original_position":13,"commit_id":"688151d0fe9d5dce1feb1acefca0d0b7372321f7","original_commit_id":"47257386646c1143b163df97ad97e1f67dfb7a94","user":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"body":"> > +const (\n> > + // The annotation value is a string specifying the hostname to be used for the pod e.g 'my-webserver-1'\n> > + PodHostnameAnnotation = \"pod.beta.kubernetes.io/hostname\"\n> > +\n> > + // The annotation value is a string specifying the subdomain e.g. \"my-web-service\"\n> > + // If specified, on the the pod itself, \"<hostname>.my-web-service.<namespace>.svc.<cluster domain>\" would resolve to\n> > + // the pod's IP.\n> > + // If there is a headless service named \"my-web-service\" in the same namespace as the pod, then,\n> > + // <hostname>.my-web-service.<namespace>.svc.<cluster domain>\" would be resolved by the cluster DNS Server.\n> > + PodSubdomainAnnotation = \"pod.beta.kubernetes.io/subdomain\"\n>\n> @liggitt and I are still confused on this.\n>\n> Also, the pod must be an endpoint for the headless service...\n>\n> Why use a headless service? Why not a service that matches a single pod by label?\n\nI think we started with headless because it seems like the most\nobvious fit, but non-headless could be plausible.  Think of it this\nway: A \"regular\" service means \"all my backends are fungible, I don't\ncare which you use\".  The DNS lookup returns just the cluster IP.  A\nheadless service means \"my individual backends might have some meaning\nthat kube doesn't know about\".  The DNS lookup returns the set of A\nrecords for each backend.  In this PR we are adding the ability to\ngive meaningful names to those backends.  We could give meaningful\nnames to backends of a non=-headless Service, but that's not nearly as\nobviously useful.\n\nSecondly, we don't want to have DNS be watching Pods, if we can avoid\nit.  So this feature actually comes in two parts.  The pod can request\na hostname and domainname, such that `hostname -f` DTRT. If and only\nif you *also* have a (headless) service that matches domainname, will\nyou get a DNS record.  In essence, the pod domainname is how the pod\nindicates that it has a \"primary\" service that governs it.   The most\nobvious case here is a petset.\n\nThis feature should allow a petset controller to stamp out pods with\nhostname and domainname set, create the headless service, and voila -\npetset DNS works.\n\n> This allows the pod to declare that it expects an FQDN and that the form of the FQDN will match the names that we add to DNS for service endpoints.\n>\n> This confuses us. Can you explain why this is needed? It's less obvious to me than the pod hostname.\n\nIt's a little tricky that the pod FQDN is \".svc.cluster.local\".  This\nis first and foremost because we don't want to make DNS watch pods.\nDNS is fundamentally ABOUT services.  This lets a pod \"opt-in\" to\npod-DNS without encouraging every single pod to choose a unique\nhostname and blow out DNS.\n","created_at":"2016-03-03T20:42:55Z","updated_at":"2016-03-03T20:42:55Z","html_url":"https://github.com/kubernetes/kubernetes/pull/20688#discussion_r54945170","pull_request_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20688","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments/54945170"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/20688#discussion_r54945170"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20688"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20688","id":58380712,"html_url":"https://github.com/kubernetes/kubernetes/pull/20688","diff_url":"https://github.com/kubernetes/kubernetes/pull/20688.diff","patch_url":"https://github.com/kubernetes/kubernetes/pull/20688.patch","issue_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/20688","number":20688,"state":"open","locked":false,"title":"Specify Pod hostname by Annotation","user":{"login":"ArtfulCoder","id":1220660,"avatar_url":"https://avatars.githubusercontent.com/u/1220660?v=3","gravatar_id":"","url":"https://api.github.com/users/ArtfulCoder","html_url":"https://github.com/ArtfulCoder","followers_url":"https://api.github.com/users/ArtfulCoder/followers","following_url":"https://api.github.com/users/ArtfulCoder/following{/other_user}","gists_url":"https://api.github.com/users/ArtfulCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ArtfulCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArtfulCoder/subscriptions","organizations_url":"https://api.github.com/users/ArtfulCoder/orgs","repos_url":"https://api.github.com/users/ArtfulCoder/repos","events_url":"https://api.github.com/users/ArtfulCoder/events{/privacy}","received_events_url":"https://api.github.com/users/ArtfulCoder/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-02-05T02:26:59Z","updated_at":"2016-03-03T20:42:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9bd71a93dfb9321b605a5cfd7db9d0bbc4cb752e","assignee":{"login":"thockin","id":5595220,"avatar_url":"https://avatars.githubusercontent.com/u/5595220?v=3","gravatar_id":"","url":"https://api.github.com/users/thockin","html_url":"https://github.com/thockin","followers_url":"https://api.github.com/users/thockin/followers","following_url":"https://api.github.com/users/thockin/following{/other_user}","gists_url":"https://api.github.com/users/thockin/gists{/gist_id}","starred_url":"https://api.github.com/users/thockin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thockin/subscriptions","organizations_url":"https://api.github.com/users/thockin/orgs","repos_url":"https://api.github.com/users/thockin/repos","events_url":"https://api.github.com/users/thockin/events{/privacy}","received_events_url":"https://api.github.com/users/thockin/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/kubernetes/kubernetes/milestones/15","html_url":"https://github.com/kubernetes/kubernetes/milestones/v1.2","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones/15/labels","id":1278499,"number":15,"title":"v1.2","description":"https://github.com/kubernetes/kubernetes/wiki/Release-1.2","creator":{"login":"bgrant0607","id":7725777,"avatar_url":"https://avatars.githubusercontent.com/u/7725777?v=3","gravatar_id":"","url":"https://api.github.com/users/bgrant0607","html_url":"https://github.com/bgrant0607","followers_url":"https://api.github.com/users/bgrant0607/followers","following_url":"https://api.github.com/users/bgrant0607/following{/other_user}","gists_url":"https://api.github.com/users/bgrant0607/gists{/gist_id}","starred_url":"https://api.github.com/users/bgrant0607/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgrant0607/subscriptions","organizations_url":"https://api.github.com/users/bgrant0607/orgs","repos_url":"https://api.github.com/users/bgrant0607/repos","events_url":"https://api.github.com/users/bgrant0607/events{/privacy}","received_events_url":"https://api.github.com/users/bgrant0607/received_events","type":"User","site_admin":false},"open_issues":148,"closed_issues":508,"state":"open","created_at":"2015-08-29T03:54:16Z","updated_at":"2016-03-03T20:36:23Z","due_on":"2016-03-04T05:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20688/commits","review_comments_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20688/comments","review_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/20688/comments","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/688151d0fe9d5dce1feb1acefca0d0b7372321f7","head":{"label":"ArtfulCoder:podhostname","ref":"podhostname","sha":"688151d0fe9d5dce1feb1acefca0d0b7372321f7","user":{"login":"ArtfulCoder","id":1220660,"avatar_url":"https://avatars.githubusercontent.com/u/1220660?v=3","gravatar_id":"","url":"https://api.github.com/users/ArtfulCoder","html_url":"https://github.com/ArtfulCoder","followers_url":"https://api.github.com/users/ArtfulCoder/followers","following_url":"https://api.github.com/users/ArtfulCoder/following{/other_user}","gists_url":"https://api.github.com/users/ArtfulCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ArtfulCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArtfulCoder/subscriptions","organizations_url":"https://api.github.com/users/ArtfulCoder/orgs","repos_url":"https://api.github.com/users/ArtfulCoder/repos","events_url":"https://api.github.com/users/ArtfulCoder/events{/privacy}","received_events_url":"https://api.github.com/users/ArtfulCoder/received_events","type":"User","site_admin":false},"repo":{"id":29879916,"name":"kubernetes","full_name":"ArtfulCoder/kubernetes","owner":{"login":"ArtfulCoder","id":1220660,"avatar_url":"https://avatars.githubusercontent.com/u/1220660?v=3","gravatar_id":"","url":"https://api.github.com/users/ArtfulCoder","html_url":"https://github.com/ArtfulCoder","followers_url":"https://api.github.com/users/ArtfulCoder/followers","following_url":"https://api.github.com/users/ArtfulCoder/following{/other_user}","gists_url":"https://api.github.com/users/ArtfulCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/ArtfulCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArtfulCoder/subscriptions","organizations_url":"https://api.github.com/users/ArtfulCoder/orgs","repos_url":"https://api.github.com/users/ArtfulCoder/repos","events_url":"https://api.github.com/users/ArtfulCoder/events{/privacy}","received_events_url":"https://api.github.com/users/ArtfulCoder/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ArtfulCoder/kubernetes","description":"Container Cluster Manager","fork":true,"url":"https://api.github.com/repos/ArtfulCoder/kubernetes","forks_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/forks","keys_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/teams","hooks_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/events","assignees_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/tags","blobs_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/languages","stargazers_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/subscription","commits_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/merges","archive_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/downloads","issues_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/ArtfulCoder/kubernetes/deployments","created_at":"2015-01-26T20:25:09Z","updated_at":"2015-05-07T20:25:01Z","pushed_at":"2016-03-03T01:09:28Z","git_url":"git://github.com/ArtfulCoder/kubernetes.git","ssh_url":"git@github.com:ArtfulCoder/kubernetes.git","clone_url":"https://github.com/ArtfulCoder/kubernetes.git","svn_url":"https://github.com/ArtfulCoder/kubernetes","homepage":"http://kubernetes.io","size":172061,"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":"kubernetes:master","ref":"master","sha":"d356bad602f3d0066d2eecf7ef60b24326a7cd6b","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"kubernetes/kubernetes","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars.githubusercontent.com/u/13629408?v=3","gravatar_id":"","url":"https://api.github.com/users/kubernetes","html_url":"https://github.com/kubernetes","followers_url":"https://api.github.com/users/kubernetes/followers","following_url":"https://api.github.com/users/kubernetes/following{/other_user}","gists_url":"https://api.github.com/users/kubernetes/gists{/gist_id}","starred_url":"https://api.github.com/users/kubernetes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubernetes/subscriptions","organizations_url":"https://api.github.com/users/kubernetes/orgs","repos_url":"https://api.github.com/users/kubernetes/repos","events_url":"https://api.github.com/users/kubernetes/events{/privacy}","received_events_url":"https://api.github.com/users/kubernetes/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kubernetes/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/kubernetes/kubernetes","forks_url":"https://api.github.com/repos/kubernetes/kubernetes/forks","keys_url":"https://api.github.com/repos/kubernetes/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/kubernetes/teams","hooks_url":"https://api.github.com/repos/kubernetes/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/kubernetes/events","assignees_url":"https://api.github.com/repos/kubernetes/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/kubernetes/tags","blobs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/kubernetes/languages","stargazers_url":"https://api.github.com/repos/kubernetes/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/kubernetes/subscription","commits_url":"https://api.github.com/repos/kubernetes/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/kubernetes/merges","archive_url":"https://api.github.com/repos/kubernetes/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/kubernetes/downloads","issues_url":"https://api.github.com/repos/kubernetes/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/kubernetes/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/kubernetes/deployments","created_at":"2014-06-06T22:56:04Z","updated_at":"2016-03-03T20:10:37Z","pushed_at":"2016-03-03T20:42:29Z","git_url":"git://github.com/kubernetes/kubernetes.git","ssh_url":"git@github.com:kubernetes/kubernetes.git","clone_url":"https://github.com/kubernetes/kubernetes.git","svn_url":"https://github.com/kubernetes/kubernetes","homepage":"http://kubernetes.io","size":334066,"stargazers_count":13022,"watchers_count":13022,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":3738,"mirror_url":null,"open_issues_count":3002,"forks":3738,"open_issues":3002,"watchers":13022,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20688"},"html":{"href":"https://github.com/kubernetes/kubernetes/pull/20688"},"issue":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/20688"},"comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/issues/20688/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20688/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/kubernetes/pulls/20688/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/kubernetes/statuses/688151d0fe9d5dce1feb1acefca0d0b7372321f7"}}}}