|
| 1 | +// Module included in the following assemblies: |
| 2 | +// |
| 3 | +// * applications/working_with_helm_charts/configuring-custom-helm-chart-repositories.adoc |
| 4 | + |
| 5 | +:_content-type: PROCEDURE |
| 6 | +[id="adding-namespace-scoped-helm-chart-repositories.adoc_{context}"] |
| 7 | += Adding namespace-scoped custom Helm chart repositories |
| 8 | + |
| 9 | +[role="_abstract"] |
| 10 | +The cluster-scoped `HelmChartRepository` custom resource definition (CRD) for Helm repository provides the ability for administrators to add Helm repositories as custom resources. The namespace-scoped `ProjectHelmChartRepository` CRD allows project members with the appropriate role-based access control (RBAC) permissions to create Helm repository resources of their choice but scoped to their namespace. Such project members can see charts from both cluster-scoped and namespace-scoped Helm repository resources. |
| 11 | + |
| 12 | +[NOTE] |
| 13 | +==== |
| 14 | +* Administrators can limit users from creating namespace-scoped Helm repository resources. By limiting users, administrators have the flexibility to control the RBAC through a namespace role instead of a cluster role. This avoids unnecessary permission elevation for the user and prevents access to unauthorized services or applications. |
| 15 | +* The addition of the namespace-scoped Helm repository does not impact the behavior of the existing cluster-scoped Helm repository. |
| 16 | +==== |
| 17 | + |
| 18 | +As a regular user or project member with the appropriate RBAC permissions, you can add custom namespace-scoped Helm chart repositories to your cluster and enable access to the Helm charts from these repositories in the *Developer Catalog*. |
| 19 | + |
| 20 | +.Procedure |
| 21 | + |
| 22 | +. To add a new namespace-scoped Helm Chart Repository, you must add the Helm Chart Repository custom resource (CR) to your namespace. |
| 23 | ++ |
| 24 | +.Sample Namespace-scoped Helm Chart Repository CR |
| 25 | + |
| 26 | +[source,yaml] |
| 27 | +---- |
| 28 | +apiVersion: helm.openshift.io/v1beta1 |
| 29 | +kind: ProjectHelmChartRepository |
| 30 | +metadata: |
| 31 | + name: <name> |
| 32 | +spec: |
| 33 | + url: https://my.chart-repo.org/stable |
| 34 | +
|
| 35 | + # optional name that might be used by console |
| 36 | + name: <chart-repo-display-name> |
| 37 | +
|
| 38 | + # optional and only needed for UI purposes |
| 39 | + description: <My private chart repo> |
| 40 | +
|
| 41 | + # required: chart repository URL |
| 42 | + connectionConfig: |
| 43 | + url: <helm-chart-repository-url> |
| 44 | +---- |
| 45 | ++ |
| 46 | +For example, to add an Azure sample chart repository scoped to your `my-namespace` namespace, run: |
| 47 | ++ |
| 48 | +[source,terminal] |
| 49 | +---- |
| 50 | +$ cat <<EOF | oc apply --namespace my-namespace -f - |
| 51 | +apiVersion: helm.openshift.io/v1beta1 |
| 52 | +kind: ProjectHelmChartRepository |
| 53 | +metadata: |
| 54 | + name: azure-sample-repo |
| 55 | +spec: |
| 56 | + name: azure-sample-repo |
| 57 | + connectionConfig: |
| 58 | + url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs |
| 59 | +EOF |
| 60 | +---- |
| 61 | ++ |
| 62 | +The output verifies that the namespace-scoped Helm Chart Repository CR is created: |
| 63 | ++ |
| 64 | +.Example output |
| 65 | +---- |
| 66 | +projecthelmchartrepository.helm.openshift.io/azure-sample-repo created |
| 67 | +---- |
| 68 | + |
| 69 | +. Navigate to the *Developer Catalog* in the web console to verify that the Helm charts from the chart repository are displayed in your `my-namespace` namespace. |
| 70 | ++ |
| 71 | +For example, use the *Chart repositories* filter to search for a Helm chart from the repository. |
| 72 | ++ |
| 73 | +.Chart repositories filter in your namespace |
| 74 | +image::odc_namespace_helm_chart_repo_filter.png[] |
| 75 | ++ |
| 76 | +Alternatively, run: |
| 77 | ++ |
| 78 | +[source,terminal] |
| 79 | +---- |
| 80 | +$ oc get projecthelmchartrepositories --namespace my-namespace |
| 81 | +---- |
| 82 | ++ |
| 83 | +.Example output |
| 84 | +---- |
| 85 | +NAME AGE |
| 86 | +azure-sample-repo 1m |
| 87 | +---- |
| 88 | ++ |
| 89 | +[NOTE] |
| 90 | +==== |
| 91 | +If a cluster administrator or a regular user with appropriate RBAC permissions removes all of the chart repositories in a specific namespace, then you cannot view the Helm option in the *+Add* view, *Developer Catalog*, and left navigation panel for that specific namespace. |
| 92 | +==== |
0 commit comments