{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments/174660510","pull_request_review_id":104053712,"id":174660510,"diff_hunk":"@@ -0,0 +1,206 @@\n+# Basic Helm Chart Registry Adapter Proposal\n+\n+## Introduction\n+\n+Add a new registry adapter type, `helm`, that supports Helm chart\n+repositories. With this change, an admin could configure the broker by adding\n+a `helm` registry type and have the Helm charts hosted in that Helm chart\n+repository converted into objects the broker knows how to manage for use via\n+the Service Catalog.\n+\n+## Problem Description\n+\n+Currently, our broker only supports docker container image type registries.\n+However, with [Helm](https://helm.sh) being the \"package manager for Kubernetes\",\n+there is already a strong collection of applications defined in the form of\n+Helm charts. Modifying the broker to consume these Helm charts as Service\n+Bundles allows work already done in Helm charts to be made available in\n+a cluster.\n+\n+## Creating a Base Image for Executing Helm Charts\n+\n+Ansible Playbook Bundles (APBs) have already been described as an instance of\n+the more generic Service Bundle. Here, we will be creating a new type of\n+Service Bundle, Helm Bundles, that respect the Service Bundle contract but use\n+Helm as the runtime. We already have a [Helm Bundle\n+Base](https://github.com/ansibleplaybookbundle/helm-bundle-base) and this\n+[PR](https://github.com/ansibleplaybookbundle/helm-bundle-base/pull/2)\n+shows the work required to implement the Service Bundle contract generically\n+using Helm.\n+\n+## Broker Modifications\n+\n+### Broker Config Options\n+\n+It is expected that a broker admin who wants to expose Helm charts would update\n+the broker's config to look something like:\n+\n+```\n+registry:\n+  - type: helm\n+    name: stable\n+    url: \"https://kubernetes-charts.storage.googleapis.com\"\n+    base_image: \"docker.io/djzager/helm-bundle-base:latest\"\n+    white_list:\n+      - \".*\"\n+```\n+\n+1. Type: refers to the registry adapter to handle this registry\n+1. Name: gives a name to this registry item\n+1. URL: the URL for the Helm chart repository\n+1. Base Image: the container image to use when provisioning/deprovisioning a\n+   Helm chart\n+1. White List/Black List: allows the Admin to filter out Helm charts\n+\n+### Changes to the Registry Package\n+\n+- Add the ability to read the `base_image` from the broker config.\n+- Pass the URL and BaseImage to the registry adapter.\n+- Instantiate a Helm registry adapter to handle Helm Chart registries in the\n+  config.\n+\n+### Creating a Helm Adapter\n+\n+The `HelmAdapter` struct will look something like the example below:\n+\n+```\n+// import \"k8s.io/helm/pkg/repo\"\n+// HelmAdapter - Helm Registry Adapter\n+type HelmAdapter struct {\n+    Config Configuration\n+    Log    *logging.Logger\n+    Charts map[string][]*repo.ChartVersion\n+}\n+```\n+\n+The addition of the `Charts` field makes it possible to save our work and only\n+read the registries' index file once.\n+\n+When the broker calls `GetImageNames()` the Helm adapter will read the\n+`index.yaml` found at the Helm Chart Repository URL based on the [chart\n+repository\n+structure](https://github.com/kubernetes/helm/blob/master/docs/chart_repository.md#the-chart-repository-structure).\n+The broker will create an entry in the `Charts` field to hold a list of\n+`ChartVersion` objects and  add the chart name to the list of `imageNames`\n+to be returned.\n+\n+After these image names are filtered, the subsequent call to `FetchSpecs()`\n+will:\n+\n+- Find the chart by name in the `Charts` field\n+- Save all the versions of the chart:\n+\n+```\n+var chartVersions []string\n+for _, chart := range charts {\n+    chartVersions = append(chartVersions, chart.Version)\n+}\n+```\n+\n+- Use the latest version of the chart to create a bundle `Spec` object:\n+\n+```\n+// Use the latest chart for creating the bundle\n+chart := charts[0]\n+```\n+\n+- Load the chart in memory to grab the content of the values file:\n+\n+```\n+resp, err := http.Get(chart.URLs[0])\n+if err != nil {\n+        return specs, err\n+}\n+defer resp.Body.Close()\n+\n+helmChart, err := chartutil.LoadArchive(resp.Body)\n+if err != nil {\n+        return specs, err\n+}\n+\n+if helmChart.Values != nil {\n+        values = helmChart.Values.Raw\n+}\n+```\n+\n+- Create a bundle `Spec` object:\n+\n+```\n+// Convert chart to Bundle Spec\n+spec := &apb.Spec{\n+    Runtime:     2,\n+    Version:     \"1.0\",\n+    Async:       \"optional\",\n+    Bindable:    false,\n+    Image:       r.Config.BaseImage,\n+    FQName:      chart.Name,\n+    Tags:        chart.Keywords,\n+    Description: chart.Description,\n+    Metadata: map[string]interface{}{\n+        //\"longDescription\":  chart.Description,\n+        \"displayName\":      fmt.Sprintf(\"%s (Helm)\", chart.Name),\n+        \"documentationUrl\": chart.Home,\n+        \"dependencies\":     chart.Sources,\n+        \"imageUrl\":         chart.Icon,\n+    },\n+    Plans: []apb.Plan{\n+        apb.Plan{\n+            Name:        \"default\",\n+            Description: \"Default plan for running helm charts\",\n+            Parameters: []apb.ParameterDescriptor{\n+                apb.ParameterDescriptor{\n+                    Name:      \"repo\",\n+                    Title:     \"Helm Chart Repository URL\",\n+                    Type:      \"string\",\n+                    Default:   r.Config.URL.String(),\n+                    Pattern:   fmt.Sprintf(\"^%s$\", r.Config.URL.String()),\n+                    Updatable: false,\n+                    Required:  false,\n+                },\n+                apb.ParameterDescriptor{\n+                    Name:      \"chart\",","path":"docs/proposals/helm-charts.md","position":161,"original_position":161,"commit_id":"848e41958e9d20459b9c3627c91c263a34739c7e","original_commit_id":"848e41958e9d20459b9c3627c91c263a34739c7e","user":{"login":"eriknelson","id":410933,"avatar_url":"https://avatars3.githubusercontent.com/u/410933?v=4","gravatar_id":"","url":"https://api.github.com/users/eriknelson","html_url":"https://github.com/eriknelson","followers_url":"https://api.github.com/users/eriknelson/followers","following_url":"https://api.github.com/users/eriknelson/following{/other_user}","gists_url":"https://api.github.com/users/eriknelson/gists{/gist_id}","starred_url":"https://api.github.com/users/eriknelson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eriknelson/subscriptions","organizations_url":"https://api.github.com/users/eriknelson/orgs","repos_url":"https://api.github.com/users/eriknelson/repos","events_url":"https://api.github.com/users/eriknelson/events{/privacy}","received_events_url":"https://api.github.com/users/eriknelson/received_events","type":"User","site_admin":false},"body":"See above.","created_at":"2018-03-15T02:11:17Z","updated_at":"2018-03-15T02:11:56Z","html_url":"https://github.com/openshift/ansible-service-broker/pull/830#discussion_r174660510","pull_request_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/830","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments/174660510"},"html":{"href":"https://github.com/openshift/ansible-service-broker/pull/830#discussion_r174660510"},"pull_request":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/830"}},"in_reply_to_id":174550727},"pull_request":{"url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/830","id":174108494,"html_url":"https://github.com/openshift/ansible-service-broker/pull/830","diff_url":"https://github.com/openshift/ansible-service-broker/pull/830.diff","patch_url":"https://github.com/openshift/ansible-service-broker/pull/830.patch","issue_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/830","number":830,"state":"open","locked":false,"title":"Proposal for Helm Chart Registry Adapter","user":{"login":"djzager","id":569754,"avatar_url":"https://avatars3.githubusercontent.com/u/569754?v=4","gravatar_id":"","url":"https://api.github.com/users/djzager","html_url":"https://github.com/djzager","followers_url":"https://api.github.com/users/djzager/followers","following_url":"https://api.github.com/users/djzager/following{/other_user}","gists_url":"https://api.github.com/users/djzager/gists{/gist_id}","starred_url":"https://api.github.com/users/djzager/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djzager/subscriptions","organizations_url":"https://api.github.com/users/djzager/orgs","repos_url":"https://api.github.com/users/djzager/repos","events_url":"https://api.github.com/users/djzager/events{/privacy}","received_events_url":"https://api.github.com/users/djzager/received_events","type":"User","site_admin":false},"body":"This describes a plan for supporting Helm Chart Repositories.","created_at":"2018-03-09T21:06:31Z","updated_at":"2018-03-15T02:11:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"569e423114eaa60f34faee783b554c711da0fcd6","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":623309155,"url":"https://api.github.com/repos/openshift/ansible-service-broker/labels/feature","name":"feature","color":"1d76db","default":false},{"id":693604972,"url":"https://api.github.com/repos/openshift/ansible-service-broker/labels/needs-review","name":"needs-review","color":"d93f0b","default":false},{"id":711534248,"url":"https://api.github.com/repos/openshift/ansible-service-broker/labels/size/L","name":"size/L","color":"ee9900","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/830/commits","review_comments_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/830/comments","review_comment_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/830/comments","statuses_url":"https://api.github.com/repos/openshift/ansible-service-broker/statuses/848e41958e9d20459b9c3627c91c263a34739c7e","head":{"label":"djzager:helm-ra-prop","ref":"helm-ra-prop","sha":"848e41958e9d20459b9c3627c91c263a34739c7e","user":{"login":"djzager","id":569754,"avatar_url":"https://avatars3.githubusercontent.com/u/569754?v=4","gravatar_id":"","url":"https://api.github.com/users/djzager","html_url":"https://github.com/djzager","followers_url":"https://api.github.com/users/djzager/followers","following_url":"https://api.github.com/users/djzager/following{/other_user}","gists_url":"https://api.github.com/users/djzager/gists{/gist_id}","starred_url":"https://api.github.com/users/djzager/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djzager/subscriptions","organizations_url":"https://api.github.com/users/djzager/orgs","repos_url":"https://api.github.com/users/djzager/repos","events_url":"https://api.github.com/users/djzager/events{/privacy}","received_events_url":"https://api.github.com/users/djzager/received_events","type":"User","site_admin":false},"repo":{"id":99154244,"name":"ansible-service-broker","full_name":"djzager/ansible-service-broker","owner":{"login":"djzager","id":569754,"avatar_url":"https://avatars3.githubusercontent.com/u/569754?v=4","gravatar_id":"","url":"https://api.github.com/users/djzager","html_url":"https://github.com/djzager","followers_url":"https://api.github.com/users/djzager/followers","following_url":"https://api.github.com/users/djzager/following{/other_user}","gists_url":"https://api.github.com/users/djzager/gists{/gist_id}","starred_url":"https://api.github.com/users/djzager/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djzager/subscriptions","organizations_url":"https://api.github.com/users/djzager/orgs","repos_url":"https://api.github.com/users/djzager/repos","events_url":"https://api.github.com/users/djzager/events{/privacy}","received_events_url":"https://api.github.com/users/djzager/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/djzager/ansible-service-broker","description":"Ansible Service Broker","fork":true,"url":"https://api.github.com/repos/djzager/ansible-service-broker","forks_url":"https://api.github.com/repos/djzager/ansible-service-broker/forks","keys_url":"https://api.github.com/repos/djzager/ansible-service-broker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/djzager/ansible-service-broker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/djzager/ansible-service-broker/teams","hooks_url":"https://api.github.com/repos/djzager/ansible-service-broker/hooks","issue_events_url":"https://api.github.com/repos/djzager/ansible-service-broker/issues/events{/number}","events_url":"https://api.github.com/repos/djzager/ansible-service-broker/events","assignees_url":"https://api.github.com/repos/djzager/ansible-service-broker/assignees{/user}","branches_url":"https://api.github.com/repos/djzager/ansible-service-broker/branches{/branch}","tags_url":"https://api.github.com/repos/djzager/ansible-service-broker/tags","blobs_url":"https://api.github.com/repos/djzager/ansible-service-broker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/djzager/ansible-service-broker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/djzager/ansible-service-broker/git/refs{/sha}","trees_url":"https://api.github.com/repos/djzager/ansible-service-broker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/djzager/ansible-service-broker/statuses/{sha}","languages_url":"https://api.github.com/repos/djzager/ansible-service-broker/languages","stargazers_url":"https://api.github.com/repos/djzager/ansible-service-broker/stargazers","contributors_url":"https://api.github.com/repos/djzager/ansible-service-broker/contributors","subscribers_url":"https://api.github.com/repos/djzager/ansible-service-broker/subscribers","subscription_url":"https://api.github.com/repos/djzager/ansible-service-broker/subscription","commits_url":"https://api.github.com/repos/djzager/ansible-service-broker/commits{/sha}","git_commits_url":"https://api.github.com/repos/djzager/ansible-service-broker/git/commits{/sha}","comments_url":"https://api.github.com/repos/djzager/ansible-service-broker/comments{/number}","issue_comment_url":"https://api.github.com/repos/djzager/ansible-service-broker/issues/comments{/number}","contents_url":"https://api.github.com/repos/djzager/ansible-service-broker/contents/{+path}","compare_url":"https://api.github.com/repos/djzager/ansible-service-broker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/djzager/ansible-service-broker/merges","archive_url":"https://api.github.com/repos/djzager/ansible-service-broker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/djzager/ansible-service-broker/downloads","issues_url":"https://api.github.com/repos/djzager/ansible-service-broker/issues{/number}","pulls_url":"https://api.github.com/repos/djzager/ansible-service-broker/pulls{/number}","milestones_url":"https://api.github.com/repos/djzager/ansible-service-broker/milestones{/number}","notifications_url":"https://api.github.com/repos/djzager/ansible-service-broker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/djzager/ansible-service-broker/labels{/name}","releases_url":"https://api.github.com/repos/djzager/ansible-service-broker/releases{/id}","deployments_url":"https://api.github.com/repos/djzager/ansible-service-broker/deployments","created_at":"2017-08-02T19:38:33Z","updated_at":"2017-08-02T19:38:35Z","pushed_at":"2018-03-12T19:16:31Z","git_url":"git://github.com/djzager/ansible-service-broker.git","ssh_url":"git@github.com:djzager/ansible-service-broker.git","clone_url":"https://github.com/djzager/ansible-service-broker.git","svn_url":"https://github.com/djzager/ansible-service-broker","homepage":null,"size":88964,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"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":"openshift:master","ref":"master","sha":"0559fe3642cc6690fd231f929520491ad1fbad47","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","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":79371528,"name":"ansible-service-broker","full_name":"openshift/ansible-service-broker","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars3.githubusercontent.com/u/792337?v=4","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/ansible-service-broker","description":"Ansible Service Broker","fork":false,"url":"https://api.github.com/repos/openshift/ansible-service-broker","forks_url":"https://api.github.com/repos/openshift/ansible-service-broker/forks","keys_url":"https://api.github.com/repos/openshift/ansible-service-broker/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/ansible-service-broker/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/ansible-service-broker/teams","hooks_url":"https://api.github.com/repos/openshift/ansible-service-broker/hooks","issue_events_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/ansible-service-broker/events","assignees_url":"https://api.github.com/repos/openshift/ansible-service-broker/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/ansible-service-broker/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/ansible-service-broker/tags","blobs_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/ansible-service-broker/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/ansible-service-broker/languages","stargazers_url":"https://api.github.com/repos/openshift/ansible-service-broker/stargazers","contributors_url":"https://api.github.com/repos/openshift/ansible-service-broker/contributors","subscribers_url":"https://api.github.com/repos/openshift/ansible-service-broker/subscribers","subscription_url":"https://api.github.com/repos/openshift/ansible-service-broker/subscription","commits_url":"https://api.github.com/repos/openshift/ansible-service-broker/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/ansible-service-broker/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/ansible-service-broker/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/ansible-service-broker/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/ansible-service-broker/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/ansible-service-broker/merges","archive_url":"https://api.github.com/repos/openshift/ansible-service-broker/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/ansible-service-broker/downloads","issues_url":"https://api.github.com/repos/openshift/ansible-service-broker/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/ansible-service-broker/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/ansible-service-broker/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/ansible-service-broker/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/ansible-service-broker/labels{/name}","releases_url":"https://api.github.com/repos/openshift/ansible-service-broker/releases{/id}","deployments_url":"https://api.github.com/repos/openshift/ansible-service-broker/deployments","created_at":"2017-01-18T18:40:49Z","updated_at":"2018-03-14T19:00:44Z","pushed_at":"2018-03-13T20:59:26Z","git_url":"git://github.com/openshift/ansible-service-broker.git","ssh_url":"git@github.com:openshift/ansible-service-broker.git","clone_url":"https://github.com/openshift/ansible-service-broker.git","svn_url":"https://github.com/openshift/ansible-service-broker","homepage":null,"size":92574,"stargazers_count":96,"watchers_count":96,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":49,"mirror_url":null,"archived":false,"open_issues_count":41,"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":49,"open_issues":41,"watchers":96,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/830"},"html":{"href":"https://github.com/openshift/ansible-service-broker/pull/830"},"issue":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/issues/830"},"comments":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/issues/830/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/830/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/pulls/830/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/ansible-service-broker/statuses/848e41958e9d20459b9c3627c91c263a34739c7e"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"eriknelson"}}