rancher / fleet

Deploy workloads from Git to large fleets of Kubernetes clusters
https://fleet.rancher.io/
Apache License 2.0
1.5k stars 225 forks source link

[SURE-7369] Add documentation for support for using git repo as a single source of truth for helm charts. #2050

Open pratikjagrut opened 8 months ago

pratikjagrut commented 8 months ago

Is your feature request related to a problem?

I noticed that currently installing helm charts using git URL is not supported by the fleet. However, I’ve been thinking, there’s an interest in using the git directory for Helm charts directly – pulling and utilizing them instead of bundling, especially in the development phase, would that be a beneficial feature or perhaps an enhancement worth considering?

Solution you'd like

I can think of two types of solutions:

  1. Introduce new fields in config e.g: fleet.yaml

    helm:
        gitRepo:
  2. Use existing charts or repo field for git repo URL and then based on the URL format if it's helm repo url or git url

Alternatives you've considered

No response

Anything else?

SURE-7369

manno commented 8 months ago

The bundlereader and the multitude of fleet.yaml helm: options are not easy to follow. However the docs say this about the helm options:

Use a custom location for the Helm chart. This can refer to any go-getter URL or OCI registry based helm chart URL e.g. "oci://ghcr.io/fleetrepoci/guestbook". This allows one to download charts from most any location. Also know that go-getter URL supports adding a digest to validate the download. If repo is set below this field is the name of the chart to lookup

That made me look up the go-getter URLs support and it turns out, it can already download git 🤷

For example, I created a folder "app" with a fleet.yaml inside:

helm:
  #chart: git::http://github.com/rancher/fleet-examples
  #chart: git::http://github.com/rancher/fleet-examples//single-cluster/helm
  chart: git@github.com:rancher/fleet-examples//single-cluster/helm

I can then run fleet apply -n fleet-local -o bundle.yaml test app and the result is a bundle.yaml with the bundle resource, as expected.

sbulage commented 8 months ago

Below scenario's are performed:

Scenarios Scenario Test Case Result
1 Test Helm chart available in public GitHub repository. :white_check_mark:
2 Helm Chart available in Private GitHub repository and can be accessible via SSH. :white_check_mark:

Steps First Scenario

  1. Create GitRepo with fleet.yaml contains chart URL: git::http://github.com/rancher/fleet-examples//single-cluster/helm including path to the application.
  2. Wait for GitRepo to become Active state.
  3. Check the gitjob status.
  4. Verify that applications are installed from the above GitHub URL successfully.

Second Scenario

  1. Create GitRepo with fleet.yaml like this: https://github.com/sbulage/test-fleet/blob/main/helm-chart-package/fleet.yaml.
  2. While creating GitRepo use the Helm Authentication: Create SSH key secret to store the private and public key.
  3. Wait for the GitRepo to become Active state.
  4. Check the gitjob for any errors.
  5. Verify that application from the private chart URL is installed successfully.
pratikjagrut commented 8 months ago

Thank you @manno and @sbulage. Then this is a documentation bug. Let's add the steps for this or information/examples in the documentation.

sbulage commented 8 months ago

@pratikjagrut @skanakal See this documentation update PR: https://github.com/rancher/fleet-docs/pull/112