fleet.yaml
El archivo fleet.yaml añade opciones a un paquete. Cualquier directorio con un archivo fleet.yaml se convierte automáticamente en un paquete.
Para más información sobre cómo personalizar paquetes utilizando fleet.yaml, consulta Contenidos del Repositorio Git.
El contenido de fleet.yaml corresponde a la estructura FleetYAML en fleetyaml.go, que contiene el BundleSpec.
Ejemplo completo
Details
# The default namespace to be applied to resources. This field is not used to
# enforce or lock down the deployment to a specific namespace, but instead
# provide the default value of the namespace field if one is not specified in
# the manifests.
#
# Default: default
defaultNamespace: default
# All resources will be assigned to this namespace and if any cluster scoped
# resource exists the deployment will fail.
#
# Default: ""
namespace: default
# namespaceLabels are labels that will be appended to the namespace created by
# Fleet.
namespaceLabels:
key: value
# namespaceAnnotations are annotations that will be appended to the namespace
# created by Fleet.
namespaceAnnotations:
key: value
# Name of the bundle. If not specified, the bundle name will be computed based
# on the GitRepo's name, and the path from which the bundle is created.
# Default: ""
name: my-great-bundle
# Optional map of labels, that are set at the bundle and can be used in a
# dependsOn.selector
labels:
key: value
kustomize:
# Use a custom folder for kustomize resources. This folder must contain a
# kustomization.yaml file.
dir: ./kustomize
helm:
# These options control how "fleet apply" downloads the chart
# (See `Helm Options` below for more details)
#
chart: ./chart
# A https URL to a Helm repo to download the chart from, or an OCI registry
# URL (oci://...). For OCI registries, repo is the canonical field and no
# chart name is needed. For standard Helm repos, the value of `chart` is used
# as the chart name to look up in the repository.
repo: https://charts.rancher.io
# The version of the chart or semver constraint of the chart to find. If a
# constraint is specified, it is evaluated each time git changes.
# (See `Helm Options` below for more details)
version: 0.1.0
# By default fleet downloads any dependency found in a helm chart. Use
# disableDependencyUpdate: true to disable this feature.
disableDependencyUpdate: false
### These options only work for helm-type bundles.
#
# Any values that should be placed in the `values.yaml` and passed to helm
# during install.
values:
any-custom: value
# All labels on Rancher clusters are available using
# global.fleet.clusterLabels.LABELNAME These can now be accessed directly as
# variables The variable's value will be an empty string if the referenced
# cluster label does not exist on the targeted cluster.
variableName: global.fleet.clusterLabels.LABELNAME
# See Templating notes below for more information on templating.
templatedLabel: "${ .ClusterLabels.LABELNAME }-foo"
valueFromEnv:
"${ .ClusterLabels.ENV }": ${ .ClusterValues.someValue | upper | quote }
# Path to any values files that need to be passed to helm during install.
valuesFiles:
- values1.yaml
- values2.yaml
# Allow to use values files from configmaps or secrets defined in the
# downstream clusters.
valuesFrom:
- configMapKeyRef:
name: configmap-values
# default to namespace of bundle
namespace: default
key: values.yaml
- secretKeyRef:
name: secret-values
namespace: default
key: values.yaml
### These options control how fleet-agent deploys the bundle, they also apply
### for kustomize- and manifest-style bundles.
#
# A custom release name to deploy the chart as. If not specified a release name
# will be generated by combining the invoking GitRepo.name + GitRepo.path.
releaseName: my-release
#
# Makes helm skip the check for its own annotations
takeOwnership: false
#
# Override immutable resources. This could be dangerous.
force: false
#
# Set the Helm --atomic flag when upgrading
atomic: false
#
# Disable go template pre-processing on the fleet values
disablePreProcess: false
#
# Disable DNS resolution in Helm's template functions
disableDNS: false
#
# Skip evaluation of the values.schema.json file
skipSchemaValidation: false
#
# If set and timeoutSeconds provided, will wait until all Jobs have been
# completed before marking the GitRepo as ready. It will wait for as long as
# timeoutSeconds.
waitForJobs: true
# A paused bundle will not update downstream clusters but instead mark the bundle
# as OutOfSync. One can then manually confirm that a bundle should be deployed to
# the downstream clusters.
#
# Default: false
paused: false
# If rolloutStrategy is not defined in the fleet.yaml file, Fleet uses default rollout values.
rolloutStrategy:
# A number or percentage of clusters that can be unavailable during an update
# of a bundle. This follows the same basic approach as a deployment rollout
# strategy. Once the number of clusters meets unavailable state update will be
# paused. Default value is 100% which doesn't take effect on update.
#
# default: 100%
maxUnavailable: 15%
# A number or percentage of cluster partitions that can be unavailable during
# an update of a bundle.
#
# default: 0
maxUnavailablePartitions: 20%
# A number or percentage of how to automatically partition clusters if not
# specific partitioning strategy is configured.
# The default value is defined in rolloutStrategy.maxUnavailable
autoPartitionSize: 10%
# The minimum number of clusters that need to be present before
# auto-partitioning is enabled. If the number of target clusters is less
# than this value, all clusters will be placed in a single partition.
#
# default: 200
autoPartitionThreshold: 100
# The maximum number of new BundleDeployments that can be created in a
# single reconciliation. This limits the rate at which new deployments are
# staged when a bundle is first applied to many clusters.
#
# default: 50
maxNew: 50
# A list of definitions of partitions. If any target clusters do not match
# the configuration they are added to partitions at the end following the
# autoPartitionSize.
partitions:
# A user friend name given to the partition used for Display (optional).
# default: ""
- name: canary
# A number or percentage of clusters that can be unavailable in this
# partition before this partition is treated as done.
# default: 10%
maxUnavailable: 10%
# Selector matching cluster labels to include in this partition
clusterSelector:
matchLabels:
env: prod
# OR, if selecting by ClusterGroup labels:
clusterGroupSelector:
matchLabels:
env: prod
# A cluster group name to include in this partition
clusterGroup: agroup
# Target customization are used to determine how resources should be modified
# per target Targets are evaluated in order and the first one to match a cluster
# is used for that cluster.
targetCustomizations:
# The name of target. If not specified a default name of the format
# "target000" will be used. This value is mostly for display
- name: prod
# Custom namespace value overriding the value at the root.
namespace: newvalue
# Custom defaultNamespace value overriding the value at the root.
defaultNamespace: newdefaultvalue
# Custom kustomize options overriding the options at the root.
kustomize: {}
# Custom Helm options override the options at the root.
helm: {}
# If using raw YAML these are names that map to overlays/{name} that will be
# used to replace or patch a resource. If you wish to customize the file
# ./subdir/resource.yaml then a file
# ./overlays/myoverlay/subdir/resource.yaml will replace the base file. A
# file named ./overlays/myoverlay/subdir/resource_patch.yaml will patch the
# base file. A patch can in JSON Patch or JSON Merge format or a strategic
# merge patch for builtin Kubernetes types. Refer to "Raw YAML Resource
# Customization" below for more information.
yaml:
overlays:
- custom2
- custom3
# A selector used to match clusters. The structure is the standard
# metav1.LabelSelector format. If clusterGroupSelector or clusterGroup is
# specified, clusterSelector will be used only to further refine the
# selection after clusterGroupSelector and clusterGroup is evaluated.
clusterSelector:
matchLabels:
env: prod
# A selector used to match a specific cluster by name. When using Fleet in
# Rancher, make sure to put the name of the clusters.fleet.cattle.io
# resource.
clusterName: dev-cluster
# A selector used to match cluster groups.
clusterGroupSelector:
matchLabels:
region: us-east
# A specific clusterGroup by name that will be selected.
clusterGroup: group1
# Resources will not be deployed in the matched clusters if doNotDeploy is
# true.
doNotDeploy: false
# Drift correction removes any external change made to resources managed by
# Fleet. It performs a helm rollback, which uses a three-way merge strategy
# by default. It will try to update all resources by doing a PUT request if
# force is enabled. Three-way strategic merge might fail when updating an
# item inside of an array as it will try to add a new item instead of
# replacing the existing one. This can be fixed by using force. Keep in
# mind that resources might be recreated if force is enabled. Failed
# rollback will be removed from the helm history unless keepFailHistory is
# set to true.
correctDrift:
enabled: false
force: false # Warning: it might recreate resources if set to true
keepFailHistory: false
# dependsOn allows you to configure dependencies to other bundles. The current
# bundle will only be deployed, after all dependencies are deployed an
# accepted state. The default accepted state is the Ready state.
dependsOn:
# Format:
# <GITREPO-NAME>-<BUNDLE_PATH> with all path separators replaced by "-"
#
# Example:
#
# GitRepo name "one", Bundle path "/multi-cluster/hello-world"
# results in "one-multi-cluster-hello-world".
#
# Note:
#
# Bundle names are limited to 53 characters long. If longer they will be
# shortened:
#
# opni-fleet-examples-fleets-opni-ui-plugin-operator-crd becomes
# opni-fleet-examples-fleets-opni-ui-plugin-opera-021f7
- name: one-multi-cluster-hello-world
acceptedStates:
- Ready
- Modified
# Select bundles to depend on based on their label.
- selector:
matchLabels:
app: weak-monkey
acceptedStates:
- Ready
- Modified
# Ignore fields when monitoring a Bundle. This can be used when Fleet thinks
# some conditions in Custom Resources makes the Bundle to be in an error state
# when it shouldn't.
ignore:
# Conditions to be ignored
conditions:
# In this example a condition will be ignored if it contains
# {"type": "Active", "status", "False"}
- type: Active
status: "False"
# Override targets defined in the GitRepo. The Bundle will not have any targets
# from the GitRepo if overrideTargets is provided.
overrideTargets:
- clusterSelector:
matchLabels:
env: dev
Configuración general del paquete
Estas opciones definen las propiedades fundamentales y el comportamiento del paquete en sí, y se aplican a todos los tipos de paquetes.
| Opción | Descripción | Se aplica a |
|---|---|---|
|
Si es verdadero, el paquete no se actualizará en los clústeres en sentido descendente. En su lugar, se marcará como OutOfSync. Puedes entonces aprobar manualmente el despliegue. |
Todas |
|
Un mapa de pares clave-valor establecidos a nivel de paquete. Estos pueden ser utilizados en un |
Todas |
|
Una lista de paquetes de los que depende este paquete. El paquete actual se despliega solo después de que todas las dependencias estén en un estado aceptado. Los estados aceptados corresponden a cualquier estado de paquete válido. |
Todas |
|
Especifica los campos a ignorar al monitorear el estado del paquete. Útil para prevenir estados de error falsos de recursos personalizados. |
Todas |
|
Una lista de personalizaciones de destino que anulan cualquier objetivo definido en el GitRepo. |
Todas |
Configuración del espacio de nombres
Estas opciones controlan el espacio de nombres de Kubernetes donde se desplegarán los recursos.
| Opción | Descripción | Se aplica a |
|---|---|---|
|
Espacio de nombres predeterminado para recursos que no especifican uno. |
Todas |
|
Asigna todos los recursos en el paquete a este espacio de nombres. Falla si existen recursos con alcance de clúster. |
Todas |
|
Etiquetas que se añadirán al espacio de nombres creado por SUSE® Rancher Prime Continuous Delivery. |
Todas |
|
Anotaciones que se añadirán al espacio de nombres creado por SUSE® Rancher Prime Continuous Delivery. |
Todas |
Configuración del paquete de Helm
Todos los paquetes se despliegan utilizando Helm, pero estas opciones son específicas para paquetes al estilo de Helm (aquellos con un archivo Chart.yaml).
|
Los ajustes Fleet descarga el chart durante la fase inicial de creación del paquete. Esto ocurre antes de que se procesen
Si un clúster específico debe utilizar un registro o fuente de chart diferente (por ejemplo, debido a restricciones de red o firewall), configúralo utilizando un recurso |
Fuente del chart
Estas opciones especifican cómo descargar el chart. La referencia puede ser una ruta local, una URL de go-getter, un repositorio de Helm o un repositorio de Helm OCI.
| Opción | Descripción | Se aplica a |
|---|---|---|
|
La ubicación del chart de Helm (ruta local o URL de go-getter). Para registros OCI, utiliza |
Helm |
|
URL de un repositorio de Helm o registro OCI ( |
Helm |
|
Versión del chart o restricción semver. Reevaluado en cada cambio de git. |
Helm |
|
Si es verdadero, desactiva las descargas automáticas de dependencias. |
Helm |
La referencia del chart puede ser una de las siguientes:
-
Ruta local (
chart) -
URL de go-getter (
chart) -
URL del chart OCI (
repo: oci://…) -
Repositorio de Helm (
repo+chart+versionopcional) -
Repositorio OCI de Helm (
repo: oci://…+versionopcional)
helm.repo
Para registros OCI, helm.repo es el campo canónico para la URL OCI. Úsalo así:
helm:
repo: "oci://ghcr.io/fleetrepoci/guestbook"
version: "0.1.0" # optional
Esto es consistente con cómo se referencian los registros OCI en recursos de HelmOp.
helm.chart
Especifica una ruta local o URL de go-getter para el chart de Helm. Cuando helm.repo se establece en una URL de repositorio de Helm estándar (no OCI), helm.chart contiene el nombre del chart dentro de ese repositorio.
Si se definió un secreto para la clave SSH a través de helmSecretName, se inyecta automáticamente.
|
Si el archivo |
|
Limitación: Descargar charts de Helm desde Git con paquetes CA personalizados no funciona.
Si se configura un paquete CA en un secreto referenciado en |
|
Obsoleto: Colocar una URL OCI (por ejemplo,
|
helm.version
Determina qué chart descargar de los registros OCI.
|
Los registros OCI no soportan el carácter |
Valores
Opciones para personalizar los valores del chart de Helm.
| Opción | Descripción | Se aplica a |
|---|---|---|
|
Pares clave-valor pasados a Helm como valores personalizados. Soporta plantillas. |
Helm |
|
Rutas a archivos de valores pasados a Helm. |
Helm |
|
Carga valores de ConfigMaps o Secretos en clústeres descendentes. |
Helm |
No es necesario especificar el propio values.yaml de un chart. Siempre se utiliza por defecto.
Consulta Usando Valores de Helm para más información.
Para las etapas de procesamiento de valores, consulta Ciclo de vida del paquete.
Plantillado de Valores
SUSE® Rancher Prime Continuous Delivery soporta expresiones de plantilla Go para necesidades avanzadas de plantillado. Consulta las funciones de plantilla de Sprig para las funciones disponibles.
|
Evita funciones que produzcan resultados aleatorios (por ejemplo, |
Puedes probar la plantilla de valores con la CLI, consulta fleet-target.
Claves del contexto de la plantilla:
-
.ClusterValues -
.ClusterLabels -
.ClusterAnnotations -
.ClusterName -
.ClusterNamespace
Ejemplo:
${ get .ClusterLabels "management.cattle.io/cluster-display-name" }
La plantilla SUSE® Rancher Prime Continuous Delivery utiliza delimitadores ${ } (no el {{ }} de Helm). Escápalos utilizando comillas invertidas:
foo-bar-${`${PWD}`}
Salidas:
foo-bar-${PWD}
|
Al utilizar plantillas, protege contra valores nulos. Ejemplo:
|
Despliegue de Helm
Estas opciones controlan cómo el agente de Fleet despliega recursos. También se aplican a kustomize- y paquetes de estilo manifest.
| Opción | Descripción | Se aplica a |
|---|---|---|
|
Nombre de lanzamiento personalizado. Por defecto, se genera un nombre. |
Todas |
|
Omitir comprobaciones de anotaciones. |
Todas |
|
Sobrescribir recursos inmutables. |
Todas |
|
Usar la bandera |
Todas |
|
Espera a que todos los trabajos finalicen antes de marcar GitRepo como listo. |
Todas |
|
Desactivar el preprocesamiento de plantillas de Go. |
Todas |
|
Desactivar la resolución DNS en las plantillas. |
Todas |
|
Omitir la validación de |
Todas |
Configuración de Kustomize
Se utiliza al desplegar desde un directorio que contiene un archivo kustomization.yaml.
Opción |
Descripción |
Se aplica a |
|
Carpeta personalizada para recursos de Kustomize. Debe contener un archivo |
Kustomize |
Estrategia de Despliegue (Despliegue gradual)
Estas opciones controlan cómo se despliegan las actualizaciones en los clústeres.
| Opción | Descripción | Se aplica a |
|---|---|---|
|
Máximo de clústeres no disponibles durante la actualización. |
Todas |
|
Máximo de particiones no disponibles durante la actualización. |
Todas |
|
Tamaño de partición automática para clústeres. |
Todas |
rolloutStrategy.autoPartitionThreshold |
El número mínimo de clústeres requeridos antes de habilitar la auto-partición. Por debajo de este umbral, todos los clústeres se colocan en una única partición. |
Todas |
|
Número máximo de nuevos BundleDeployments que se pueden preparar por reconciliación. El valor por defecto es 50. |
Todas |
|
Define particiones de clúster para despliegues por fases. |
Todas |
Para más información, consulta Estrategia de Despliegue.
Objetivos y Personalización
Estas opciones te permiten personalizar los despliegues para clústeres específicos o grupos de clústeres.
| Opción | Descripción | Se aplica a |
|---|---|---|
|
Lista de reglas para modificar recursos por objetivo. |
Todas |
|
Nombre para la personalización. |
Todas |
|
Selector de etiquetas de Kubernetes para clústeres. |
Todas |
|
Nombre del grupo de clústeres a dirigir. |
Todas |
|
Selector de etiquetas para grupos de clústeres. |
Todas |
|
Nombre específico del clúster a dirigir. |
Todas |
|
Previene el despliegue en clústeres coincidentes. |
Todas |
|
Sobrescribe el espacio de nombres a nivel raíz. |
Todas |
|
Sobrescribe el espacio de nombres predeterminado a nivel raíz. |
Todas |
|
Sobrescribe la configuración de Helm a nivel raíz. |
Todas |
|
Sobrescribe la configuración de Kustomize a nivel raíz. |
Kustomize |
|
Nombres de superposiciones para reemplazar o parchear recursos YAML. |
Raw YAML |
|
Habilita la corrección de deriva para recursos gestionados. |
Todas |
Personalizaciones soportadas
|
Sobrescribir las versiones de los charts de Helm en las personalizaciones de destino puede aumentar el tamaño de los paquetes. Debido a que SUSE® Rancher Prime Continuous Delivery almacena paquetes en etcd, esto puede exceder el límite de tamaño de blob de etcd. Consulta Fleet#1650 para más detalles. |