rancher-sandbox / cluster-api-addon-provider-fleet

Cluster API Add-on Provider for Fleet will auto register child clusters with https://fleet.rancher.io/.
Apache License 2.0
2 stars 3 forks source link

Implement value substitution based on content of the Cluster API resources #32

Open Danil-Grigorev opened 4 months ago

Danil-Grigorev commented 4 months ago

We need to explore ways to allow templating of the Helm chart values within the cluster API add-on provider fleet. It will be beneficial when used with Bundle resource and defining the helm valuesFrom spec field:

https://github.com/rancher/fleet/blob/c802a27262668d42e5a3c69c23c6dc343a65a12d/pkg/apis/fleet.cattle.io/v1alpha1/bundledeployment_types.go#L211-L213

which is used to reference Secrets or ConfigMaps, used to populate values.yaml content for the generated helm chart from a bundle. The rest of the templating will be performed by fleet Bundle processing, where regular helm templating rules apply.

Danil-Grigorev commented 2 weeks ago

After some investigation, current list of valuesFrom options is not sufficient to implement this change, since the source for these resources is always downstream (imported CAPI) cluster. Definition of the CAPI infrastructure is stored on the management cluster, so the fleet needs to collect values from the local cluster API.

This might involve providing additional RBAC for fleet to access such resources, and a generic reference option for valuesFrom source, as well as a conditional component on the fleet Cluster resource unambiguously resolving source, relevant to this Cluster only.