# Helm charts

Copy the Helm charts to a registry of the company and install Platforma from it.

With a chart mirror, the machine that runs the installation does not need access to the public chart registries. A chart in an OCI registry is an OCI artifact: the same registry of the company that holds the images can hold the charts, and the same tools copy them. Terraform reads the charts at each apply, also when you only change a setting, so keep the mirror available for as long as Platforma runs.

| Chart                               | Source                                                                                                                                                                                    | Terraform input that sets the mirror                                                                                                                                                    |
| ----------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `platforma-backend`                 | `oci://ghcr.io/milaboratory/platforma-install/platforma-backend`, or the folder `helm/charts/platforma-backend` of [platforma-install](https://github.com/milaboratory/platforma-install) | `backend_service.chart_repository` of `platforma-tf-services`                                                                                                                           |
| `appwrapper`                        | `oci://ghcr.io/milaboratory/platforma-install/appwrapper`, or the folder `helm/charts/appwrapper` of [platforma-install](https://github.com/milaboratory/platforma-install)               | `components.appwrapper.chart_repository` of `platforma-tf-services-cluster`                                                                                                             |
| `kueue`                             | `oci://registry.k8s.io/kueue/charts`                                                                                                                                                      | `components.kueue.chart_repository` of `platforma-tf-services-cluster`                                                                                                                  |
| Charts of the cluster add-ons (AWS) | The public chart repositories of the add-ons (HTTPS)                                                                                                                                      | `components.<add-on>.repository` of `platforma-tf-cloud-cluster`, for `load_balancer_controller`, `cluster_autoscaler`, `ebs_csi`, `efs_csi`, `external_dns` and `nvidia_device_plugin` |

Each release of the modules pins the version of each chart, and a mirror must hold the same versions. The README of each module lists the versions that it pins (the `versions` map of its `locals.tf`). For example, the current release of `platforma-tf-services-cluster` installs the `kueue` chart `0.16.9`. With the Helm chart, the team that runs the cluster installs Kueue (A Kubernetes add-on that holds jobs in a queue until the cluster has free CPU, memory and GPU for them.) and AppWrapper (A Kubernetes add-on that wraps the pods of one job into a single unit, so that Kueue admits and starts them together.) itself: it copies the versions that it installs.

1. Copy each OCI chart to the registry of the company. Use a tool that copies OCI artifacts, for example `regctl`, `crane` or `skopeo`:

   ```sh
   regctl image copy registry.k8s.io/kueue/charts/kueue:0.16.9 \
     registry.example.com/kueue/charts/kueue:0.16.9
   ```

   Or pull the chart package with Helm and push it:

   ```sh
   helm pull oci://<source>/<chart> --version <version>
   helm push <chart>-<version>.tgz oci://registry.example.com/platforma-install
   ```

   Result: the chart is at `oci://registry.example.com/<path>/<chart>`, with the same version. The path of the mirror is the address that you give to Platforma in step 4.

2. On AWS, when the cluster add-ons cannot come from their public repositories, copy their charts to a chart repository of the company with the same chart names and versions, for example:

   ```sh
   helm pull external-dns --repo https://kubernetes-sigs.github.io/external-dns --version <version>
   ```

   Then publish the package in a Helm chart repository of the company (an HTTPS repository with an `index.yaml`, for example made with `helm repo index`).

3. When the registry of the company needs credentials, sign in (To show the Backend who you are, with a sign-in provider or a single-user token. The verb is "sign in"; the noun and the adjective are "sign-in".) with Helm on the machine that runs the installation:

   ```sh
   helm registry login registry.example.com
   ```

   Or give the credentials in the `registries` argument of the `helm` provider in the Terraform root.

4. Point the installation to the mirror:

   #### Variant: Terraform modules

   *platforma-tf-services*

   ```hcl
   backend_service = {
     chart_repository = "oci://registry.example.com/platforma-install"
   }
   ```

   *Inputs of platforma-tf-services-cluster*

   ```hcl
   components = {
     kueue      = { chart_repository = "oci://registry.example.com/kueue/charts" }
     appwrapper = { chart_repository = "oci://registry.example.com/platforma-install" }
   }
   ```

   *Inputs of platforma-tf-cloud-cluster (AWS)*

   ```hcl
   components = {
     external_dns = { repository = "https://charts.example.com/external-dns" }
   }
   ```

   Instead of a mirror, `chart_repository` of `platforma-tf-services` and of `components.appwrapper` can also be a local folder that holds the chart folder (`platforma-backend` or `appwrapper`), for example the `helm/charts` folder of a clone of [platforma-install](https://github.com/milaboratory/platforma-install) at the release tag. Use the local folder on a machine without internet access. The chart in the folder must have the version that the module pins.

   #### Variant: Helm chart

   Install the chart from the mirror:

   ```sh
   helm install platforma oci://registry.example.com/platforma-install/platforma-backend \
     --version <chart version> --namespace platforma -f values.yaml
   ```

5. Check that Helm reads the chart from the mirror:

   ```sh
   helm show chart oci://registry.example.com/platforma-install/platforma-backend --version <chart version>
   ```

   Result: the output shows the `name` and the `version` of the chart, and its `appVersion`: the version of the Backend (The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs.) image that the chart runs.

The images that the charts install need their own mirrors: see [Backend and controller images](/registries-mirroring-images/).

## Next

- [Backend and controller images](/registries-mirroring-images/)

Source: https://docs.platforma.bio/registries-mirroring-helm-charts/
