Import strategy
CAAPF is following simple import strategy for CAPI clusters.
- Per each CAPI cluster, there is a Fleet
Cluster
object - Per each CAPI Cluster Class there is a Fleet
ClusterGroup
object. - There is a default
ClusterGroup
for allClusterClasses
in the managmement cluster. - There is a default
ClusterGroup
for all CAPIClusters
in the management cluster. - For each CAPI
Cluster
referencing aClusterClass
in a different namespace, aClusterGroup
is created in theCluster
namespace. ThisClusterGroup
targets all clusters in this namespace, pointing to the sameClusterClass
.
By default, CAAPF
imports all CAPI
clusters under fleet management. See next section for configuration
Label synchronization
Fleet mainly relies on Cluster
labels, Cluster
names and ClusterGroups
when performing target matching for the desired application or repo content deployment. For that reason CAAPF
synchronizes labels from the CAPI
clusters to the imported Fleet
Cluster resource.
Configuration
FleetAddonConfig
provides several configuration options to define clusters to import.
Namespace Label Selection
This section defines how to select namespaces based on specific labels. The namespaceSelector
field ensures that the import strategy applies only to namespaces that have the label import: "true"
. This is useful for scoping automatic import to specific namespaces rather than applying it cluster-wide.
apiVersion: addons.cluster.x-k8s.io/v1alpha1
kind: FleetAddonConfig
metadata:
name: fleet-addon-config
spec:
cluster:
namespaceSelector:
matchLabels:
import: "true"
Cluster Label Selection
This section filters clusters based on labels, ensuring that the FleetAddonConfig applies only to clusters with the label import: "true"
. This allows more granular per-cluster selection across the cluster scope.
apiVersion: addons.cluster.x-k8s.io/v1alpha1
kind: FleetAddonConfig
metadata:
name: fleet-addon-config
spec:
cluster:
selector:
matchLabels:
import: "true"