1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/helm-adding-namespace-scoped-helm-chart-repositories.adoc

93 lines
3.6 KiB
Plaintext

// Module included in the following assemblies:
//
// * applications/working_with_helm_charts/configuring-custom-helm-chart-repositories.adoc
:_mod-docs-content-type: PROCEDURE
[id="adding-namespace-scoped-helm-chart-repositories_{context}"]
= Adding namespace-scoped custom Helm chart repositories
[role="_abstract"]
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.
[NOTE]
====
* 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.
* The addition of the namespace-scoped Helm repository does not impact the behavior of the existing cluster-scoped Helm repository.
====
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*.
.Procedure
. To add a new namespace-scoped Helm Chart Repository, you must add the Helm Chart Repository custom resource (CR) to your namespace.
+
.Sample Namespace-scoped Helm Chart Repository CR
[source,yaml]
----
apiVersion: helm.openshift.io/v1beta1
kind: ProjectHelmChartRepository
metadata:
name: <name>
spec:
url: https://my.chart-repo.org/stable
# optional name that might be used by console
name: <chart-repo-display-name>
# optional and only needed for UI purposes
description: <My private chart repo>
# required: chart repository URL
connectionConfig:
url: <helm-chart-repository-url>
----
+
For example, to add an Azure sample chart repository scoped to your `my-namespace` namespace, run:
+
[source,terminal]
----
$ cat <<EOF | oc apply --namespace my-namespace -f -
apiVersion: helm.openshift.io/v1beta1
kind: ProjectHelmChartRepository
metadata:
name: azure-sample-repo
spec:
name: azure-sample-repo
connectionConfig:
url: https://raw.githubusercontent.com/Azure-Samples/helm-charts/master/docs
EOF
----
+
The output verifies that the namespace-scoped Helm Chart Repository CR is created:
+
.Example output
----
projecthelmchartrepository.helm.openshift.io/azure-sample-repo created
----
. 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.
+
For example, use the *Chart repositories* filter to search for a Helm chart from the repository.
+
.Chart repositories filter in your namespace
image::odc_namespace_helm_chart_repo_filter.png[]
+
Alternatively, run:
+
[source,terminal]
----
$ oc get projecthelmchartrepositories --namespace my-namespace
----
+
.Example output
----
NAME AGE
azure-sample-repo 1m
----
+
[NOTE]
====
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.
====