{"action":"created","comment":{"url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/comments/168856254","pull_request_review_id":97299377,"id":168856254,"diff_hunk":"@@ -177,14 +184,36 @@ Error loading new template : %v\n \n \tn.t = ngxTpl\n \n+\n \t// TODO: refactor\n \tif _, ok := fs.(filesystem.DefaultFs); !ok {\n-\t\twatch.NewDummyFileWatcher(tmplPath, onChange)\n+\t\twatch.NewDummyFileWatcher(tmplPath, onTemplateChange)\n \t} else {\n-\t\t_, err = watch.NewFileWatcher(tmplPath, onChange)\n-\t\tif err != nil {\n-\t\t\tglog.Fatalf(\"unexpected error watching template %v: %v\", tmplPath, err)\n+\n+\t\tvar watchPath string\n+\t\tvar watchAction func()\n+\t\tvar addWatcher func()\n+\t\taddWatcher = func() {\n+\t\t\t_, err = watch.NewFileWatcher(watchPath, watchAction)\n+\t\t\tif err != nil {\n+\t\t\t\tglog.Fatalf(\"unexpected error watching %v: %v\", watchPath, err)\n+\t\t\t}\n \t\t}\n+\n+\t\t// Add the template path to the watcher\n+\t\twatchPath = tmplPath\n+\t\twatchAction = onTemplateChange\n+\t\taddWatcher()\n+\n+\t\t// Add the GeoIP data to the watcher\n+\t\tgeoData := [3]string{\"/etc/nginx/geoip/GeoIP.dat\", \"/etc/nginx/geoip/GeoIPASNum.dat\", \"/etc/nginx/geoip/GeoLiteCity.dat\"}","path":"internal/ingress/controller/nginx.go","position":64,"original_position":64,"commit_id":"376c6046b5390654536a5742e1674cd1fd90bec0","original_commit_id":"376c6046b5390654536a5742e1674cd1fd90bec0","user":{"login":"Stono","id":1486729,"avatar_url":"https://avatars2.githubusercontent.com/u/1486729?v=4","gravatar_id":"","url":"https://api.github.com/users/Stono","html_url":"https://github.com/Stono","followers_url":"https://api.github.com/users/Stono/followers","following_url":"https://api.github.com/users/Stono/following{/other_user}","gists_url":"https://api.github.com/users/Stono/gists{/gist_id}","starred_url":"https://api.github.com/users/Stono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stono/subscriptions","organizations_url":"https://api.github.com/users/Stono/orgs","repos_url":"https://api.github.com/users/Stono/repos","events_url":"https://api.github.com/users/Stono/events{/privacy}","received_events_url":"https://api.github.com/users/Stono/received_events","type":"User","site_admin":false},"body":"It'd be nice to enumerate the directory instead of hard coding files","created_at":"2018-02-16T19:58:27Z","updated_at":"2018-02-16T19:58:27Z","html_url":"https://github.com/kubernetes/ingress-nginx/pull/2107#discussion_r168856254","pull_request_url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/2107","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/comments/168856254"},"html":{"href":"https://github.com/kubernetes/ingress-nginx/pull/2107#discussion_r168856254"},"pull_request":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/2107"}}},"pull_request":{"url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/2107","id":169710980,"html_url":"https://github.com/kubernetes/ingress-nginx/pull/2107","diff_url":"https://github.com/kubernetes/ingress-nginx/pull/2107.diff","patch_url":"https://github.com/kubernetes/ingress-nginx/pull/2107.patch","issue_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/2107","number":2107,"state":"open","locked":false,"title":"Enabled the dynamic reload of GeoIP data","user":{"login":"Stono","id":1486729,"avatar_url":"https://avatars2.githubusercontent.com/u/1486729?v=4","gravatar_id":"","url":"https://api.github.com/users/Stono","html_url":"https://github.com/Stono","followers_url":"https://api.github.com/users/Stono/followers","following_url":"https://api.github.com/users/Stono/following{/other_user}","gists_url":"https://api.github.com/users/Stono/gists{/gist_id}","starred_url":"https://api.github.com/users/Stono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stono/subscriptions","organizations_url":"https://api.github.com/users/Stono/orgs","repos_url":"https://api.github.com/users/Stono/repos","events_url":"https://api.github.com/users/Stono/events{/privacy}","received_events_url":"https://api.github.com/users/Stono/received_events","type":"User","site_admin":false},"body":"Hey, \r\nThis attempts to fix https://github.com/kubernetes/ingress-nginx/issues/2100\r\n\r\nIn summary I have:\r\n  - Moved the geoip data to `/etc/nginx/geoip`\r\n  - Added Filesystem watchers on each of the files in that directory.\r\n\r\nThings I don't like:\r\n  - I've hard coded the files in `/etc/nginx/geoip`, it'd be nice to probably just enumerate the files in that directory and watch them all (in case they change name/are added/removed)\r\n  - I've probably wrote terrible golang, this is literally my first golang change PR ever - so I apologise!\r\n\r\nI've tested it on my controller, this was me modifying each file:\r\n\r\n```\r\nI0216 19:46:45.439078       7 nginx.go:158] Triggering NGINX reload\r\nI0216 19:46:50.054260       7 controller.go:180] ingress backend successfully reloaded...\r\nI0216 19:47:05.182746       7 nginx.go:158] Triggering NGINX reload\r\nI0216 19:47:05.183088       7 controller.go:171] backend reload required\r\nI0216 19:47:09.787091       7 controller.go:180] ingress backend successfully reloaded...\r\nI0216 19:47:14.246166       7 nginx.go:158] Triggering NGINX reload\r\nI0216 19:47:14.246540       7 controller.go:171] backend reload required\r\nI0216 19:47:19.135127       7 controller.go:180] ingress backend successfully reloaded...\r\n```","created_at":"2018-02-16T19:51:23Z","updated_at":"2018-02-16T19:58:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"07e269daae5740b64b46a96e0b90698c05b722fc","assignee":{"login":"aledbf","id":161571,"avatar_url":"https://avatars2.githubusercontent.com/u/161571?v=4","gravatar_id":"","url":"https://api.github.com/users/aledbf","html_url":"https://github.com/aledbf","followers_url":"https://api.github.com/users/aledbf/followers","following_url":"https://api.github.com/users/aledbf/following{/other_user}","gists_url":"https://api.github.com/users/aledbf/gists{/gist_id}","starred_url":"https://api.github.com/users/aledbf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aledbf/subscriptions","organizations_url":"https://api.github.com/users/aledbf/orgs","repos_url":"https://api.github.com/users/aledbf/repos","events_url":"https://api.github.com/users/aledbf/events{/privacy}","received_events_url":"https://api.github.com/users/aledbf/received_events","type":"User","site_admin":false},"assignees":[{"login":"aledbf","id":161571,"avatar_url":"https://avatars2.githubusercontent.com/u/161571?v=4","gravatar_id":"","url":"https://api.github.com/users/aledbf","html_url":"https://github.com/aledbf","followers_url":"https://api.github.com/users/aledbf/followers","following_url":"https://api.github.com/users/aledbf/following{/other_user}","gists_url":"https://api.github.com/users/aledbf/gists{/gist_id}","starred_url":"https://api.github.com/users/aledbf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aledbf/subscriptions","organizations_url":"https://api.github.com/users/aledbf/orgs","repos_url":"https://api.github.com/users/aledbf/repos","events_url":"https://api.github.com/users/aledbf/events{/privacy}","received_events_url":"https://api.github.com/users/aledbf/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":486873161,"url":"https://api.github.com/repos/kubernetes/ingress-nginx/labels/cncf-cla:%20yes","name":"cncf-cla: yes","color":"bfe5bf","default":false},{"id":676670532,"url":"https://api.github.com/repos/kubernetes/ingress-nginx/labels/size/M","name":"size/M","color":"eebb00","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/2107/commits","review_comments_url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/2107/comments","review_comment_url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/2107/comments","statuses_url":"https://api.github.com/repos/kubernetes/ingress-nginx/statuses/376c6046b5390654536a5742e1674cd1fd90bec0","head":{"label":"Stono:master","ref":"master","sha":"376c6046b5390654536a5742e1674cd1fd90bec0","user":{"login":"Stono","id":1486729,"avatar_url":"https://avatars2.githubusercontent.com/u/1486729?v=4","gravatar_id":"","url":"https://api.github.com/users/Stono","html_url":"https://github.com/Stono","followers_url":"https://api.github.com/users/Stono/followers","following_url":"https://api.github.com/users/Stono/following{/other_user}","gists_url":"https://api.github.com/users/Stono/gists{/gist_id}","starred_url":"https://api.github.com/users/Stono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stono/subscriptions","organizations_url":"https://api.github.com/users/Stono/orgs","repos_url":"https://api.github.com/users/Stono/repos","events_url":"https://api.github.com/users/Stono/events{/privacy}","received_events_url":"https://api.github.com/users/Stono/received_events","type":"User","site_admin":false},"repo":{"id":121688026,"name":"ingress-nginx","full_name":"Stono/ingress-nginx","owner":{"login":"Stono","id":1486729,"avatar_url":"https://avatars2.githubusercontent.com/u/1486729?v=4","gravatar_id":"","url":"https://api.github.com/users/Stono","html_url":"https://github.com/Stono","followers_url":"https://api.github.com/users/Stono/followers","following_url":"https://api.github.com/users/Stono/following{/other_user}","gists_url":"https://api.github.com/users/Stono/gists{/gist_id}","starred_url":"https://api.github.com/users/Stono/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stono/subscriptions","organizations_url":"https://api.github.com/users/Stono/orgs","repos_url":"https://api.github.com/users/Stono/repos","events_url":"https://api.github.com/users/Stono/events{/privacy}","received_events_url":"https://api.github.com/users/Stono/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Stono/ingress-nginx","description":"Ingress controller for nginx","fork":true,"url":"https://api.github.com/repos/Stono/ingress-nginx","forks_url":"https://api.github.com/repos/Stono/ingress-nginx/forks","keys_url":"https://api.github.com/repos/Stono/ingress-nginx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Stono/ingress-nginx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Stono/ingress-nginx/teams","hooks_url":"https://api.github.com/repos/Stono/ingress-nginx/hooks","issue_events_url":"https://api.github.com/repos/Stono/ingress-nginx/issues/events{/number}","events_url":"https://api.github.com/repos/Stono/ingress-nginx/events","assignees_url":"https://api.github.com/repos/Stono/ingress-nginx/assignees{/user}","branches_url":"https://api.github.com/repos/Stono/ingress-nginx/branches{/branch}","tags_url":"https://api.github.com/repos/Stono/ingress-nginx/tags","blobs_url":"https://api.github.com/repos/Stono/ingress-nginx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Stono/ingress-nginx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Stono/ingress-nginx/git/refs{/sha}","trees_url":"https://api.github.com/repos/Stono/ingress-nginx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Stono/ingress-nginx/statuses/{sha}","languages_url":"https://api.github.com/repos/Stono/ingress-nginx/languages","stargazers_url":"https://api.github.com/repos/Stono/ingress-nginx/stargazers","contributors_url":"https://api.github.com/repos/Stono/ingress-nginx/contributors","subscribers_url":"https://api.github.com/repos/Stono/ingress-nginx/subscribers","subscription_url":"https://api.github.com/repos/Stono/ingress-nginx/subscription","commits_url":"https://api.github.com/repos/Stono/ingress-nginx/commits{/sha}","git_commits_url":"https://api.github.com/repos/Stono/ingress-nginx/git/commits{/sha}","comments_url":"https://api.github.com/repos/Stono/ingress-nginx/comments{/number}","issue_comment_url":"https://api.github.com/repos/Stono/ingress-nginx/issues/comments{/number}","contents_url":"https://api.github.com/repos/Stono/ingress-nginx/contents/{+path}","compare_url":"https://api.github.com/repos/Stono/ingress-nginx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Stono/ingress-nginx/merges","archive_url":"https://api.github.com/repos/Stono/ingress-nginx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Stono/ingress-nginx/downloads","issues_url":"https://api.github.com/repos/Stono/ingress-nginx/issues{/number}","pulls_url":"https://api.github.com/repos/Stono/ingress-nginx/pulls{/number}","milestones_url":"https://api.github.com/repos/Stono/ingress-nginx/milestones{/number}","notifications_url":"https://api.github.com/repos/Stono/ingress-nginx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Stono/ingress-nginx/labels{/name}","releases_url":"https://api.github.com/repos/Stono/ingress-nginx/releases{/id}","deployments_url":"https://api.github.com/repos/Stono/ingress-nginx/deployments","created_at":"2018-02-15T22:01:13Z","updated_at":"2018-02-15T22:01:16Z","pushed_at":"2018-02-16T19:53:55Z","git_url":"git://github.com/Stono/ingress-nginx.git","ssh_url":"git@github.com:Stono/ingress-nginx.git","clone_url":"https://github.com/Stono/ingress-nginx.git","svn_url":"https://github.com/Stono/ingress-nginx","homepage":"","size":63568,"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,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubernetes:master","ref":"master","sha":"b02c0f502abdb192676ab9e2ebf2e7a95bafd9a6","user":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","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":72891330,"name":"ingress-nginx","full_name":"kubernetes/ingress-nginx","owner":{"login":"kubernetes","id":13629408,"avatar_url":"https://avatars2.githubusercontent.com/u/13629408?v=4","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/ingress-nginx","description":"Ingress controller for nginx","fork":false,"url":"https://api.github.com/repos/kubernetes/ingress-nginx","forks_url":"https://api.github.com/repos/kubernetes/ingress-nginx/forks","keys_url":"https://api.github.com/repos/kubernetes/ingress-nginx/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubernetes/ingress-nginx/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubernetes/ingress-nginx/teams","hooks_url":"https://api.github.com/repos/kubernetes/ingress-nginx/hooks","issue_events_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/events{/number}","events_url":"https://api.github.com/repos/kubernetes/ingress-nginx/events","assignees_url":"https://api.github.com/repos/kubernetes/ingress-nginx/assignees{/user}","branches_url":"https://api.github.com/repos/kubernetes/ingress-nginx/branches{/branch}","tags_url":"https://api.github.com/repos/kubernetes/ingress-nginx/tags","blobs_url":"https://api.github.com/repos/kubernetes/ingress-nginx/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubernetes/ingress-nginx/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubernetes/ingress-nginx/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubernetes/ingress-nginx/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubernetes/ingress-nginx/statuses/{sha}","languages_url":"https://api.github.com/repos/kubernetes/ingress-nginx/languages","stargazers_url":"https://api.github.com/repos/kubernetes/ingress-nginx/stargazers","contributors_url":"https://api.github.com/repos/kubernetes/ingress-nginx/contributors","subscribers_url":"https://api.github.com/repos/kubernetes/ingress-nginx/subscribers","subscription_url":"https://api.github.com/repos/kubernetes/ingress-nginx/subscription","commits_url":"https://api.github.com/repos/kubernetes/ingress-nginx/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubernetes/ingress-nginx/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubernetes/ingress-nginx/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubernetes/ingress-nginx/contents/{+path}","compare_url":"https://api.github.com/repos/kubernetes/ingress-nginx/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubernetes/ingress-nginx/merges","archive_url":"https://api.github.com/repos/kubernetes/ingress-nginx/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubernetes/ingress-nginx/downloads","issues_url":"https://api.github.com/repos/kubernetes/ingress-nginx/issues{/number}","pulls_url":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls{/number}","milestones_url":"https://api.github.com/repos/kubernetes/ingress-nginx/milestones{/number}","notifications_url":"https://api.github.com/repos/kubernetes/ingress-nginx/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubernetes/ingress-nginx/labels{/name}","releases_url":"https://api.github.com/repos/kubernetes/ingress-nginx/releases{/id}","deployments_url":"https://api.github.com/repos/kubernetes/ingress-nginx/deployments","created_at":"2016-11-04T22:54:14Z","updated_at":"2018-02-16T17:49:08Z","pushed_at":"2018-02-16T19:54:01Z","git_url":"git://github.com/kubernetes/ingress-nginx.git","ssh_url":"git@github.com:kubernetes/ingress-nginx.git","clone_url":"https://github.com/kubernetes/ingress-nginx.git","svn_url":"https://github.com/kubernetes/ingress-nginx","homepage":"","size":74158,"stargazers_count":1307,"watchers_count":1307,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":800,"mirror_url":null,"archived":false,"open_issues_count":102,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":800,"open_issues":102,"watchers":1307,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/2107"},"html":{"href":"https://github.com/kubernetes/ingress-nginx/pull/2107"},"issue":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/2107"},"comments":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/issues/2107/comments"},"review_comments":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/2107/comments"},"review_comment":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/pulls/2107/commits"},"statuses":{"href":"https://api.github.com/repos/kubernetes/ingress-nginx/statuses/376c6046b5390654536a5742e1674cd1fd90bec0"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Stono"}}