fleet.yaml
Die fleet.yaml Datei fügt Optionen zu einem Bundle hinzu. Jedes Verzeichnis mit einer fleet.yaml Datei wird automatisch in ein Bundle umgewandelt.
Für weitere Informationen zur Anpassung von Bundles mit fleet.yaml siehe Inhalt des Git-Repositorys.
Der Inhalt von fleet.yaml entspricht der FleetYAML Struktur in
fleetyaml.go,
die die BundleSpec enthält.
Vollständiges Beispiel
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
Allgemeine Bundle-Konfiguration
Diese Optionen definieren die grundlegenden Eigenschaften und das Verhalten des Bundles selbst und gelten für alle Bundle-Typen.
| Option | Beschreibung | Gilt für |
|---|---|---|
|
Wenn wahr, wird das Bundle in Downstream-Clustern nicht aktualisiert. Stattdessen wird es als OutOfSync markiert. Sie können dann die Bereitstellung manuell genehmigen. |
Alle |
|
Eine Karte von Schlüssel-Wert-Paaren, die auf Bundle-Ebene festgelegt sind. Diese können in einem |
Alle |
|
Eine Liste von Bundles, von denen dieses Bundle abhängt. Das aktuelle Bundle wird nur bereitgestellt, nachdem alle Abhängigkeiten in einem akzeptierten Zustand sind. Akzeptierte Zustände entsprechen allen gültigen Bundle-Zuständen. |
Alle |
|
Spezifiziert Felder, die beim Überwachen des Bundle-Status ignoriert werden sollen. Nützlich, um falsche Fehlerzustände von benutzerdefinierten Ressourcen zu verhindern. |
Alle |
|
Eine Liste von Zielanpassungen, die alle in Git-Repository definierten Ziele überschreiben. |
Alle |
Namespace-Konfiguration
Diese Optionen steuern den Kubernetes-Namespace, in dem Ressourcen bereitgestellt werden.
| Option | Beschreibung | Gilt für |
|---|---|---|
|
Standard-Namespace für Ressourcen, die keinen angeben. |
Alle |
|
Weist alle Ressourcen im Bundle diesem Namespace zu. Schlägt fehl, wenn Ressourcen auf Clusterebene existieren. |
Alle |
|
Labels, die dem durch SUSE® Rancher Prime Continuous Delivery erstellten Namespace hinzugefügt werden sollen. |
Alle |
|
Annotationen, die dem durch SUSE® Rancher Prime Continuous Delivery erstellten Namespace hinzugefügt werden sollen. |
Alle |
Helm-Bundle-Konfiguration
Alle Bundles werden mit Helm bereitgestellt, aber diese Optionen sind spezifisch für Helm-Stil-Bundles (die eine Chart.yaml-Datei haben).
|
Die Einstellungen Fleet lädt das Chart während der initialen Bundle-Erstellungsphase herunter. Dies geschieht, bevor
Wenn ein bestimmter Cluster eine andere Registry oder Chart-Quelle verwenden muss (zum Beispiel aufgrund von Netzwerk- oder Firewall-Beschränkungen), konfigurieren Sie es mit einer separaten |
Chart-Quelle
Diese Optionen geben an, wie das Chart heruntergeladen werden soll. Der Verweis kann ein lokaler Pfad, eine Go-Getter-URL, ein Helm-Repository oder ein OCI-Helm-Repository sein.
| Option | Beschreibung | Gilt für |
|---|---|---|
|
Der Speicherort des Helm-Charts (lokaler Pfad oder Go-Getter-URL). Für OCI-Registries verwenden Sie stattdessen |
Helm |
|
URL eines Helm-Repositories oder einer OCI-Registry ( |
Helm |
|
Chart-Version oder semver-Beschränkung. Bei jeder git-Änderung neu bewertet. |
Helm |
|
Wenn wahr, werden automatische Abhängigkeitsdownloads deaktiviert. |
Helm |
Der Chart-Verweis kann einer der folgenden sein:
-
Lokaler Pfad (
chart) -
go-getter URL (
chart) -
OCI-Chart-URL (
repo: oci://…) -
Helm-Repository (
repo+chart+ optionalversion) -
OCI-Helm-Repository (
repo: oci://…+ optionalversion)
helm.repo
Für OCI-Registries ist helm.repo das kanonische Feld für die OCI-URL. Verwenden Sie es so:
helm:
repo: "oci://ghcr.io/fleetrepoci/guestbook"
version: "0.1.0" # optional
Dies ist konsistent mit der Art und Weise, wie OCI-Registries in HelmOp-Ressourcen referenziert werden.
helm.chart
Gibt einen lokalen Pfad oder eine go-getter-URL für das Helm-Chart an. Wenn helm.repo auf eine Standard-(nicht-OCI) Helm-Repository-URL gesetzt ist, enthält helm.chart den Chart-Namen innerhalb dieses Repositories.
Wenn ein Geheimnis für den SSH-Schlüssel über helmSecretName definiert wurde, wird es automatisch injiziert.
|
Wenn die |
|
Beschränkung: Das Herunterladen von Helm-Charts von Git mit benutzerdefinierten CA-Bündeln funktioniert nicht.
Wenn ein CA-Bundle in einem Geheimnis konfiguriert ist, das in |
|
Veraltet: Das Platzieren einer OCI-URL (z. B.
|
helm.version
Bestimmt, welches Chart aus OCI-Registries heruntergeladen werden soll.
|
OCI-Registries unterstützen das Zeichen |
Werte
Optionen zur Anpassung der Helm-Chart-Werte.
| Option | Beschreibung | Gilt für |
|---|---|---|
|
Schlüssel-Wert-Paare, die Helm als benutzerdefinierte Werte übergeben werden. Unterstützt Templating. |
Helm |
|
Pfade zu den Werte-Dateien, die an Helm übergeben werden. |
Helm |
|
Lädt Werte aus ConfigMaps oder Secrets in Downstream-Clustern. |
Helm |
Es ist nicht notwendig, das eigene values.yaml eines Charts anzugeben. Es wird standardmäßig immer verwendet.
Siehe Verwendung von Helm-Werten für weitere Informationen.
Für die Phasen der Wertverarbeitung siehe Bundle-Lebenszyklus.
Werte-Templating
SUSE® Rancher Prime Continuous Delivery unterstützt Go-Template-Ausdrücke für erweiterte Templating-Bedürfnisse. Siehe die Sprig-Vorlagenfunktionen für verfügbare Funktionen.
|
Vermeiden Sie Funktionen, die zufällige Ausgaben erzeugen (zum Beispiel |
Sie können das Values-Templating mit der CLI testen; siehe fleet-target.
Vorlagenkontextschlüssel:
-
.ClusterValues -
.ClusterLabels -
.ClusterAnnotations -
.ClusterName -
.ClusterNamespace
Beispiel:
${ get .ClusterLabels "management.cattle.io/cluster-display-name" }
SUSE® Rancher Prime Continuous Delivery Templating verwendet ${ } Trennzeichen (nicht Helms {{ }}). Maskieren Sie sie mit Backticks:
foo-bar-${`${PWD}`}
Ausgaben:
foo-bar-${PWD}
|
Beim Verwenden von Templating, schützen Sie sich gegen Nullwerte. Beispiel:
|
Helm-Bereitstellung
Diese Optionen steuern, wie Fleets Agent Ressourcen bereitstellt. Sie gelten auch für kustomize- und Manifest-Stil-Bundles.
| Option | Beschreibung | Gilt für |
|---|---|---|
|
Benutzerdefinierter Veröffentlichungsname. Standardmäßig wird ein generierter Name verwendet. |
Alle |
|
Überspringen Sie die Überprüfungen der Annotationen. |
Alle |
|
Überschreiben Sie unveränderliche Ressourcen. |
Alle |
|
Verwenden Sie das Helm |
Alle |
|
Warten Sie auf alle Jobs, bevor Sie das GitRepo als bereit markieren. |
Alle |
|
Deaktivieren Sie die Go-Vorlagenvorverarbeitung. |
Alle |
|
Deaktivieren Sie die DNS-Auflösung in Vorlagen. |
Alle |
|
Überspringen Sie die |
Alle |
Kustomize-Konfiguration
Wird verwendet, wenn aus einem Verzeichnis mit einer kustomization.yaml-Datei bereitgestellt wird.
Option |
Beschreibung |
Gilt für |
|
Benutzerdefinierter Ordner für Kustomize-Ressourcen. Muss eine |
Kustomize |
Bereitstellungsstrategie (Rollout)
Diese Optionen steuern, wie Updates über Cluster verteilt werden.
| Option | Beschreibung | Gilt für |
|---|---|---|
|
Maximal nicht verfügbare Cluster während eines Updates. |
Alle |
|
Maximal nicht verfügbare Partitionen während eines Updates. |
Alle |
|
Automatische Partitionsgröße für Cluster. |
Alle |
rolloutStrategy.autoPartitionThreshold |
Die minimale Anzahl an Clustern, die erforderlich ist, bevor die automatische Partitionierung aktiviert wird. Unterhalb dieses Schwellenwerts werden alle Cluster in einer einzigen Partition platziert. |
Alle |
|
Maximale Anzahl neuer BundleDeployments, die pro Abgleich in der Warteschlange stehen können. Der Standardwert ist 50. |
Alle |
|
Definiert Clusterpartitionen für phasenweise Rollouts. |
Alle |
Für weitere Informationen siehe Rollout-Strategie.
Zielgerichtete Anpassung
Diese Optionen ermöglichen es Ihnen, Bereitstellungen für bestimmte Cluster oder Clustergruppen anzupassen.
| Option | Beschreibung | Gilt für |
|---|---|---|
|
Liste von Regeln zur Modifizierung von Ressourcen pro Ziel. |
Alle |
|
Anzeigename für die Anpassung. |
Alle |
|
Kubernetes-Label-Selector für Cluster. |
Alle |
|
Clustergruppenname als Ziel. |
Alle |
|
Label-Selektor für Clustergruppen. |
Alle |
|
Spezifischer Clustername als Ziel. |
Alle |
|
Verhindert die Bereitstellung in übereinstimmenden Clustern. |
Alle |
|
Überschreibt den Namespace auf Root-Ebene. |
Alle |
|
Überschreibt den Standard-Namespace auf Root-Ebene. |
Alle |
|
Überschreibt die Helm-Konfiguration auf Root-Ebene. |
Alle |
|
Überschreibt die Kustomize-Konfiguration auf Root-Ebene. |
Kustomize |
|
Overlay-Namen zum Ersetzen oder Patchen von YAML-Ressourcen. |
Rohes YAML |
|
Aktiviert die Driftkorrektur für verwaltete Ressourcen. |
Alle |
Unterstützte Anpassungen
|
Das Überschreiben von Helm-Chart-Versionen in den Zielanpassungen kann die Paketgrößen erhöhen. Da SUSE® Rancher Prime Continuous Delivery Pakete in etcd speichert, kann dies die Blob-Größenbeschränkung von etcd überschreiten. Siehe fleet#1650 für Details. |