{"action":"created","comment":{"url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/comments/363128015","pull_request_review_id":338430732,"id":363128015,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM2MzEyODAxNQ==","diff_hunk":"@@ -0,0 +1,181 @@\n+package services\n+\n+import (\n+\t\"context\"\n+\t\"fmt\"\n+\t\"log\"\n+\t\"os\"\n+\t\"path/filepath\"\n+\t\"time\"\n+\n+\t\"github.com/mattermost/mattermost-cloud-monitoring/cloud-manager/pkg/providers\"\n+\tk8sdrain \"github.com/openshift/kubernetes-drain\"\n+\t\"github.com/pkg/errors\"\n+\tcorev1 \"k8s.io/api/core/v1\"\n+\tmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+\t\"k8s.io/client-go/kubernetes\"\n+\t\"k8s.io/client-go/tools/clientcmd\"\n+)\n+\n+const PodUnschedulable = \"node.kubernetes.io/unschedulable\"\n+\n+type Service struct {\n+\tcontextName string\n+\tclient      *kubernetes.Clientset\n+\tprovider    providers.Provider\n+}\n+\n+func NewKubernetesService(contextName string, provider providers.Provider) (*Service, error) {\n+\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", defaultPath())\n+\tif err != nil {\n+\t\treturn nil, errors.New(fmt.Sprintf(\"Failed to build k8s config: %s\", err.Error()))\n+\t}\n+\n+\tclient, err := kubernetes.NewForConfig(config)\n+\tif err != nil {\n+\t\treturn nil, errors.New(fmt.Sprintf(\"Failed to create k8s client: %s\", err.Error()))","path":"cloud-manager/pkg/services/kubernetes_service.go","position":36,"original_position":36,"commit_id":"2162660d81cf3bba80d0530c9f7dd2ee746b9361","original_commit_id":"2162660d81cf3bba80d0530c9f7dd2ee746b9361","user":{"login":"gabrieljackson","id":3694686,"node_id":"MDQ6VXNlcjM2OTQ2ODY=","avatar_url":"https://avatars3.githubusercontent.com/u/3694686?v=4","gravatar_id":"","url":"https://api.github.com/users/gabrieljackson","html_url":"https://github.com/gabrieljackson","followers_url":"https://api.github.com/users/gabrieljackson/followers","following_url":"https://api.github.com/users/gabrieljackson/following{/other_user}","gists_url":"https://api.github.com/users/gabrieljackson/gists{/gist_id}","starred_url":"https://api.github.com/users/gabrieljackson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabrieljackson/subscriptions","organizations_url":"https://api.github.com/users/gabrieljackson/orgs","repos_url":"https://api.github.com/users/gabrieljackson/repos","events_url":"https://api.github.com/users/gabrieljackson/events{/privacy}","received_events_url":"https://api.github.com/users/gabrieljackson/received_events","type":"User","site_admin":false},"body":"Same here","created_at":"2020-01-06T00:19:12Z","updated_at":"2020-01-06T00:40:39Z","html_url":"https://github.com/mattermost/mattermost-cloud-monitoring/pull/38#discussion_r363128015","pull_request_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/38","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/comments/363128015"},"html":{"href":"https://github.com/mattermost/mattermost-cloud-monitoring/pull/38#discussion_r363128015"},"pull_request":{"href":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/38","id":349579833,"node_id":"MDExOlB1bGxSZXF1ZXN0MzQ5NTc5ODMz","html_url":"https://github.com/mattermost/mattermost-cloud-monitoring/pull/38","diff_url":"https://github.com/mattermost/mattermost-cloud-monitoring/pull/38.diff","patch_url":"https://github.com/mattermost/mattermost-cloud-monitoring/pull/38.patch","issue_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/issues/38","number":38,"state":"open","locked":false,"title":"New CLI tool for AMI rolling deployment in kubernetes nodes","user":{"login":"angeloskyratzakos","id":24522354,"node_id":"MDQ6VXNlcjI0NTIyMzU0","avatar_url":"https://avatars0.githubusercontent.com/u/24522354?v=4","gravatar_id":"","url":"https://api.github.com/users/angeloskyratzakos","html_url":"https://github.com/angeloskyratzakos","followers_url":"https://api.github.com/users/angeloskyratzakos/followers","following_url":"https://api.github.com/users/angeloskyratzakos/following{/other_user}","gists_url":"https://api.github.com/users/angeloskyratzakos/gists{/gist_id}","starred_url":"https://api.github.com/users/angeloskyratzakos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angeloskyratzakos/subscriptions","organizations_url":"https://api.github.com/users/angeloskyratzakos/orgs","repos_url":"https://api.github.com/users/angeloskyratzakos/repos","events_url":"https://api.github.com/users/angeloskyratzakos/events{/privacy}","received_events_url":"https://api.github.com/users/angeloskyratzakos/received_events","type":"User","site_admin":false},"body":"**Summary**\r\nThis PR contains the `cloud manager` CLI tool that allows new AMIs to be rolling deployed in all kubernetes nodes 1 by 1.\r\n\r\n**Issue Link**\r\nFixes https://github.com/mattermost/mattermost-server/issues/13253\r\n**Ticket Link**\r\nhttps://mattermost.atlassian.net/browse/MM-20772","created_at":"2019-12-05T18:28:44Z","updated_at":"2020-01-06T00:40:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e66569f29f24d59bb7a6d174a251690a8879c5b9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1615385820,"node_id":"MDU6TGFiZWwxNjE1Mzg1ODIw","url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/labels/2:%20Dev%20Review","name":"2: Dev Review","color":"eb6420","default":false,"description":null},{"id":1615385848,"node_id":"MDU6TGFiZWwxNjE1Mzg1ODQ4","url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/labels/Lifecycle/1:stale","name":"Lifecycle/1:stale","color":"5319e7","default":false,"description":null}],"milestone":null,"commits_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/38/commits","review_comments_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/38/comments","review_comment_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/issues/38/comments","statuses_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/statuses/2162660d81cf3bba80d0530c9f7dd2ee746b9361","head":{"label":"angeloskyratzakos:master","ref":"master","sha":"2162660d81cf3bba80d0530c9f7dd2ee746b9361","user":{"login":"angeloskyratzakos","id":24522354,"node_id":"MDQ6VXNlcjI0NTIyMzU0","avatar_url":"https://avatars0.githubusercontent.com/u/24522354?v=4","gravatar_id":"","url":"https://api.github.com/users/angeloskyratzakos","html_url":"https://github.com/angeloskyratzakos","followers_url":"https://api.github.com/users/angeloskyratzakos/followers","following_url":"https://api.github.com/users/angeloskyratzakos/following{/other_user}","gists_url":"https://api.github.com/users/angeloskyratzakos/gists{/gist_id}","starred_url":"https://api.github.com/users/angeloskyratzakos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angeloskyratzakos/subscriptions","organizations_url":"https://api.github.com/users/angeloskyratzakos/orgs","repos_url":"https://api.github.com/users/angeloskyratzakos/repos","events_url":"https://api.github.com/users/angeloskyratzakos/events{/privacy}","received_events_url":"https://api.github.com/users/angeloskyratzakos/received_events","type":"User","site_admin":false},"repo":{"id":224868454,"node_id":"MDEwOlJlcG9zaXRvcnkyMjQ4Njg0NTQ=","name":"mattermost-cloud-monitoring","full_name":"angeloskyratzakos/mattermost-cloud-monitoring","private":false,"owner":{"login":"angeloskyratzakos","id":24522354,"node_id":"MDQ6VXNlcjI0NTIyMzU0","avatar_url":"https://avatars0.githubusercontent.com/u/24522354?v=4","gravatar_id":"","url":"https://api.github.com/users/angeloskyratzakos","html_url":"https://github.com/angeloskyratzakos","followers_url":"https://api.github.com/users/angeloskyratzakos/followers","following_url":"https://api.github.com/users/angeloskyratzakos/following{/other_user}","gists_url":"https://api.github.com/users/angeloskyratzakos/gists{/gist_id}","starred_url":"https://api.github.com/users/angeloskyratzakos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/angeloskyratzakos/subscriptions","organizations_url":"https://api.github.com/users/angeloskyratzakos/orgs","repos_url":"https://api.github.com/users/angeloskyratzakos/repos","events_url":"https://api.github.com/users/angeloskyratzakos/events{/privacy}","received_events_url":"https://api.github.com/users/angeloskyratzakos/received_events","type":"User","site_admin":false},"html_url":"https://github.com/angeloskyratzakos/mattermost-cloud-monitoring","description":null,"fork":true,"url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring","forks_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/forks","keys_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/teams","hooks_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/hooks","issue_events_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/issues/events{/number}","events_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/events","assignees_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/assignees{/user}","branches_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/branches{/branch}","tags_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/tags","blobs_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/git/refs{/sha}","trees_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/statuses/{sha}","languages_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/languages","stargazers_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/stargazers","contributors_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/contributors","subscribers_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/subscribers","subscription_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/subscription","commits_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/commits{/sha}","git_commits_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/git/commits{/sha}","comments_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/comments{/number}","issue_comment_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/issues/comments{/number}","contents_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/contents/{+path}","compare_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/merges","archive_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/downloads","issues_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/issues{/number}","pulls_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/pulls{/number}","milestones_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/milestones{/number}","notifications_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/labels{/name}","releases_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/releases{/id}","deployments_url":"https://api.github.com/repos/angeloskyratzakos/mattermost-cloud-monitoring/deployments","created_at":"2019-11-29T14:22:16Z","updated_at":"2019-12-11T23:21:59Z","pushed_at":"2019-12-11T23:21:56Z","git_url":"git://github.com/angeloskyratzakos/mattermost-cloud-monitoring.git","ssh_url":"git@github.com:angeloskyratzakos/mattermost-cloud-monitoring.git","clone_url":"https://github.com/angeloskyratzakos/mattermost-cloud-monitoring.git","svn_url":"https://github.com/angeloskyratzakos/mattermost-cloud-monitoring","homepage":null,"size":14149,"stargazers_count":0,"watchers_count":0,"language":"HCL","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mattermost:master","ref":"master","sha":"58581254441b4891262d74ebac410bbae6f83030","user":{"login":"mattermost","id":9828093,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk4MjgwOTM=","avatar_url":"https://avatars1.githubusercontent.com/u/9828093?v=4","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"repo":{"id":186012495,"node_id":"MDEwOlJlcG9zaXRvcnkxODYwMTI0OTU=","name":"mattermost-cloud-monitoring","full_name":"mattermost/mattermost-cloud-monitoring","private":false,"owner":{"login":"mattermost","id":9828093,"node_id":"MDEyOk9yZ2FuaXphdGlvbjk4MjgwOTM=","avatar_url":"https://avatars1.githubusercontent.com/u/9828093?v=4","gravatar_id":"","url":"https://api.github.com/users/mattermost","html_url":"https://github.com/mattermost","followers_url":"https://api.github.com/users/mattermost/followers","following_url":"https://api.github.com/users/mattermost/following{/other_user}","gists_url":"https://api.github.com/users/mattermost/gists{/gist_id}","starred_url":"https://api.github.com/users/mattermost/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mattermost/subscriptions","organizations_url":"https://api.github.com/users/mattermost/orgs","repos_url":"https://api.github.com/users/mattermost/repos","events_url":"https://api.github.com/users/mattermost/events{/privacy}","received_events_url":"https://api.github.com/users/mattermost/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/mattermost/mattermost-cloud-monitoring","description":null,"fork":false,"url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring","forks_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/forks","keys_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/teams","hooks_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/hooks","issue_events_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/issues/events{/number}","events_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/events","assignees_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/assignees{/user}","branches_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/branches{/branch}","tags_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/tags","blobs_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/git/refs{/sha}","trees_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/statuses/{sha}","languages_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/languages","stargazers_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/stargazers","contributors_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/contributors","subscribers_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/subscribers","subscription_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/subscription","commits_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/commits{/sha}","git_commits_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/git/commits{/sha}","comments_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/comments{/number}","issue_comment_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/issues/comments{/number}","contents_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/contents/{+path}","compare_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/merges","archive_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/downloads","issues_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/issues{/number}","pulls_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls{/number}","milestones_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/milestones{/number}","notifications_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/labels{/name}","releases_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/releases{/id}","deployments_url":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/deployments","created_at":"2019-05-10T15:32:16Z","updated_at":"2019-12-19T12:36:19Z","pushed_at":"2019-12-20T17:09:30Z","git_url":"git://github.com/mattermost/mattermost-cloud-monitoring.git","ssh_url":"git@github.com:mattermost/mattermost-cloud-monitoring.git","clone_url":"https://github.com/mattermost/mattermost-cloud-monitoring.git","svn_url":"https://github.com/mattermost/mattermost-cloud-monitoring","homepage":null,"size":10013,"stargazers_count":4,"watchers_count":4,"language":"HCL","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":2,"license":null,"forks":3,"open_issues":2,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/38"},"html":{"href":"https://github.com/mattermost/mattermost-cloud-monitoring/pull/38"},"issue":{"href":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/issues/38"},"comments":{"href":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/mattermost/mattermost-cloud-monitoring/statuses/2162660d81cf3bba80d0530c9f7dd2ee746b9361"}},"author_association":"NONE"}}
{"actor":{"display_login":"gabrieljackson"}}