{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/origin-web-console/pulls/comments/78820803","id":78820803,"diff_hunk":"@@ -0,0 +1,67 @@\n+\"use strict\";\n+\n+angular.module(\"openshiftConsole\")\n+\n+  .directive(\"oscSecrets\", function($uibModal, $timeout) {\n+    return {\n+      restrict: 'E',\n+      scope: {\n+        pickedSecrets: \"=model\",\n+        allSecrets: '=',\n+        namespace: \"=\",\n+        additionalInputFieldName: \"@?\",\n+        additionalInputFieldTooltip: \"@?\",","path":"app/scripts/directives/oscSecrets.js","position":13,"original_position":13,"commit_id":"bb1c66cc30781ebc8f0a8e73bb9e0e697754308f","original_commit_id":"bb1c66cc30781ebc8f0a8e73bb9e0e697754308f","user":{"login":"spadgett","id":1167259,"avatar_url":"https://avatars.githubusercontent.com/u/1167259?v=3","gravatar_id":"","url":"https://api.github.com/users/spadgett","html_url":"https://github.com/spadgett","followers_url":"https://api.github.com/users/spadgett/followers","following_url":"https://api.github.com/users/spadgett/following{/other_user}","gists_url":"https://api.github.com/users/spadgett/gists{/gist_id}","starred_url":"https://api.github.com/users/spadgett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spadgett/subscriptions","organizations_url":"https://api.github.com/users/spadgett/orgs","repos_url":"https://api.github.com/users/spadgett/repos","events_url":"https://api.github.com/users/spadgett/events{/privacy}","received_events_url":"https://api.github.com/users/spadgett/received_events","type":"User","site_admin":false},"body":"It's strange to have a generic field with name and tooltip passed in. I'd much rather have the directive know what type of secret it is and just show the right thing.","created_at":"2016-09-14T19:30:02Z","updated_at":"2016-09-14T19:30:02Z","html_url":"https://github.com/openshift/origin-web-console/pull/511#discussion_r78820803","pull_request_url":"https://api.github.com/repos/openshift/origin-web-console/pulls/511","_links":{"self":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/comments/78820803"},"html":{"href":"https://github.com/openshift/origin-web-console/pull/511#discussion_r78820803"},"pull_request":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/511"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/origin-web-console/pulls/511","id":83846922,"html_url":"https://github.com/openshift/origin-web-console/pull/511","diff_url":"https://github.com/openshift/origin-web-console/pull/511.diff","patch_url":"https://github.com/openshift/origin-web-console/pull/511.patch","issue_url":"https://api.github.com/repos/openshift/origin-web-console/issues/511","number":511,"state":"open","locked":false,"title":"Add secrets to BC for private repos and registries","user":{"login":"jhadvig","id":1668218,"avatar_url":"https://avatars.githubusercontent.com/u/1668218?v=3","gravatar_id":"","url":"https://api.github.com/users/jhadvig","html_url":"https://github.com/jhadvig","followers_url":"https://api.github.com/users/jhadvig/followers","following_url":"https://api.github.com/users/jhadvig/following{/other_user}","gists_url":"https://api.github.com/users/jhadvig/gists{/gist_id}","starred_url":"https://api.github.com/users/jhadvig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhadvig/subscriptions","organizations_url":"https://api.github.com/users/jhadvig/orgs","repos_url":"https://api.github.com/users/jhadvig/repos","events_url":"https://api.github.com/users/jhadvig/events{/privacy}","received_events_url":"https://api.github.com/users/jhadvig/received_events","type":"User","site_admin":false},"body":"## Motivation\r\nAs an OpenShift user I want to add a secret to my Build config or Deployment Config so it can:\r\n- pull from a private registry (BC/DC)\r\n   - **SecretName** has to be specified\r\n   - pullImageSecret in the DC takes an _array_\r\n- push to a private registry (BC)\r\n   - **SecretName** has to be specified\r\n- access a private repository to get source code (BC)\r\n   - **SecretName** and **DestinationDir** has to be specified\r\n   - source secret in BC takes an _array_\r\n\r\nSecrets for pushing/pulling from a private registry requires [_dockercfg_ or  _dockerconfigjson_](https://docs.openshift.org/latest/dev_guide/builds.html#using-docker-credentials-for-pushing-and-pulling-images)  type of secret.\r\n\r\nSecrets accessing a private registry requires to be of [_basic-auth_](https://docs.openshift.org/latest/dev_guide/builds.html#basic-authentication), [_ssh-auth_](https://docs.openshift.org/latest/dev_guide/builds.html#ssh-key-authentication) or [_opaque_](https://docs.openshift.org/latest/dev_guide/builds.html#other-authentication) type of secret. \r\n\r\nAlso as a user I want to have a way how to create secrets for these actions, if desired secret does not exist.\r\n\r\n## Places to edit/add secrets\r\nSecret should be added to the BC/DC on pages that are dedicated to edit the BC/DC resource. Those would be:\r\n- BC editor:\r\n  - `Source Configuration` section, when source is located in private repository. \r\n  - `Image Configuration` section.\r\n  - `Image Configuration` section.\r\n\r\n- _fromimage_ page in the Create flow: \r\n   - `Build Configuration` section where user could configure source secret to be pulled from a private repository.\r\n\r\n- Since the DeploymentConfig does not have any editor then there are two options how to display the editation of DC with the secret:\r\n   1. Add a `Secrets` section on the DC browse page\r\n   2. Have a standalone page (eg. _Edit Health Checks_ on the DC) that would include the logic to edit DC with the image pull secret + create secrets of that type.\r\n\r\n## Proposal\r\nCreate a directive that could be reused on all the places we need to edit BC/DC with secrets. Directive would consist from three components:\r\n1. Selectbox using ui-select that would be used to display and pick desired secret(s). Based on the purpose of the secret single or a [multiple](https://github.com/angular-ui/ui-select/wiki/ui-select#examples-multiple-selection) secrets could be picked(eg. source secrets take an array). Secrets will be filtered based on annotation so user will pick only form relevant [secret types](https://github.com/openshift/origin/blob/master/vendor/k8s.io/kubernetes/pkg/api/types.go#L2615-L2693)\r\n2. Input field that would take the **DestinationDir** in case of source secret\r\n3. `Add Secret` button that would open a modal for creating the Secret that matches the secret type that is needed \r\n\r\nIn the modal user will be able to only create Secret types that are appropriate for resource section user is trying to edit(eg. if user would want to add secret for pulling image in a BC, he would be only able to create _dockercfg_ or  _dockerconfigjson_ secret types)\r\n\r\nThe modal will consist of a select picker that would contain secret types from which user pick and create that secret type. Based on secret type different inputfields will be rendered:\r\n- _dockercfg_ or  _dockerconfigjson_\r\n   - `osc-file-input` directive with d'n'd text area for attaching _dockercfg_ file or  _config.json _\r\n   - similar to `Import YAML / JSON` in `Add to Project`\r\n- _ssh-auth_\r\n   - `osc-file-input` directive with d'n'd text area for attaching private SSH key\r\n   - optionaly: - `osc-file-input` directive with d'n'd text area for attaching .gitconfig\r\n- _basic-auth_\r\n   - combination of username/password/.gitconfig. Based on [docs](https://docs.openshift.org/latest/dev_guide/builds.html#basic-authentication)\r\n\r\nEventually, after the secret will be created the success callback will then link the secret with appropriate _service account_. But thats not necessary for the implementation, based on the conversation we have with @csrwng \r\n\r\nNot 100% if the modal is the best way how to handle the secret creation, but on the other hand, redirecting from the BC editor(in case of standalone secret page) is not the best thing to do imho(only if the secret creation action will redirect back to the previous page)., and have the creation form inside of the BC editor is not the best approach as well.\r\n\r\n@jwforres @spadgett PTAL","created_at":"2016-09-02T18:41:08Z","updated_at":"2016-09-14T19:50:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5d8bd3c95fad4df33ec87ca5a7e445e0c76ed9f8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/origin-web-console/pulls/511/commits","review_comments_url":"https://api.github.com/repos/openshift/origin-web-console/pulls/511/comments","review_comment_url":"https://api.github.com/repos/openshift/origin-web-console/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/origin-web-console/issues/511/comments","statuses_url":"https://api.github.com/repos/openshift/origin-web-console/statuses/bb1c66cc30781ebc8f0a8e73bb9e0e697754308f","head":{"label":"jhadvig:secrets","ref":"secrets","sha":"bb1c66cc30781ebc8f0a8e73bb9e0e697754308f","user":{"login":"jhadvig","id":1668218,"avatar_url":"https://avatars.githubusercontent.com/u/1668218?v=3","gravatar_id":"","url":"https://api.github.com/users/jhadvig","html_url":"https://github.com/jhadvig","followers_url":"https://api.github.com/users/jhadvig/followers","following_url":"https://api.github.com/users/jhadvig/following{/other_user}","gists_url":"https://api.github.com/users/jhadvig/gists{/gist_id}","starred_url":"https://api.github.com/users/jhadvig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhadvig/subscriptions","organizations_url":"https://api.github.com/users/jhadvig/orgs","repos_url":"https://api.github.com/users/jhadvig/repos","events_url":"https://api.github.com/users/jhadvig/events{/privacy}","received_events_url":"https://api.github.com/users/jhadvig/received_events","type":"User","site_admin":false},"repo":{"id":58534077,"name":"origin-web-console","full_name":"jhadvig/origin-web-console","owner":{"login":"jhadvig","id":1668218,"avatar_url":"https://avatars.githubusercontent.com/u/1668218?v=3","gravatar_id":"","url":"https://api.github.com/users/jhadvig","html_url":"https://github.com/jhadvig","followers_url":"https://api.github.com/users/jhadvig/followers","following_url":"https://api.github.com/users/jhadvig/following{/other_user}","gists_url":"https://api.github.com/users/jhadvig/gists{/gist_id}","starred_url":"https://api.github.com/users/jhadvig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhadvig/subscriptions","organizations_url":"https://api.github.com/users/jhadvig/orgs","repos_url":"https://api.github.com/users/jhadvig/repos","events_url":"https://api.github.com/users/jhadvig/events{/privacy}","received_events_url":"https://api.github.com/users/jhadvig/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jhadvig/origin-web-console","description":"","fork":true,"url":"https://api.github.com/repos/jhadvig/origin-web-console","forks_url":"https://api.github.com/repos/jhadvig/origin-web-console/forks","keys_url":"https://api.github.com/repos/jhadvig/origin-web-console/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jhadvig/origin-web-console/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jhadvig/origin-web-console/teams","hooks_url":"https://api.github.com/repos/jhadvig/origin-web-console/hooks","issue_events_url":"https://api.github.com/repos/jhadvig/origin-web-console/issues/events{/number}","events_url":"https://api.github.com/repos/jhadvig/origin-web-console/events","assignees_url":"https://api.github.com/repos/jhadvig/origin-web-console/assignees{/user}","branches_url":"https://api.github.com/repos/jhadvig/origin-web-console/branches{/branch}","tags_url":"https://api.github.com/repos/jhadvig/origin-web-console/tags","blobs_url":"https://api.github.com/repos/jhadvig/origin-web-console/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jhadvig/origin-web-console/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jhadvig/origin-web-console/git/refs{/sha}","trees_url":"https://api.github.com/repos/jhadvig/origin-web-console/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jhadvig/origin-web-console/statuses/{sha}","languages_url":"https://api.github.com/repos/jhadvig/origin-web-console/languages","stargazers_url":"https://api.github.com/repos/jhadvig/origin-web-console/stargazers","contributors_url":"https://api.github.com/repos/jhadvig/origin-web-console/contributors","subscribers_url":"https://api.github.com/repos/jhadvig/origin-web-console/subscribers","subscription_url":"https://api.github.com/repos/jhadvig/origin-web-console/subscription","commits_url":"https://api.github.com/repos/jhadvig/origin-web-console/commits{/sha}","git_commits_url":"https://api.github.com/repos/jhadvig/origin-web-console/git/commits{/sha}","comments_url":"https://api.github.com/repos/jhadvig/origin-web-console/comments{/number}","issue_comment_url":"https://api.github.com/repos/jhadvig/origin-web-console/issues/comments{/number}","contents_url":"https://api.github.com/repos/jhadvig/origin-web-console/contents/{+path}","compare_url":"https://api.github.com/repos/jhadvig/origin-web-console/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jhadvig/origin-web-console/merges","archive_url":"https://api.github.com/repos/jhadvig/origin-web-console/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jhadvig/origin-web-console/downloads","issues_url":"https://api.github.com/repos/jhadvig/origin-web-console/issues{/number}","pulls_url":"https://api.github.com/repos/jhadvig/origin-web-console/pulls{/number}","milestones_url":"https://api.github.com/repos/jhadvig/origin-web-console/milestones{/number}","notifications_url":"https://api.github.com/repos/jhadvig/origin-web-console/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jhadvig/origin-web-console/labels{/name}","releases_url":"https://api.github.com/repos/jhadvig/origin-web-console/releases{/id}","deployments_url":"https://api.github.com/repos/jhadvig/origin-web-console/deployments","created_at":"2016-05-11T10:03:41Z","updated_at":"2016-05-11T10:03:42Z","pushed_at":"2016-09-14T17:14:17Z","git_url":"git://github.com/jhadvig/origin-web-console.git","ssh_url":"git@github.com:jhadvig/origin-web-console.git","clone_url":"https://github.com/jhadvig/origin-web-console.git","svn_url":"https://github.com/jhadvig/origin-web-console","homepage":null,"size":12912,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"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":"openshift:master","ref":"master","sha":"9069dfe8b15809d9a0272b73f5409331fe324d48","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":58488264,"name":"origin-web-console","full_name":"openshift/origin-web-console","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/origin-web-console","description":"","fork":false,"url":"https://api.github.com/repos/openshift/origin-web-console","forks_url":"https://api.github.com/repos/openshift/origin-web-console/forks","keys_url":"https://api.github.com/repos/openshift/origin-web-console/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/origin-web-console/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/origin-web-console/teams","hooks_url":"https://api.github.com/repos/openshift/origin-web-console/hooks","issue_events_url":"https://api.github.com/repos/openshift/origin-web-console/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/origin-web-console/events","assignees_url":"https://api.github.com/repos/openshift/origin-web-console/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/origin-web-console/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/origin-web-console/tags","blobs_url":"https://api.github.com/repos/openshift/origin-web-console/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/origin-web-console/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/origin-web-console/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/origin-web-console/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/origin-web-console/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/origin-web-console/languages","stargazers_url":"https://api.github.com/repos/openshift/origin-web-console/stargazers","contributors_url":"https://api.github.com/repos/openshift/origin-web-console/contributors","subscribers_url":"https://api.github.com/repos/openshift/origin-web-console/subscribers","subscription_url":"https://api.github.com/repos/openshift/origin-web-console/subscription","commits_url":"https://api.github.com/repos/openshift/origin-web-console/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/origin-web-console/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/origin-web-console/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/origin-web-console/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/origin-web-console/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/origin-web-console/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/origin-web-console/merges","archive_url":"https://api.github.com/repos/openshift/origin-web-console/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/origin-web-console/downloads","issues_url":"https://api.github.com/repos/openshift/origin-web-console/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/origin-web-console/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/origin-web-console/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/origin-web-console/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/origin-web-console/labels{/name}","releases_url":"https://api.github.com/repos/openshift/origin-web-console/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/origin-web-console/deployments","created_at":"2016-05-10T19:31:50Z","updated_at":"2016-08-22T11:45:49Z","pushed_at":"2016-09-14T19:38:59Z","git_url":"git://github.com/openshift/origin-web-console.git","ssh_url":"git@github.com:openshift/origin-web-console.git","clone_url":"https://github.com/openshift/origin-web-console.git","svn_url":"https://github.com/openshift/origin-web-console","homepage":null,"size":13566,"stargazers_count":18,"watchers_count":18,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":46,"mirror_url":null,"open_issues_count":54,"forks":46,"open_issues":54,"watchers":18,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/511"},"html":{"href":"https://github.com/openshift/origin-web-console/pull/511"},"issue":{"href":"https://api.github.com/repos/openshift/origin-web-console/issues/511"},"comments":{"href":"https://api.github.com/repos/openshift/origin-web-console/issues/511/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/511/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/origin-web-console/pulls/511/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/origin-web-console/statuses/bb1c66cc30781ebc8f0a8e73bb9e0e697754308f"}}}}
{"actor":{"display_login":"spadgett"}}