{"action":"created","issue":{"url":"https://api.github.com/repos/amalgam8/amalgam8/issues/448","repository_url":"https://api.github.com/repos/amalgam8/amalgam8","labels_url":"https://api.github.com/repos/amalgam8/amalgam8/issues/448/labels{/name}","comments_url":"https://api.github.com/repos/amalgam8/amalgam8/issues/448/comments","events_url":"https://api.github.com/repos/amalgam8/amalgam8/issues/448/events","html_url":"https://github.com/amalgam8/amalgam8/pull/448","id":195852532,"number":448,"title":"Automatic configuration of service name and tags based on Kubernetes API","user":{"login":"zcahana","id":17428696,"avatar_url":"https://avatars.githubusercontent.com/u/17428696?v=3","gravatar_id":"","url":"https://api.github.com/users/zcahana","html_url":"https://github.com/zcahana","followers_url":"https://api.github.com/users/zcahana/followers","following_url":"https://api.github.com/users/zcahana/following{/other_user}","gists_url":"https://api.github.com/users/zcahana/gists{/gist_id}","starred_url":"https://api.github.com/users/zcahana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zcahana/subscriptions","organizations_url":"https://api.github.com/users/zcahana/orgs","repos_url":"https://api.github.com/users/zcahana/repos","events_url":"https://api.github.com/users/zcahana/events{/privacy}","received_events_url":"https://api.github.com/users/zcahana/received_events","type":"User","site_admin":false},"labels":[{"id":438616139,"url":"https://api.github.com/repos/amalgam8/amalgam8/labels/sidecar","name":"sidecar","color":"e99695","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-15T16:35:03Z","updated_at":"2016-12-20T16:35:14Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/amalgam8/amalgam8/pulls/448","html_url":"https://github.com/amalgam8/amalgam8/pull/448","diff_url":"https://github.com/amalgam8/amalgam8/pull/448.diff","patch_url":"https://github.com/amalgam8/amalgam8/pull/448.patch"},"body":"This PR adds sidecar support for automatic configuration of service name and tags, based on information fetched from Kubernetes API.\r\n\r\nThis function is enabled when an `A8_KUBERNETES_POD_NAME` environment variable is set for the sidecar (or `--kubernetes_pod_name` flag / `kubernetes.pod_name` YAML field).\r\nThe pod name is expected to be injected into the sidecar pod using [Kubernetes Downward API](http://kubernetes.io/docs/user-guide/downward-api/), for example:\r\n```yaml\r\napiVersion: v1\r\nkind: Pod\r\nmetadata:\r\n  name: my-pod\r\nspec:\r\n  spec:\r\n    containers:\r\n      - name: proxy\r\n        image: amalgam8/a8-sidecar:latest\r\n        .\r\n\t\t.\r\n\t\t.\r\n        env:\r\n          - name: A8_KUBERNETES_POD_NAME\r\n            valueFrom:\r\n              fieldRef:\r\n                fieldPath: metadata.name\r\n```\r\n\r\nDesign-wise, a new `siedcar/identity` package is added, exposing an `identity.Provider` interface, which allows to query for the local service instance, which is constructed both from sidecar configuration as well as Kubernetes API, depending on configuration. The `identity.Provider` is then passed down to the proxy service manager, as well as to the registrator. Later on, the use of this interface can be extended to support dynamic changes to the identity (e.g., in Kubernetes, service(s) and labels can change during runtime).\r\n\r\n~Note: this PR is still work-in-progress, and hasn't been tested at all, but feedback is welcome.~\r\n\r\nResolves #426."},"comment":{"url":"https://api.github.com/repos/amalgam8/amalgam8/issues/comments/268290674","html_url":"https://github.com/amalgam8/amalgam8/pull/448#issuecomment-268290674","issue_url":"https://api.github.com/repos/amalgam8/amalgam8/issues/448","id":268290674,"user":{"login":"rshriram","id":8202871,"avatar_url":"https://avatars.githubusercontent.com/u/8202871?v=3","gravatar_id":"","url":"https://api.github.com/users/rshriram","html_url":"https://github.com/rshriram","followers_url":"https://api.github.com/users/rshriram/followers","following_url":"https://api.github.com/users/rshriram/following{/other_user}","gists_url":"https://api.github.com/users/rshriram/gists{/gist_id}","starred_url":"https://api.github.com/users/rshriram/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rshriram/subscriptions","organizations_url":"https://api.github.com/users/rshriram/orgs","repos_url":"https://api.github.com/users/rshriram/repos","events_url":"https://api.github.com/users/rshriram/events{/privacy}","received_events_url":"https://api.github.com/users/rshriram/received_events","type":"User","site_admin":false},"created_at":"2016-12-20T16:35:14Z","updated_at":"2016-12-20T16:35:14Z","body":"My question is can you automatically obtain the pod's name using the K8S API in code, instead of asking the user to provide the POD name via k8s downward API ? The latter seems like some unnecessary config that needs to be added."}}
{"actor":{"display_login":"rshriram"}}