{"action":"created","comment":{"url":"https://api.github.com/repos/kubeapps/kubeapps/pulls/comments/319333924","pull_request_review_id":281799296,"id":319333924,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMxOTMzMzkyNA==","diff_hunk":"@@ -309,35 +312,64 @@ func (c *Chart) InitNetClient(details *Details) (HTTPClient, error) {\n \t\tcaCertPool = x509.NewCertPool()\n \t}\n \n-\t// If additionalCA is set, load it\n-\tcustomCA := details.Auth.CustomCA\n \tnamespace := os.Getenv(\"POD_NAMESPACE\")\n \tif namespace == \"\" {\n \t\tnamespace = defaultNamespace\n \t}\n-\tif customCA != nil {\n-\t\tcaCertSecret, err := c.kubeClient.CoreV1().Secrets(namespace).Get(customCA.SecretKeyRef.Name, metav1.GetOptions{})\n+\n+\t// If the app repo url is specified then we'll grab the customCA and\n+\t// defaultHeaders from there, otherwise default to the current details.Auth\n+\t// (until that path is removed).\n+\t// TODO(absoludity): Check whether there is a reason that Details.Auth is a different type\n+\t// to appRepo.Spec.Auth (though they have identical fields). The following would be simpler\n+\t// if they were the same types, as we could just find the Auth struct, rather than secret\n+\t// key refs.\n+\tvar customCASecretRef *corev1.SecretKeySelector\n+\tvar authHeaderSecretRef *corev1.SecretKeySelector\n+\tdefaultHeaders := http.Header{\"User-Agent\": []string{c.userAgent}}\n+\tif details.AppRepositoryResourceName != \"\" {\n+\t\tappRepo, err := c.appRepoClient.KubeappsV1alpha1().AppRepositories(namespace).Get(details.AppRepositoryResourceName, metav1.GetOptions{})\n+\t\tif err != nil {\n+\t\t\treturn nil, fmt.Errorf(\"unable to get app repository %q: %v\", details.AppRepositoryResourceName, err)\n+\t\t}\n+\t\tif appRepo.Spec.Auth.CustomCA != nil {\n+\t\t\tcustomCASecretRef = &appRepo.Spec.Auth.CustomCA.SecretKeyRef\n+\t\t}\n+\t\tif appRepo.Spec.Auth.Header != nil {\n+\t\t\tauthHeaderSecretRef = &appRepo.Spec.Auth.Header.SecretKeyRef\n+\t\t}\n+\n+\t} else {\n+\t\tif details.Auth.CustomCA != nil {\n+\t\t\tcustomCASecretRef = &details.Auth.CustomCA.SecretKeyRef\n+\t\t}\n+\t\tif details.Auth.Header != nil {\n+\t\t\tauthHeaderSecretRef = &details.Auth.Header.SecretKeyRef\n+\t\t}\n+\t}\n+\n+\tif customCASecretRef != nil {\n+\t\tcaCertSecret, err := c.kubeClient.CoreV1().Secrets(namespace).Get(customCASecretRef.Name, metav1.GetOptions{})\n \t\tif err != nil {\n-\t\t\treturn nil, fmt.Errorf(\"unable to read secret %q: %v\", customCA.SecretKeyRef.Name, err)\n+\t\t\treturn nil, fmt.Errorf(\"unable to read secret %q: %v\", customCASecretRef.Name, err)\n \t\t}\n \n \t\t// Append our cert to the system pool\n-\t\tcustomData, ok := caCertSecret.Data[customCA.SecretKeyRef.Key]\n+\t\tcustomData, ok := caCertSecret.Data[customCASecretRef.Key]\n \t\tif !ok {\n-\t\t\treturn nil, fmt.Errorf(\"secret %q did not contain key %q\", customCA.SecretKeyRef.Name, customCA.SecretKeyRef.Key)\n+\t\t\treturn nil, fmt.Errorf(\"secret %q did not contain key %q\", customCASecretRef.Name, customCASecretRef.Key)\n \t\t}\n \t\tif ok := caCertPool.AppendCertsFromPEM(customData); !ok {\n-\t\t\treturn nil, fmt.Errorf(\"Failed to append %s to RootCAs\", customCA.SecretKeyRef.Name)\n+\t\t\treturn nil, fmt.Errorf(\"Failed to append %s to RootCAs\", customCASecretRef.Name)\n \t\t}\n \t}\n \n-\tdefaultHeaders := http.Header{\"User-Agent\": []string{c.userAgent}}","path":"pkg/chart/chart.go","position":77,"original_position":94,"commit_id":"8707985af02deffbde7854516f36b6c90f357a01","original_commit_id":"6197f5ec8b5d57d0e1ad52234fbc0b9b07beeb0b","user":{"login":"absoludity","id":497518,"node_id":"MDQ6VXNlcjQ5NzUxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/497518?v=4","gravatar_id":"","url":"https://api.github.com/users/absoludity","html_url":"https://github.com/absoludity","followers_url":"https://api.github.com/users/absoludity/followers","following_url":"https://api.github.com/users/absoludity/following{/other_user}","gists_url":"https://api.github.com/users/absoludity/gists{/gist_id}","starred_url":"https://api.github.com/users/absoludity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/absoludity/subscriptions","organizations_url":"https://api.github.com/users/absoludity/orgs","repos_url":"https://api.github.com/users/absoludity/repos","events_url":"https://api.github.com/users/absoludity/events{/privacy}","received_events_url":"https://api.github.com/users/absoludity/received_events","type":"User","site_admin":false},"body":"Not sure if I had some in-transit code which required it earlier, but you're right, no longer there. Moved back to context. Thanks.","created_at":"2019-08-30T02:04:44Z","updated_at":"2019-08-30T02:04:51Z","html_url":"https://github.com/kubeapps/kubeapps/pull/1137#discussion_r319333924","pull_request_url":"https://api.github.com/repos/kubeapps/kubeapps/pulls/1137","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/kubeapps/kubeapps/pulls/comments/319333924"},"html":{"href":"https://github.com/kubeapps/kubeapps/pull/1137#discussion_r319333924"},"pull_request":{"href":"https://api.github.com/repos/kubeapps/kubeapps/pulls/1137"}},"in_reply_to_id":317540255},"pull_request":{"url":"https://api.github.com/repos/kubeapps/kubeapps/pulls/1137","id":310341777,"node_id":"MDExOlB1bGxSZXF1ZXN0MzEwMzQxNzc3","html_url":"https://github.com/kubeapps/kubeapps/pull/1137","diff_url":"https://github.com/kubeapps/kubeapps/pull/1137.diff","patch_url":"https://github.com/kubeapps/kubeapps/pull/1137.patch","issue_url":"https://api.github.com/repos/kubeapps/kubeapps/issues/1137","number":1137,"state":"open","locked":false,"title":"Fetch AppRepo to obtain auth data (so client doesn't need to send it).","user":{"login":"absoludity","id":497518,"node_id":"MDQ6VXNlcjQ5NzUxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/497518?v=4","gravatar_id":"","url":"https://api.github.com/users/absoludity","html_url":"https://github.com/absoludity","followers_url":"https://api.github.com/users/absoludity/followers","following_url":"https://api.github.com/users/absoludity/following{/other_user}","gists_url":"https://api.github.com/users/absoludity/gists{/gist_id}","starred_url":"https://api.github.com/users/absoludity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/absoludity/subscriptions","organizations_url":"https://api.github.com/users/absoludity/orgs","repos_url":"https://api.github.com/users/absoludity/repos","events_url":"https://api.github.com/users/absoludity/events{/privacy}","received_events_url":"https://api.github.com/users/absoludity/received_events","type":"User","site_admin":false},"body":"Adds a clientset for the app revision API and uses that to get the AppRepository custom resource, if a name was specified in the request. This will enable the client (Kubeapps dashboard) to send the app repository name, rather than having to fetch the app repo (which can fail if certain RBAC is not setup).\r\n\r\nRef: #1110 ","created_at":"2019-08-23T11:13:05Z","updated_at":"2019-08-30T02:04:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c64d869bbecf503abc3da71d080d25d3c4e9cd8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/kubeapps/kubeapps/pulls/1137/commits","review_comments_url":"https://api.github.com/repos/kubeapps/kubeapps/pulls/1137/comments","review_comment_url":"https://api.github.com/repos/kubeapps/kubeapps/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kubeapps/kubeapps/issues/1137/comments","statuses_url":"https://api.github.com/repos/kubeapps/kubeapps/statuses/8707985af02deffbde7854516f36b6c90f357a01","head":{"label":"absoludity:fetch-app-repo-for-auth","ref":"fetch-app-repo-for-auth","sha":"8707985af02deffbde7854516f36b6c90f357a01","user":{"login":"absoludity","id":497518,"node_id":"MDQ6VXNlcjQ5NzUxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/497518?v=4","gravatar_id":"","url":"https://api.github.com/users/absoludity","html_url":"https://github.com/absoludity","followers_url":"https://api.github.com/users/absoludity/followers","following_url":"https://api.github.com/users/absoludity/following{/other_user}","gists_url":"https://api.github.com/users/absoludity/gists{/gist_id}","starred_url":"https://api.github.com/users/absoludity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/absoludity/subscriptions","organizations_url":"https://api.github.com/users/absoludity/orgs","repos_url":"https://api.github.com/users/absoludity/repos","events_url":"https://api.github.com/users/absoludity/events{/privacy}","received_events_url":"https://api.github.com/users/absoludity/received_events","type":"User","site_admin":false},"repo":{"id":199396460,"node_id":"MDEwOlJlcG9zaXRvcnkxOTkzOTY0NjA=","name":"kubeapps","full_name":"absoludity/kubeapps","private":false,"owner":{"login":"absoludity","id":497518,"node_id":"MDQ6VXNlcjQ5NzUxOA==","avatar_url":"https://avatars0.githubusercontent.com/u/497518?v=4","gravatar_id":"","url":"https://api.github.com/users/absoludity","html_url":"https://github.com/absoludity","followers_url":"https://api.github.com/users/absoludity/followers","following_url":"https://api.github.com/users/absoludity/following{/other_user}","gists_url":"https://api.github.com/users/absoludity/gists{/gist_id}","starred_url":"https://api.github.com/users/absoludity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/absoludity/subscriptions","organizations_url":"https://api.github.com/users/absoludity/orgs","repos_url":"https://api.github.com/users/absoludity/repos","events_url":"https://api.github.com/users/absoludity/events{/privacy}","received_events_url":"https://api.github.com/users/absoludity/received_events","type":"User","site_admin":false},"html_url":"https://github.com/absoludity/kubeapps","description":"A web-based UI for deploying and managing applications in Kubernetes clusters","fork":true,"url":"https://api.github.com/repos/absoludity/kubeapps","forks_url":"https://api.github.com/repos/absoludity/kubeapps/forks","keys_url":"https://api.github.com/repos/absoludity/kubeapps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/absoludity/kubeapps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/absoludity/kubeapps/teams","hooks_url":"https://api.github.com/repos/absoludity/kubeapps/hooks","issue_events_url":"https://api.github.com/repos/absoludity/kubeapps/issues/events{/number}","events_url":"https://api.github.com/repos/absoludity/kubeapps/events","assignees_url":"https://api.github.com/repos/absoludity/kubeapps/assignees{/user}","branches_url":"https://api.github.com/repos/absoludity/kubeapps/branches{/branch}","tags_url":"https://api.github.com/repos/absoludity/kubeapps/tags","blobs_url":"https://api.github.com/repos/absoludity/kubeapps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/absoludity/kubeapps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/absoludity/kubeapps/git/refs{/sha}","trees_url":"https://api.github.com/repos/absoludity/kubeapps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/absoludity/kubeapps/statuses/{sha}","languages_url":"https://api.github.com/repos/absoludity/kubeapps/languages","stargazers_url":"https://api.github.com/repos/absoludity/kubeapps/stargazers","contributors_url":"https://api.github.com/repos/absoludity/kubeapps/contributors","subscribers_url":"https://api.github.com/repos/absoludity/kubeapps/subscribers","subscription_url":"https://api.github.com/repos/absoludity/kubeapps/subscription","commits_url":"https://api.github.com/repos/absoludity/kubeapps/commits{/sha}","git_commits_url":"https://api.github.com/repos/absoludity/kubeapps/git/commits{/sha}","comments_url":"https://api.github.com/repos/absoludity/kubeapps/comments{/number}","issue_comment_url":"https://api.github.com/repos/absoludity/kubeapps/issues/comments{/number}","contents_url":"https://api.github.com/repos/absoludity/kubeapps/contents/{+path}","compare_url":"https://api.github.com/repos/absoludity/kubeapps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/absoludity/kubeapps/merges","archive_url":"https://api.github.com/repos/absoludity/kubeapps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/absoludity/kubeapps/downloads","issues_url":"https://api.github.com/repos/absoludity/kubeapps/issues{/number}","pulls_url":"https://api.github.com/repos/absoludity/kubeapps/pulls{/number}","milestones_url":"https://api.github.com/repos/absoludity/kubeapps/milestones{/number}","notifications_url":"https://api.github.com/repos/absoludity/kubeapps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/absoludity/kubeapps/labels{/name}","releases_url":"https://api.github.com/repos/absoludity/kubeapps/releases{/id}","deployments_url":"https://api.github.com/repos/absoludity/kubeapps/deployments","created_at":"2019-07-29T06:57:17Z","updated_at":"2019-07-29T06:57:20Z","pushed_at":"2019-08-30T02:02:34Z","git_url":"git://github.com/absoludity/kubeapps.git","ssh_url":"git@github.com:absoludity/kubeapps.git","clone_url":"https://github.com/absoludity/kubeapps.git","svn_url":"https://github.com/absoludity/kubeapps","homepage":"https://kubeapps.com","size":52656,"stargazers_count":0,"watchers_count":0,"language":"TypeScript","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":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kubeapps:master","ref":"master","sha":"f2cef22cd90d2e9cc0d27552ce1a739645ab3604","user":{"login":"kubeapps","id":32396354,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMzk2MzU0","avatar_url":"https://avatars0.githubusercontent.com/u/32396354?v=4","gravatar_id":"","url":"https://api.github.com/users/kubeapps","html_url":"https://github.com/kubeapps","followers_url":"https://api.github.com/users/kubeapps/followers","following_url":"https://api.github.com/users/kubeapps/following{/other_user}","gists_url":"https://api.github.com/users/kubeapps/gists{/gist_id}","starred_url":"https://api.github.com/users/kubeapps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubeapps/subscriptions","organizations_url":"https://api.github.com/users/kubeapps/orgs","repos_url":"https://api.github.com/users/kubeapps/repos","events_url":"https://api.github.com/users/kubeapps/events{/privacy}","received_events_url":"https://api.github.com/users/kubeapps/received_events","type":"Organization","site_admin":false},"repo":{"id":107555654,"node_id":"MDEwOlJlcG9zaXRvcnkxMDc1NTU2NTQ=","name":"kubeapps","full_name":"kubeapps/kubeapps","private":false,"owner":{"login":"kubeapps","id":32396354,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMzk2MzU0","avatar_url":"https://avatars0.githubusercontent.com/u/32396354?v=4","gravatar_id":"","url":"https://api.github.com/users/kubeapps","html_url":"https://github.com/kubeapps","followers_url":"https://api.github.com/users/kubeapps/followers","following_url":"https://api.github.com/users/kubeapps/following{/other_user}","gists_url":"https://api.github.com/users/kubeapps/gists{/gist_id}","starred_url":"https://api.github.com/users/kubeapps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kubeapps/subscriptions","organizations_url":"https://api.github.com/users/kubeapps/orgs","repos_url":"https://api.github.com/users/kubeapps/repos","events_url":"https://api.github.com/users/kubeapps/events{/privacy}","received_events_url":"https://api.github.com/users/kubeapps/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/kubeapps/kubeapps","description":"A web-based UI for deploying and managing applications in Kubernetes clusters","fork":false,"url":"https://api.github.com/repos/kubeapps/kubeapps","forks_url":"https://api.github.com/repos/kubeapps/kubeapps/forks","keys_url":"https://api.github.com/repos/kubeapps/kubeapps/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kubeapps/kubeapps/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kubeapps/kubeapps/teams","hooks_url":"https://api.github.com/repos/kubeapps/kubeapps/hooks","issue_events_url":"https://api.github.com/repos/kubeapps/kubeapps/issues/events{/number}","events_url":"https://api.github.com/repos/kubeapps/kubeapps/events","assignees_url":"https://api.github.com/repos/kubeapps/kubeapps/assignees{/user}","branches_url":"https://api.github.com/repos/kubeapps/kubeapps/branches{/branch}","tags_url":"https://api.github.com/repos/kubeapps/kubeapps/tags","blobs_url":"https://api.github.com/repos/kubeapps/kubeapps/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kubeapps/kubeapps/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kubeapps/kubeapps/git/refs{/sha}","trees_url":"https://api.github.com/repos/kubeapps/kubeapps/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kubeapps/kubeapps/statuses/{sha}","languages_url":"https://api.github.com/repos/kubeapps/kubeapps/languages","stargazers_url":"https://api.github.com/repos/kubeapps/kubeapps/stargazers","contributors_url":"https://api.github.com/repos/kubeapps/kubeapps/contributors","subscribers_url":"https://api.github.com/repos/kubeapps/kubeapps/subscribers","subscription_url":"https://api.github.com/repos/kubeapps/kubeapps/subscription","commits_url":"https://api.github.com/repos/kubeapps/kubeapps/commits{/sha}","git_commits_url":"https://api.github.com/repos/kubeapps/kubeapps/git/commits{/sha}","comments_url":"https://api.github.com/repos/kubeapps/kubeapps/comments{/number}","issue_comment_url":"https://api.github.com/repos/kubeapps/kubeapps/issues/comments{/number}","contents_url":"https://api.github.com/repos/kubeapps/kubeapps/contents/{+path}","compare_url":"https://api.github.com/repos/kubeapps/kubeapps/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kubeapps/kubeapps/merges","archive_url":"https://api.github.com/repos/kubeapps/kubeapps/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kubeapps/kubeapps/downloads","issues_url":"https://api.github.com/repos/kubeapps/kubeapps/issues{/number}","pulls_url":"https://api.github.com/repos/kubeapps/kubeapps/pulls{/number}","milestones_url":"https://api.github.com/repos/kubeapps/kubeapps/milestones{/number}","notifications_url":"https://api.github.com/repos/kubeapps/kubeapps/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kubeapps/kubeapps/labels{/name}","releases_url":"https://api.github.com/repos/kubeapps/kubeapps/releases{/id}","deployments_url":"https://api.github.com/repos/kubeapps/kubeapps/deployments","created_at":"2017-10-19T14:14:34Z","updated_at":"2019-08-29T08:58:35Z","pushed_at":"2019-08-30T02:02:36Z","git_url":"git://github.com/kubeapps/kubeapps.git","ssh_url":"git@github.com:kubeapps/kubeapps.git","clone_url":"https://github.com/kubeapps/kubeapps.git","svn_url":"https://github.com/kubeapps/kubeapps","homepage":"https://kubeapps.com","size":52635,"stargazers_count":1542,"watchers_count":1542,"language":"TypeScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":265,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":105,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":265,"open_issues":105,"watchers":1542,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kubeapps/kubeapps/pulls/1137"},"html":{"href":"https://github.com/kubeapps/kubeapps/pull/1137"},"issue":{"href":"https://api.github.com/repos/kubeapps/kubeapps/issues/1137"},"comments":{"href":"https://api.github.com/repos/kubeapps/kubeapps/issues/1137/comments"},"review_comments":{"href":"https://api.github.com/repos/kubeapps/kubeapps/pulls/1137/comments"},"review_comment":{"href":"https://api.github.com/repos/kubeapps/kubeapps/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kubeapps/kubeapps/pulls/1137/commits"},"statuses":{"href":"https://api.github.com/repos/kubeapps/kubeapps/statuses/8707985af02deffbde7854516f36b6c90f357a01"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"absoludity"}}