{"action":"created","comment":{"url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/comments/115537740","pull_request_review_id":37084312,"id":115537740,"diff_hunk":"@@ -96,31 +99,45 @@ def validate_secret_spec(secret_name, spec)\n     end\n \n     def create_or_update_secret(secret_name, secret_type, data)\n-      metadata = {\n-        name: secret_name,\n-        labels: { \"name\" => secret_name },\n-        namespace: @namespace,\n-        annotations: { MANAGEMENT_ANNOTATION => \"true\" }\n-      }\n-      secret = Kubeclient::Secret.new(type: secret_type, stringData: data, metadata: metadata)\n-      if secret_exists?(secret)\n-        KubernetesDeploy.logger.info(\"Updating secret #{secret_name}\")\n-        @kubeclient.update_secret(secret)\n-      else\n-        KubernetesDeploy.logger.info(\"Creating secret #{secret_name}\")\n-        @kubeclient.create_secret(secret)\n+      secret_yaml = generate_secret_yaml(secret_name, secret_type, data)\n+      msg = secret_exists?(secret_name) ? \"Updating secret #{secret_name}\" : \"Creating secret #{secret_name}\"\n+      KubernetesDeploy.logger.info(msg)\n+\n+      file = Tempfile.new(secret_name)\n+      file.write(secret_yaml)\n+      file.close","path":"lib/kubernetes-deploy/ejson_secret_provisioner.rb","position":77,"original_position":77,"commit_id":"f92b38de8d731c9d33e633995aebc396c3140460","original_commit_id":"f92b38de8d731c9d33e633995aebc396c3140460","user":{"login":"mkobetic","id":871693,"avatar_url":"https://avatars1.githubusercontent.com/u/871693?v=3","gravatar_id":"","url":"https://api.github.com/users/mkobetic","html_url":"https://github.com/mkobetic","followers_url":"https://api.github.com/users/mkobetic/followers","following_url":"https://api.github.com/users/mkobetic/following{/other_user}","gists_url":"https://api.github.com/users/mkobetic/gists{/gist_id}","starred_url":"https://api.github.com/users/mkobetic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mkobetic/subscriptions","organizations_url":"https://api.github.com/users/mkobetic/orgs","repos_url":"https://api.github.com/users/mkobetic/repos","events_url":"https://api.github.com/users/mkobetic/events{/privacy}","received_events_url":"https://api.github.com/users/mkobetic/received_events","type":"User","site_admin":false},"body":"I would expect that if the file was flushed after write the shell command should be able to read it then, but I haven't tried.","created_at":"2017-05-09T16:35:43Z","updated_at":"2017-05-09T16:35:43Z","html_url":"https://github.com/Shopify/kubernetes-deploy/pull/91#discussion_r115537740","pull_request_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/91","_links":{"self":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/comments/115537740"},"html":{"href":"https://github.com/Shopify/kubernetes-deploy/pull/91#discussion_r115537740"},"pull_request":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/91"}}},"pull_request":{"url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/91","id":119558895,"html_url":"https://github.com/Shopify/kubernetes-deploy/pull/91","diff_url":"https://github.com/Shopify/kubernetes-deploy/pull/91.diff","patch_url":"https://github.com/Shopify/kubernetes-deploy/pull/91.patch","issue_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/91","number":91,"state":"open","locked":false,"title":"Use kubectl in EjsonSecretProvisioner","user":{"login":"KnVerey","id":4789493,"avatar_url":"https://avatars3.githubusercontent.com/u/4789493?v=3","gravatar_id":"","url":"https://api.github.com/users/KnVerey","html_url":"https://github.com/KnVerey","followers_url":"https://api.github.com/users/KnVerey/followers","following_url":"https://api.github.com/users/KnVerey/following{/other_user}","gists_url":"https://api.github.com/users/KnVerey/gists{/gist_id}","starred_url":"https://api.github.com/users/KnVerey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KnVerey/subscriptions","organizations_url":"https://api.github.com/users/KnVerey/orgs","repos_url":"https://api.github.com/users/KnVerey/repos","events_url":"https://api.github.com/users/KnVerey/events{/privacy}","received_events_url":"https://api.github.com/users/KnVerey/received_events","type":"User","site_admin":false},"body":"tl;dr `kubeclient` isn't working for some of our production clusters, so this switches `EjsonSecretProvisioner` over to `kubectl`--which is what the rest of the deploy process uses--for the time being. \r\n\r\n---\r\n\r\nWhen I rolled out https://github.com/Shopify/kubernetes-deploy/pull/81 in shipit, I discovered that kubeclient does not seem to be working with our GCP clusters. It is failing with an SSL error on `client.discover` ([see this deploy](https://shipit.shopify.io/shopify/hackdays-gke-rails5/production/deploys/445001)). This may be a further piece to the work @xldenis already did in https://github.com/Shopify/kubernetes-deploy/pull/88; he is investigating.\r\n\r\nThe most meaningful change is that we need to write a tempfile to use `kubectl apply` for secret creation/update. Note that although the unit tests required surgery, the integration tests all passed as-is.\r\n\r\n**Why not wait for the kubeclient fix?** \r\nThe current consensus is still that we want to use a gem rather than kubectl for everything we can (which doesn't include \"apply\" operations) in the long run, but I didn't realize that none of the tasks that already use kubeclient had been tested in our production Shipit environment. This feature is high-priority, and switching to kubeclient is far from it. With the problems we've had, we may even want to reconsider this particular gem choice.\r\n\r\ncc @Shopify/cloudplatform ","created_at":"2017-05-08T23:58:10Z","updated_at":"2017-05-09T16:35:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1907a9c135bbf8576c8332bd93e59f9a590545ee","assignee":null,"assignees":[],"requested_reviewers":[{"login":"kirs","id":522155,"avatar_url":"https://avatars0.githubusercontent.com/u/522155?v=3","gravatar_id":"","url":"https://api.github.com/users/kirs","html_url":"https://github.com/kirs","followers_url":"https://api.github.com/users/kirs/followers","following_url":"https://api.github.com/users/kirs/following{/other_user}","gists_url":"https://api.github.com/users/kirs/gists{/gist_id}","starred_url":"https://api.github.com/users/kirs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kirs/subscriptions","organizations_url":"https://api.github.com/users/kirs/orgs","repos_url":"https://api.github.com/users/kirs/repos","events_url":"https://api.github.com/users/kirs/events{/privacy}","received_events_url":"https://api.github.com/users/kirs/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/91/commits","review_comments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/91/comments","review_comment_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/91/comments","statuses_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/statuses/f92b38de8d731c9d33e633995aebc396c3140460","head":{"label":"Shopify:ejson_kubectl","ref":"ejson_kubectl","sha":"f92b38de8d731c9d33e633995aebc396c3140460","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars2.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":79269805,"name":"kubernetes-deploy","full_name":"Shopify/kubernetes-deploy","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars2.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/kubernetes-deploy","description":"Collection of scripts to deploy apps to Kubernetes","fork":false,"url":"https://api.github.com/repos/Shopify/kubernetes-deploy","forks_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/forks","keys_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/teams","hooks_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/hooks","issue_events_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/events","assignees_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/tags","blobs_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/languages","stargazers_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/stargazers","contributors_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/contributors","subscribers_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/subscribers","subscription_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/subscription","commits_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/merges","archive_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/downloads","issues_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/deployments","created_at":"2017-01-17T20:41:23Z","updated_at":"2017-04-28T19:36:46Z","pushed_at":"2017-05-09T00:02:20Z","git_url":"git://github.com/Shopify/kubernetes-deploy.git","ssh_url":"git@github.com:Shopify/kubernetes-deploy.git","clone_url":"https://github.com/Shopify/kubernetes-deploy.git","svn_url":"https://github.com/Shopify/kubernetes-deploy","homepage":"","size":240,"stargazers_count":10,"watchers_count":10,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":26,"forks":0,"open_issues":26,"watchers":10,"default_branch":"master"}},"base":{"label":"Shopify:master","ref":"master","sha":"577787ce506f103f1582a05d8c1608cb0085df60","user":{"login":"Shopify","id":8085,"avatar_url":"https://avatars2.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"repo":{"id":79269805,"name":"kubernetes-deploy","full_name":"Shopify/kubernetes-deploy","owner":{"login":"Shopify","id":8085,"avatar_url":"https://avatars2.githubusercontent.com/u/8085?v=3","gravatar_id":"","url":"https://api.github.com/users/Shopify","html_url":"https://github.com/Shopify","followers_url":"https://api.github.com/users/Shopify/followers","following_url":"https://api.github.com/users/Shopify/following{/other_user}","gists_url":"https://api.github.com/users/Shopify/gists{/gist_id}","starred_url":"https://api.github.com/users/Shopify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shopify/subscriptions","organizations_url":"https://api.github.com/users/Shopify/orgs","repos_url":"https://api.github.com/users/Shopify/repos","events_url":"https://api.github.com/users/Shopify/events{/privacy}","received_events_url":"https://api.github.com/users/Shopify/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Shopify/kubernetes-deploy","description":"Collection of scripts to deploy apps to Kubernetes","fork":false,"url":"https://api.github.com/repos/Shopify/kubernetes-deploy","forks_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/forks","keys_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/teams","hooks_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/hooks","issue_events_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/events{/number}","events_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/events","assignees_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/assignees{/user}","branches_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/branches{/branch}","tags_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/tags","blobs_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/refs{/sha}","trees_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/statuses/{sha}","languages_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/languages","stargazers_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/stargazers","contributors_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/contributors","subscribers_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/subscribers","subscription_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/subscription","commits_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/commits{/sha}","git_commits_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/git/commits{/sha}","comments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/comments{/number}","issue_comment_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/comments{/number}","contents_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/contents/{+path}","compare_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/merges","archive_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/downloads","issues_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues{/number}","pulls_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls{/number}","milestones_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/milestones{/number}","notifications_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/labels{/name}","releases_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/releases{/id}","deployments_url":"https://api.github.com/repos/Shopify/kubernetes-deploy/deployments","created_at":"2017-01-17T20:41:23Z","updated_at":"2017-04-28T19:36:46Z","pushed_at":"2017-05-09T00:02:20Z","git_url":"git://github.com/Shopify/kubernetes-deploy.git","ssh_url":"git@github.com:Shopify/kubernetes-deploy.git","clone_url":"https://github.com/Shopify/kubernetes-deploy.git","svn_url":"https://github.com/Shopify/kubernetes-deploy","homepage":"","size":240,"stargazers_count":10,"watchers_count":10,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":26,"forks":0,"open_issues":26,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/91"},"html":{"href":"https://github.com/Shopify/kubernetes-deploy/pull/91"},"issue":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/91"},"comments":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/issues/91/comments"},"review_comments":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/91/comments"},"review_comment":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/pulls/91/commits"},"statuses":{"href":"https://api.github.com/repos/Shopify/kubernetes-deploy/statuses/f92b38de8d731c9d33e633995aebc396c3140460"}}}}
{"actor":{"display_login":"mkobetic"}}