ChartMuseum Documentation

repository·main·Indexed 26 days ago

https://github.com/helm/chartmuseum

ChartMuseum is an open-source Helm Chart Repository server written in Go. It allows users to store, manage, and serve Helm charts via an HTTP API and standard Helm CLI commands. It supports multiple cloud storage backends including Amazon S3, Google Cloud Storage, Microsoft Azure Blob Storage, Alibaba Cloud OSS, Openstack, Oracle Cloud, Baidu Cloud, Tencent Cloud, DigitalOcean Spaces, Minio, etcd, and the local filesystem.

Tokens
6.9K
Snippets
24
Records
48
Agent score
87%

What's inside ChartMuseum

  1. Overview of ChartMuseum

    main

    ChartMuseum is an open-source Helm Chart Repository server written in Go. It functions as a valid Helm Chart Repository and provides an API for uploading and managing charts. It supports various cloud storage backends including:

    • Google Cloud Storage
    • Amazon S3
    • Microsoft Azure Blob Storage
    • Alibaba Cloud OSS Storage
    • Openstack Object Storage
    • Oracle Cloud Infrastructure Object Storage
    • Baidu Cloud BOS Storage
    • Tencent Cloud Object Storage
    • DigitalOcean Spaces
    • Minio
    • etcd
  2. Install Charts from ChartMuseum into Kubernetes

    main

    To use charts stored in ChartMuseum with the Helm CLI, follow these steps:

    1. Add the repository to your local Helm configuration:

      helm repo add chartmuseum http://localhost:8080
    2. Search for available charts:

      helm search repo chartmuseum/
    3. Install a chart:

      helm install chartmuseum/mychart --generate-name
    helm repo add chartmuseum http://localhost:8080
    helm search repo chartmuseum/
    helm install chartmuseum/mychart --generate-name
  3. Configure Local Filesystem Storage

    main

    Use the local storage backend and specify a root directory. Ensure ChartMuseum has read-write access to this path.

    chartmuseum --debug --port=8080 \
      --storage="local" \
      --storage-local-rootdir="./chartstorage"
  4. Install ChartMuseum

    main

    You can install ChartMuseum using an official installer script or by downloading binaries manually from the GitHub releases page. Use chartmuseum --version to verify your installation.

    curl https://raw.githubusercontent.com/helm/chartmuseum/main/scripts/get-chartmuseum | bash
  5. Configure Microsoft Azure Blob Storage

    main

    Set the AZURE_STORAGE_ACCOUNT and AZURE_STORAGE_ACCESS_KEY environment variables, then use the microsoft storage backend.

    chartmuseum --debug --port=8080 \
      --storage="microsoft" \
      --storage-microsoft-container="mycontainer" \
      --storage-microsoft-prefix=""
  6. Set up the ChartMuseum loadtesting environment

    main

    The ChartMuseum loadtesting subproject uses pipenv for dependency management. To set up the environment, install pipenv via pip, navigate to the loadtesting directory, and run pipenv install to install the required dependencies, including the locust library.

    pip install pipenv
    cd loadtesting
    pipenv install
  7. Configure ChartMuseum via CLI, Environment Variables, or Config File

    main

    ChartMuseum can be configured using three methods:

    1. CLI Flags: Use flags like --port or --storage.
    2. Environment Variables: All CLI options can be set as environment variables. Convert the flag to uppercase and replace hyphens (-) with underscores (_). For example, --storage-amazon-bucket becomes STORAGE_AMAZON_BUCKET.
    3. Configuration File: Use the --config <path> flag to load a YAML file.

    Example config.yaml structure:

    debug: true
    port: 8080
    storage.backend: local
    storage.local.rootdir: <storage_path>
    bearerauth: 1
    authrealm: <authorization server url>
    authservice: <authorization server service name>
    authcertpath: <path to authorization server public pem file>
    authactionssearchpath: <optional: JMESPath to find allowed actions in a jwt token>
    depth: 2
  8. Configure Oracle Cloud Infrastructure (OCI) Object Storage

    main

    Use the oracle storage backend and provide the bucket and compartment ID.

    chartmuseum --debug --port=8080 \
      --storage="oracle" \
      --storage-oracle-bucket="my-ocs-bucket" \
      --storage-oracle-prefix="" \
      --storage-oracle-compartmentid="ocid1.compartment.oc1..1234"
  9. Configure HTTPS and Client Certificate Authentication

    main

    To enable HTTPS, provide the certificate and key:

    • --tls-cert=<crt>
    • --tls-key=<key>

    To enable Client Certificate Authentication, also provide the CA certificate:

    • --tls-ca-cert=<cacert>
  10. Run loadtests with Locust on ChartMuseum

    main

    Once the environment is set up and a ChartMuseum instance is running (e.g., at http://localhost:8080), you can start the Locust loadtesting tool using pipenv run locust.

    After starting the process, open your browser and navigate to http://localhost:8089 to access the Locust web console and initiate a new loadtest.

    # run locust on a running chartmuseum instance
    pipenv run locust --host http://localhost:8080
  11. Upload a Chart Package to ChartMuseum

    main

    You can upload charts to ChartMuseum using curl or the helm-push plugin.

    Using curl (Binary Data)

    To upload a packaged chart:

    curl --data-binary "@mychart-0.1.0.tgz" http://localhost:8080/api/charts

    To upload a provenance file separately:

    curl --data-binary "@mychart-0.1.0.tgz.prov" http://localhost:8080/api/prov

    Using curl (Multipart Form Data)

    You can upload both the chart and the provenance file in a single request:

    curl -F "chart=@mychart-0.1.0.tgz" -F "prov=@mychart-0.1.0.tgz.prov" http://localhost:8080/api/charts

    Using helm-push plugin

    If you have the helm-push plugin installed, use:

    helm cm-push mychart/ chartmuseum
    # Package the chart first
    cd mychart/
    helm package .
    
    # Upload the chart
    curl --data-binary "@mychart-0.1.0.tgz" http://localhost:8080/api/charts
  12. Configure Amazon S3 or S3-Compatible Storage

    main

    To use Amazon S3, provide the bucket, prefix, and region. For S3-compatible services (like Minio or DigitalOcean), you must also provide an --storage-amazon-endpoint and set your credentials via AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.

    S3-Compatible Example (Minio):

    export AWS_ACCESS_KEY_ID=""
    export AWS_SECRET_ACCESS_KEY=""
    chartmuseum --debug --port=8080 \
      --storage="amazon" \
      --storage-amazon-bucket="my-s3-bucket" \
      --storage-amazon-prefix="" \
      --storage-amazon-region="us-east-1" \
      --storage-amazon-endpoint="my-s3-compatible-service-endpoint"

    DigitalOcean Spaces Example: Note: The region must be set to us-east-1 for the DigitalOcean CLI implementation to function correctly.

    export AWS_ACCESS_KEY_ID="spaces_access_key"
    export AWS_SECRET_ACCESS_KEY="spaces_secret_key"
    chartmuseum --debug --port=8080 \
      --storage="amazon" \
      --storage-amazon-bucket="my_spaces_name" \
      --storage-amazon-prefix="my_spaces_name_subfolder" \
      --storage-amazon-region="us-east-1" \
      --storage-amazon-endpoint="https://fra1.digitaloceanspaces.com"

    Important Options:

    • --storage-amazon-force-path-style: Set to false if your provider has disabled path-style access.
    • --storage-timestamp-tolerance: Use this to mitigate S3 object LastModified truncation (e.g., --storage-timestamp-tolerance=1s).