Sample Case

ARTIFACTORY: How to fix Helm remote repository not caching Helm charts

AuthorFullName__c
Shisiya Sebastian
articleNumber
000005697
ft:sourceType
Salesforce
FirstPublishedDate
2023-04-27T15:31:22Z
lastModifiedDate
2023-04-27
VersionNumber
3

Chart: opensearch-operator 
Repo : https://opster.github.io/opensearch-k8s-operator-chart/
Index.yaml : https://opensearch-project.github.io/opensearch-k8s-operator/index.yaml

From the index.yaml, you will see that Charts are stored in two different locations. The versions of the opensearch-operator from 2.1.1 are located at https://github.com/opensearch-project/opensearch-k8s-operator/. And all the previous versions are at the location https://github.com/Opster/opensearch-k8s-operator-chart/releases/download/

User-added image


Hence, the Helm repository should be configured as follows in the Artifactory.

1. Create a new Helm Remote repository
URL : https://opster.github.io/opensearch-k8s-operator/
Chart Base URL : https://Opster.github.io/opensearch-k8s-operator/
Click on advanced tab and Enable the option “External Dependency Rewrite” and allow the pattern “https://github.com/**”.
2. Add the new remote repository to a virtual repository, here ‘helm-release’
3. Go to UI → Application → Artifacts → <helm virtual repo name> → download index.yaml and verify whether all the external URLs are rewritten by the Artifactory URLs
4. Add the Virtual repository to the Helm client
helm repo add helm-release https://localhost:443/artifactory/api/helm/helm-release --username <username> --password <encoded_password>
5. Perform the below commands to update the metadata and fetch the Charts.
helm repo update
helm search repo helm-release --versions
helm fetch helm-release/opensearch-operator
helm fetch helm-release/opensearch-operator --version 1.0.3 (if you want to download a specific version)
You will be able to find them cached in your virtual repository cache. The packages with different download URL than Chart base URL specified, here for Example version: 1.0.3, the URL rewriting is done via the external dependency option we enabled. You can find those under the “external” folder with the path similar to the download URL path.