-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Templating Helm Values in fleet.yaml #1164
Comments
This will not be backported to 0.5.2 due to time constraints. |
Assigning this issue to the milestone 2023-Q1-v2.7x as the team won't have the time before |
Is related to https://jira.suse.com/browse/SURE-5326 |
And SURE-4263 |
Since there is Automated tests around this, QA will pick this up for validations, in the end (lower priority) |
Verified on Fleet 102.0.0+up0.6.0-rc.5 Template functions can be used to produce values for helm template strings and modify/prefix string values. Steps to reproduce:
Steps to validate:
|
Additional QA
The feature was implemented in multiple PRs, so I'll add the QA info here.
Problem
There are two ways to modify deployments per target cluster: target customizations and cluster label replacement.
Creating target customizations to overwrite the helm values at the root can be tedious for a large number of clusters.
Adding the value of a cluster label to the
helm.values
section offleet.yaml
is not flexible, e.g. it's not possible to prefix the result. The amount of data stored in a label value is limited.Solution
The helm values section in
fleet.yaml
is now a template. Go and sprig template functions can be used to produce values for helm templates.Additionally, values from the cluster resource (
spec.templateValues
) are passed into the template to produce cluster dependent helm values.Note, this is limited to helm-type bundles, manifests and kustomize bundles don't use the helm values section.
And
helm.valuesFrom
is not templated, the configmap, secrets are on downstream clusters, the templating happens before creating the bundle deployment on the upstream cluster.However, any
helm.valuesFiles
are in the bundle and their values will be templated.The
fleet.yaml
has to be valid YAML, so not all templating constructs one knows from, for example, helm will work. In a helmtemplates/
folder, it's possible to generate YAML withwith
andrange
. Infleet.yaml
this will only work in multi-line strings.Writing valid templating code is the users responsibility, templates with errors won't produce new bundledeployments.
Testing
Engineering Testing
Manual Testing
templateValues
to a fleet cluster resource.Example: https://github.com/rancher/fleet-examples/blob/test-cluster-values/single-cluster/helm-cluster-values/fleet.yaml
Documentation: https://fleet.rancher.io/next/gitrepo-structure#reference
Automated Testing
QA Testing Considerations
It's not necessary to test all possible template functions and advanced templating use cases. It's expected that users mostly use templating to set default strings and modify/prefix string values.
Regressions Considerations
Cluster label replacement (using the replacement string
global.fleet.clusterLabels.LABELNAME
) should still work.The text was updated successfully, but these errors were encountered: