fleet.yaml
The fleet.yaml
file adds options to a bundle. Any directory with a
fleet.yaml
is automatically turned into bundle.
For more information on how to use the fleet.yaml
to customize bundles see
Git Repository Contents.
The content of the fleet.yaml corresponds to the FleetYAML
struct at
pkg/apis/fleet.cattle.io/v1alpha1/fleetyaml.go,
which contains the BundleSpec.
Reference​
Full YAML reference
Helm Options​
Main options​
chart​
This specifies 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 many different locations. go-getter URLs support adding a digest to validate the
download. If the repo
field is set, this field is the name of the chart to lookup.
It is possible to download the chart from a Git repository, e.g. by using
git@github.com:rancher/fleet-examples//single-cluster/helm
. If a secret for the SSH key was defined in the GitRepo via
helmSecretName
, it will be injected into the chart URL.
Git repositories can be downloaded via unauthenticated http, by using for example:
git::http://github.com/rancher/fleet-examples/single-cluster/helm
.
However, this does not work with custom CA bundles at this point: if a CA bundle is configured in a secret referenced in
helmSecretName
, will not be used, which will result in the git job displaying errors such as SSL certificate problem:
unable to get local issuer certificate
when running fleet apply
to generate a bundle.
See fleet#3646 for more details.
version​
The version also determines which chart to download from OCI registries.
+
character supportOCI registries don't support the +
character, which is supported by semver. When pushing a Helm chart with a tag
containing the +
character, Helm automatically replaces +
with '_' before uploading it.
You should use the version with the +
in fleet.yaml
, as the _
character is not supported by semver and Fleet also
replaces +
with _
when accessing the OCI registry.
How fleet-agent deploys the bundle​
These options also apply to kustomize- and manifest-style bundles. They control how the fleet-agent deploys the bundle. All bundles are converted into Helm charts and deployed with the Helm SDK. These options are often similar to the Helm CLI options for install and update.
- releaseName
- takeOwnership
- force
- atomic
- disablePreProcess
- disableDNS
- skipSchemaValidation
- waitForJobs
Helm Chart Download Options​
These options are for Helm-style bundles, they specify how to download the chart.
- chart
- repo
- version
The reference to the chart can be either:
- a local path in the cloned Git repository, specified by
chart
. - a go-getter URL,
specified by
chart
. This can be used to download a tarball of the chart. go-getter also allows to download a chart from a Git repo. - a Helm repository, specified by
repo
and optionallyversion
. - an OCI Helm repository, specified by
repo
and optionallyversion
.
Helm Chart Value Options​
Options for the downloaded Helm chart.
- values
- valuesFiles
- valueFrom
Values​
Values are processed in different stages of the lifecycle: https://fleet.rancher.io/ref-bundle-stages
- fleet.yaml
values:
andvaluesFile:
are added to the bundle's values when it is created. - helm values templating, e.g. with
${ }
happens when the bundle is targeted at a cluster, cluster labels filled in, etc. - When the agent installs the chart, values from
valuesFrom
are read. Then Helm templating{{ }}
is processed.
Templating​
It is possible to specify the keys and values as go template strings for advanced templating needs. Most of the functions from the sprig templating library are available.
Note that if the functions output changes with every call, e.g. uuidv4
, the
bundle will get redeployed.
The template context has the following keys:
.ClusterValues
are retrieved from target cluster'sspec.templateValues
.ClusterLabels
and.ClusterAnnotations
are the labels and annotations in the cluster resource..ClusterName
as the fleet's cluster resource name..ClusterNamespace
as the namespace in which the cluster resource exists.
To access Labels or Annotations by their key name:
${ get .ClusterLabels "management.cattle.io/cluster-display-name" }
Note: The fleet.yaml must be valid yaml. Templating uses ${ }
as delims,
unlike Helm which uses {{ }}
. These fleet.yaml template delimiters can be
escaped using backticks, eg.:
foo-bar-${`${PWD}`}
will result in the following text:
foo-bar-${PWD}