{"action":"created","comment":{"url":"https://api.github.com/repos/minio/minio/pulls/comments/123881600","pull_request_review_id":46130194,"id":123881600,"diff_hunk":"@@ -140,6 +141,26 @@ func IsKubernetes() bool {\n \treturn os.Getenv(\"KUBERNETES_SERVICE_HOST\") != \"\"\n }\n \n+// Minio Helm chart uses DownwardAPIFile to write pod label info to /podinfo/labels\n+// More info: https://kubernetes.io/docs/tasks/inject-data-application/downward-api-volume-expose-pod-information/#store-pod-fields\n+// Check if this is Helm package installation and report helm chart version\n+func getHelmVersion(helmInfoFilePath string) string {\n+\t// Check if the file exists. Ignore errors as Minio can be deployed without Helm charts as well.\n+\thelmInfoFile, err := os.Open(helmInfoFilePath)\n+\tif err == nil {\n+\t\tscanner := bufio.NewScanner(helmInfoFile)\n+\t\tfor scanner.Scan() {\n+\t\t\tif strings.Contains(scanner.Text(), \"chart=\") {\n+\t\t\t\thelmChartVersion := strings.TrimPrefix(scanner.Text(), \"chart=\")\n+\t\t\t\t// remove quotes from the chart version\n+\t\t\t\thelmChartVersion = strings.Trim(helmChartVersion, `\"`)","path":"cmd/update-main.go","position":24,"original_position":24,"commit_id":"2353503d35c00f8e0f0145d4bb7b153e4e3a66a8","original_commit_id":"2353503d35c00f8e0f0145d4bb7b153e4e3a66a8","user":{"login":"harshavardhana","id":622699,"avatar_url":"https://avatars3.githubusercontent.com/u/622699?v=3","gravatar_id":"","url":"https://api.github.com/users/harshavardhana","html_url":"https://github.com/harshavardhana","followers_url":"https://api.github.com/users/harshavardhana/followers","following_url":"https://api.github.com/users/harshavardhana/following{/other_user}","gists_url":"https://api.github.com/users/harshavardhana/gists{/gist_id}","starred_url":"https://api.github.com/users/harshavardhana/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harshavardhana/subscriptions","organizations_url":"https://api.github.com/users/harshavardhana/orgs","repos_url":"https://api.github.com/users/harshavardhana/repos","events_url":"https://api.github.com/users/harshavardhana/events{/privacy}","received_events_url":"https://api.github.com/users/harshavardhana/received_events","type":"User","site_admin":false},"body":"You don't need to re-assign here.. just do `return strings.Trim(helmChartVersion, `\"`)` ","created_at":"2017-06-24T17:30:38Z","updated_at":"2017-06-24T17:33:56Z","html_url":"https://github.com/minio/minio/pull/4592#discussion_r123881600","pull_request_url":"https://api.github.com/repos/minio/minio/pulls/4592","_links":{"self":{"href":"https://api.github.com/repos/minio/minio/pulls/comments/123881600"},"html":{"href":"https://github.com/minio/minio/pull/4592#discussion_r123881600"},"pull_request":{"href":"https://api.github.com/repos/minio/minio/pulls/4592"}}},"pull_request":{"url":"https://api.github.com/repos/minio/minio/pulls/4592","id":127292039,"html_url":"https://github.com/minio/minio/pull/4592","diff_url":"https://github.com/minio/minio/pull/4592.diff","patch_url":"https://github.com/minio/minio/pull/4592.patch","issue_url":"https://api.github.com/repos/minio/minio/issues/4592","number":4592,"state":"open","locked":false,"title":"Add support for helm package info in useragent","user":{"login":"NitishT","id":5156139,"avatar_url":"https://avatars3.githubusercontent.com/u/5156139?v=3","gravatar_id":"","url":"https://api.github.com/users/NitishT","html_url":"https://github.com/NitishT","followers_url":"https://api.github.com/users/NitishT/followers","following_url":"https://api.github.com/users/NitishT/following{/other_user}","gists_url":"https://api.github.com/users/NitishT/gists{/gist_id}","starred_url":"https://api.github.com/users/NitishT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NitishT/subscriptions","organizations_url":"https://api.github.com/users/NitishT/orgs","repos_url":"https://api.github.com/users/NitishT/repos","events_url":"https://api.github.com/users/NitishT/events{/privacy}","received_events_url":"https://api.github.com/users/NitishT/received_events","type":"User","site_admin":false},"body":"## Description\r\nAdds helm chart version detection\r\n\r\nMinio Helm Chart uses DownwardFileAPI to create a file with pod labels in the path `/podinfo/labels`. This file has info about the Helm Chart version. We check if this file exists to read the chart version. \r\n\r\n## Motivation and Context\r\nSee issue https://github.com/minio/minio/issues/4456\r\n\r\n## How Has This Been Tested?\r\nManually\r\n\r\n## Types of changes\r\n<!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply: -->\r\n- [ ] Bug fix (non-breaking change which fixes an issue)\r\n- [x] New feature (non-breaking change which adds functionality)\r\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\r\n\r\n## Checklist:\r\n<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->\r\n<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! -->\r\n- [x] My code follows the code style of this project.\r\n- [ ] My change requires a change to the documentation.\r\n- [ ] I have updated the documentation accordingly.\r\n- [ ] I have added tests to cover my changes.\r\n- [x] All new and existing tests passed.","created_at":"2017-06-23T21:26:53Z","updated_at":"2017-06-24T17:33:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cfa004da77de0a18827bc9261bc0431ca43a1875","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/minio/minio/pulls/4592/commits","review_comments_url":"https://api.github.com/repos/minio/minio/pulls/4592/comments","review_comment_url":"https://api.github.com/repos/minio/minio/pulls/comments{/number}","comments_url":"https://api.github.com/repos/minio/minio/issues/4592/comments","statuses_url":"https://api.github.com/repos/minio/minio/statuses/2353503d35c00f8e0f0145d4bb7b153e4e3a66a8","head":{"label":"NitishT:helm-useragent","ref":"helm-useragent","sha":"2353503d35c00f8e0f0145d4bb7b153e4e3a66a8","user":{"login":"NitishT","id":5156139,"avatar_url":"https://avatars3.githubusercontent.com/u/5156139?v=3","gravatar_id":"","url":"https://api.github.com/users/NitishT","html_url":"https://github.com/NitishT","followers_url":"https://api.github.com/users/NitishT/followers","following_url":"https://api.github.com/users/NitishT/following{/other_user}","gists_url":"https://api.github.com/users/NitishT/gists{/gist_id}","starred_url":"https://api.github.com/users/NitishT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NitishT/subscriptions","organizations_url":"https://api.github.com/users/NitishT/orgs","repos_url":"https://api.github.com/users/NitishT/repos","events_url":"https://api.github.com/users/NitishT/events{/privacy}","received_events_url":"https://api.github.com/users/NitishT/received_events","type":"User","site_admin":false},"repo":{"id":92370241,"name":"minio","full_name":"NitishT/minio","owner":{"login":"NitishT","id":5156139,"avatar_url":"https://avatars3.githubusercontent.com/u/5156139?v=3","gravatar_id":"","url":"https://api.github.com/users/NitishT","html_url":"https://github.com/NitishT","followers_url":"https://api.github.com/users/NitishT/followers","following_url":"https://api.github.com/users/NitishT/following{/other_user}","gists_url":"https://api.github.com/users/NitishT/gists{/gist_id}","starred_url":"https://api.github.com/users/NitishT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NitishT/subscriptions","organizations_url":"https://api.github.com/users/NitishT/orgs","repos_url":"https://api.github.com/users/NitishT/repos","events_url":"https://api.github.com/users/NitishT/events{/privacy}","received_events_url":"https://api.github.com/users/NitishT/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NitishT/minio","description":"Minio is an open source object storage server compatible with Amazon S3 APIs","fork":true,"url":"https://api.github.com/repos/NitishT/minio","forks_url":"https://api.github.com/repos/NitishT/minio/forks","keys_url":"https://api.github.com/repos/NitishT/minio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NitishT/minio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NitishT/minio/teams","hooks_url":"https://api.github.com/repos/NitishT/minio/hooks","issue_events_url":"https://api.github.com/repos/NitishT/minio/issues/events{/number}","events_url":"https://api.github.com/repos/NitishT/minio/events","assignees_url":"https://api.github.com/repos/NitishT/minio/assignees{/user}","branches_url":"https://api.github.com/repos/NitishT/minio/branches{/branch}","tags_url":"https://api.github.com/repos/NitishT/minio/tags","blobs_url":"https://api.github.com/repos/NitishT/minio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NitishT/minio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NitishT/minio/git/refs{/sha}","trees_url":"https://api.github.com/repos/NitishT/minio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NitishT/minio/statuses/{sha}","languages_url":"https://api.github.com/repos/NitishT/minio/languages","stargazers_url":"https://api.github.com/repos/NitishT/minio/stargazers","contributors_url":"https://api.github.com/repos/NitishT/minio/contributors","subscribers_url":"https://api.github.com/repos/NitishT/minio/subscribers","subscription_url":"https://api.github.com/repos/NitishT/minio/subscription","commits_url":"https://api.github.com/repos/NitishT/minio/commits{/sha}","git_commits_url":"https://api.github.com/repos/NitishT/minio/git/commits{/sha}","comments_url":"https://api.github.com/repos/NitishT/minio/comments{/number}","issue_comment_url":"https://api.github.com/repos/NitishT/minio/issues/comments{/number}","contents_url":"https://api.github.com/repos/NitishT/minio/contents/{+path}","compare_url":"https://api.github.com/repos/NitishT/minio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NitishT/minio/merges","archive_url":"https://api.github.com/repos/NitishT/minio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NitishT/minio/downloads","issues_url":"https://api.github.com/repos/NitishT/minio/issues{/number}","pulls_url":"https://api.github.com/repos/NitishT/minio/pulls{/number}","milestones_url":"https://api.github.com/repos/NitishT/minio/milestones{/number}","notifications_url":"https://api.github.com/repos/NitishT/minio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NitishT/minio/labels{/name}","releases_url":"https://api.github.com/repos/NitishT/minio/releases{/id}","deployments_url":"https://api.github.com/repos/NitishT/minio/deployments","created_at":"2017-05-25T06:00:59Z","updated_at":"2017-05-25T06:01:02Z","pushed_at":"2017-06-24T09:26:52Z","git_url":"git://github.com/NitishT/minio.git","ssh_url":"git@github.com:NitishT/minio.git","clone_url":"https://github.com/NitishT/minio.git","svn_url":"https://github.com/NitishT/minio","homepage":"https://minio.io","size":25520,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"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":"minio:master","ref":"master","sha":"ba6d997d18da425094575ac87e19f793f32ad56a","user":{"login":"minio","id":695951,"avatar_url":"https://avatars0.githubusercontent.com/u/695951?v=3","gravatar_id":"","url":"https://api.github.com/users/minio","html_url":"https://github.com/minio","followers_url":"https://api.github.com/users/minio/followers","following_url":"https://api.github.com/users/minio/following{/other_user}","gists_url":"https://api.github.com/users/minio/gists{/gist_id}","starred_url":"https://api.github.com/users/minio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minio/subscriptions","organizations_url":"https://api.github.com/users/minio/orgs","repos_url":"https://api.github.com/users/minio/repos","events_url":"https://api.github.com/users/minio/events{/privacy}","received_events_url":"https://api.github.com/users/minio/received_events","type":"Organization","site_admin":false},"repo":{"id":29261473,"name":"minio","full_name":"minio/minio","owner":{"login":"minio","id":695951,"avatar_url":"https://avatars0.githubusercontent.com/u/695951?v=3","gravatar_id":"","url":"https://api.github.com/users/minio","html_url":"https://github.com/minio","followers_url":"https://api.github.com/users/minio/followers","following_url":"https://api.github.com/users/minio/following{/other_user}","gists_url":"https://api.github.com/users/minio/gists{/gist_id}","starred_url":"https://api.github.com/users/minio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/minio/subscriptions","organizations_url":"https://api.github.com/users/minio/orgs","repos_url":"https://api.github.com/users/minio/repos","events_url":"https://api.github.com/users/minio/events{/privacy}","received_events_url":"https://api.github.com/users/minio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/minio/minio","description":"Minio is an open source object storage server compatible with Amazon S3 APIs","fork":false,"url":"https://api.github.com/repos/minio/minio","forks_url":"https://api.github.com/repos/minio/minio/forks","keys_url":"https://api.github.com/repos/minio/minio/keys{/key_id}","collaborators_url":"https://api.github.com/repos/minio/minio/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/minio/minio/teams","hooks_url":"https://api.github.com/repos/minio/minio/hooks","issue_events_url":"https://api.github.com/repos/minio/minio/issues/events{/number}","events_url":"https://api.github.com/repos/minio/minio/events","assignees_url":"https://api.github.com/repos/minio/minio/assignees{/user}","branches_url":"https://api.github.com/repos/minio/minio/branches{/branch}","tags_url":"https://api.github.com/repos/minio/minio/tags","blobs_url":"https://api.github.com/repos/minio/minio/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/minio/minio/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/minio/minio/git/refs{/sha}","trees_url":"https://api.github.com/repos/minio/minio/git/trees{/sha}","statuses_url":"https://api.github.com/repos/minio/minio/statuses/{sha}","languages_url":"https://api.github.com/repos/minio/minio/languages","stargazers_url":"https://api.github.com/repos/minio/minio/stargazers","contributors_url":"https://api.github.com/repos/minio/minio/contributors","subscribers_url":"https://api.github.com/repos/minio/minio/subscribers","subscription_url":"https://api.github.com/repos/minio/minio/subscription","commits_url":"https://api.github.com/repos/minio/minio/commits{/sha}","git_commits_url":"https://api.github.com/repos/minio/minio/git/commits{/sha}","comments_url":"https://api.github.com/repos/minio/minio/comments{/number}","issue_comment_url":"https://api.github.com/repos/minio/minio/issues/comments{/number}","contents_url":"https://api.github.com/repos/minio/minio/contents/{+path}","compare_url":"https://api.github.com/repos/minio/minio/compare/{base}...{head}","merges_url":"https://api.github.com/repos/minio/minio/merges","archive_url":"https://api.github.com/repos/minio/minio/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/minio/minio/downloads","issues_url":"https://api.github.com/repos/minio/minio/issues{/number}","pulls_url":"https://api.github.com/repos/minio/minio/pulls{/number}","milestones_url":"https://api.github.com/repos/minio/minio/milestones{/number}","notifications_url":"https://api.github.com/repos/minio/minio/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/minio/minio/labels{/name}","releases_url":"https://api.github.com/repos/minio/minio/releases{/id}","deployments_url":"https://api.github.com/repos/minio/minio/deployments","created_at":"2015-01-14T19:23:58Z","updated_at":"2017-06-24T16:57:46Z","pushed_at":"2017-06-24T14:16:38Z","git_url":"git://github.com/minio/minio.git","ssh_url":"git@github.com:minio/minio.git","clone_url":"https://github.com/minio/minio.git","svn_url":"https://github.com/minio/minio","homepage":"https://minio.io","size":25469,"stargazers_count":7195,"watchers_count":7195,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":529,"mirror_url":null,"open_issues_count":128,"forks":529,"open_issues":128,"watchers":7195,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/minio/minio/pulls/4592"},"html":{"href":"https://github.com/minio/minio/pull/4592"},"issue":{"href":"https://api.github.com/repos/minio/minio/issues/4592"},"comments":{"href":"https://api.github.com/repos/minio/minio/issues/4592/comments"},"review_comments":{"href":"https://api.github.com/repos/minio/minio/pulls/4592/comments"},"review_comment":{"href":"https://api.github.com/repos/minio/minio/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/minio/minio/pulls/4592/commits"},"statuses":{"href":"https://api.github.com/repos/minio/minio/statuses/2353503d35c00f8e0f0145d4bb7b153e4e3a66a8"}}}}
{"actor":{"display_login":"harshavardhana"}}