|
| 1 | += Cluster Resource Relationships in Turtles |
| 2 | + |
| 3 | +== Overview |
| 4 | + |
| 5 | +Rancher integrates several components that define their own `Cluster` custom resources. |
| 6 | +Rancher Turtles builds on this foundation using Cluster API and Fleet, which can lead to confusion around how these `Cluster` resources interact and what users should edit. |
| 7 | + |
| 8 | +This document explains the purpose, behavior, and relationships between the following cluster resources: |
| 9 | + |
| 10 | +* `clusters.cluster.x-k8s.io` (CAPI Cluster) |
| 11 | +* `clusters.fleet.cattle.io` (Fleet Cluster) |
| 12 | +* `clusters.provisioning.cattle.io` (Provisioning Cluster) |
| 13 | +* `clusters.management.cattle.io` (Management Cluster) |
| 14 | + |
| 15 | +== Resource Summary |
| 16 | + |
| 17 | +|=== |
| 18 | +| API Group | Cluster Resource | Role |
| 19 | + |
| 20 | +| `cluster.x-k8s.io` |
| 21 | +| CAPI Cluster |
| 22 | +| Defines the cluster lifecycle and topology. Acts as the source of truth in Turtles. |
| 23 | + |
| 24 | +| `fleet.cattle.io` |
| 25 | +| Fleet Cluster |
| 26 | +| Used for GitOps bundle targeting and application synchronization via Fleet. |
| 27 | + |
| 28 | +| `provisioning.cattle.io` |
| 29 | +| Provisioning Cluster |
| 30 | +| Rancher's general-purpose cluster abstraction. Encapsulates both infrastructure-agnostic and provider-specific configuration. Required for generating cluster registration tokens and manifests. Automatically created by the Rancher Turtles when importing CAPI clusters. |
| 31 | + |
| 32 | +| `management.cattle.io` |
| 33 | +| Management Cluster |
| 34 | +| Legacy Rancher cluster representation. Primarily used for RKE1 clusters and hosted Kubernetes services (AKS, EKS, GKE). |
| 35 | +|=== |
| 36 | + |
| 37 | +== Relationships |
| 38 | + |
| 39 | +=== CAPI Cluster → Fleet Cluster |
| 40 | + |
| 41 | +When the Cluster API Add-on Provider for Fleet (CAAPF) is enabled, it propagates labels and annotations from the CAPI `Cluster` to the corresponding Fleet `Cluster`. This enables targeting GitOps bundles via label selectors. |
| 42 | + |
| 43 | +=== CAPI Cluster → Provisioning Cluster |
| 44 | + |
| 45 | +If Rancher provisioning is used, a `provisioning.cattle.io.Cluster` is created to wrap the CAPI Cluster and expose Rancher-specific fields (e.g., display name, RKE config). However, in most Rancher Turtles workflows, this resource is not required. |
| 46 | + |
| 47 | +=== Provisioning Cluster → Management Cluster |
| 48 | + |
| 49 | +Each `provisioning.cattle.io.Cluster` results in the creation of a `management.cattle.io.Cluster`, which is used by Rancher’s UI and APIs. This object is not meant to be modified by users. |
| 50 | + |
| 51 | +== Propagation Behavior |
| 52 | + |
| 53 | +|=== |
| 54 | +| From → To | Propagation | Notes |
| 55 | + |
| 56 | +| CAPI → Fleet |
| 57 | +| Yes |
| 58 | +| Propagated by CAAPF |
| 59 | + |
| 60 | +| CAPI → Provisioning |
| 61 | +| No |
| 62 | +| No automatic propagation |
| 63 | + |
| 64 | +| CAPI → Management |
| 65 | +| No |
| 66 | +| Only via Provisioning Cluster |
| 67 | + |
| 68 | +| Provisioning → Fleet |
| 69 | +| No |
| 70 | +| Not supported |
| 71 | + |
| 72 | +| Fleet → CAPI |
| 73 | +| No |
| 74 | +| Not supported |
| 75 | +|=== |
| 76 | + |
| 77 | +== What Should User Edit? |
| 78 | + |
| 79 | +=== Recommended: `cluster.x-k8s.io.Cluster` |
| 80 | + |
| 81 | +The CAPI Cluster is the authoritative resource for cluster definition in Rancher Turtles. |
| 82 | +Labels must be placed on the CAPI Cluster object. They will automatically propagate to the Fleet Cluster, enabling label-based bundle selectors to work as expected. |
| 83 | + |
| 84 | +=== Conditional: `provisioning.cattle.io.Cluster` |
| 85 | + |
| 86 | +Only required when using Rancher-native provisioning features (e.g., `spec.rkeConfig`, UI-driven flows). Avoid editing unless explicitly required. |
| 87 | + |
| 88 | +=== Avoid: `fleet.cattle.io.Cluster` |
| 89 | + |
| 90 | +Fleet Clusters are managed automatically. Edits are discouraged unless working on Fleet internals. |
| 91 | + |
| 92 | +=== Avoid: `management.cattle.io.Cluster` |
| 93 | + |
| 94 | +These resources are internal and fully managed by Rancher. Do not modify them. |
| 95 | + |
| 96 | +[NOTE] |
| 97 | +==== |
| 98 | +* The **CAPI Cluster** is the source of truth. |
| 99 | +* **Fleet Clusters** are generated automatically from CAPI Clusters via CAAPF. |
| 100 | +* **Provisioning** and **Management Clusters** are *not required* unless Rancher provisioning is involved. |
| 101 | +==== |
| 102 | + |
| 103 | +[TIP] |
| 104 | +==== |
| 105 | +Use the CAPI Cluster’s labels to drive Fleet bundle deployment. The CAAPF controller ensures those labels are synced to the Fleet Cluster object. |
| 106 | +==== |
| 107 | + |
| 108 | +== References |
| 109 | + |
| 110 | +* https://github.com/rancher/cluster-api-addon-provider-fleet[Cluster API Add-on Provider for Fleet (CAAPF)] |
| 111 | +* https://fleet.rancher.io[Fleet documentation] |
| 112 | +* https://extensions.rancher.io/internal/code-base-works/cluster-management-resources#cluster-resources[Rancher Cluster Internals] |
0 commit comments