Skip to content

Commit 8a0f11b

Browse files
authored
Merge pull request #5582 from ykakarap/clusterctl-provider-contract-update
📖 update clusterctl provider contract for clusterclass support
2 parents 0092df1 + 141601b commit 8a0f11b

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

docs/book/src/clusterctl/provider-contract.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Additionally, the provider repository SHOULD contain the following files:
1616

1717
* Workload cluster templates
1818

19+
Optionally, the provider repository can include the following files:
20+
21+
* ClusterClass definitions
22+
1923
<aside class="note">
2024

2125
<h1> Pre-defined list of providers </h1>
@@ -200,11 +204,14 @@ providers.
200204
An infrastructure provider could publish a **cluster templates** file to be used by `clusterctl generate cluster`.
201205
This is single YAML with _all_ the objects required to create a new workload cluster.
202206

207+
With ClusterClass enabled it is possible to have cluster templates with managed topologies. Cluster templates with managed
208+
topologies require only the cluster object in the template and a corresponding ClusterClass definition.
209+
203210
The following rules apply:
204211

205212
#### Naming conventions
206213

207-
Cluster templates MUST be stored in the same folder as the component YAML and follow this naming convention:
214+
Cluster templates MUST be stored in the same location as the component YAML and follow this naming convention:
208215
1. The default cluster template should be named `cluster-template.yaml`.
209216
2. Additional cluster template should be named `cluster-template-{flavor}.yaml`. e.g `cluster-template-prod.yaml`
210217

@@ -242,6 +249,47 @@ Templates writers should use the common variables to ensure consistency across p
242249
Additionally, the value of the command argument to `clusterctl generate cluster <cluster-name>` (`<cluster-name>` in this case), will
243250
be applied to every occurrence of the `${ CLUSTER_NAME }` variable.
244251

252+
### ClusterClass definitions
253+
254+
An infrastructure provider could publish a **ClusterClass definition** file to be used by `clusterctl generate cluster` that will be used along
255+
with the workload cluster templates.
256+
This is a single YAML with _all_ the objects required that make up the ClusterClass.
257+
258+
The following rules apply:
259+
260+
#### Naming conventions
261+
262+
ClusterClass definitions MUST be stored in the same location as the component YAML and follow this naming convention:
263+
1. The ClusterClass definition should be named `clusterclass-{ClusterClass-name}.yaml`, e.g `clusterclass-prod.yaml`.
264+
265+
`{ClusterClass-name}` is the name of the ClusterClass that is referenced from the Cluster.spec.topology.class field
266+
in the Cluster template; Cluster template files using a ClusterClass are usually simpler because they are no longer
267+
required to have all the templates.
268+
269+
Each provider should create user facing documentation with the list of available ClusterClass definitions.
270+
271+
#### Target namespace
272+
273+
The ClusterClass definition YAML MUST assume the target namespace already exists.
274+
275+
The references in the ClusterClass definition should NOT specify a namespace.
276+
277+
It is recommended that none of the objects in the ClusterClass YAML should specify a namespace.
278+
279+
Even if technically possible, it is strongly recommended that none of the objects in the ClusterClass definitions are shared across multiple definitions;
280+
this helps in preventing changing an object inadvertently impacting many ClusterClasses, and consequently, all the Clusters using those ClusterClasses.
281+
282+
#### Variables
283+
284+
Currently the ClusterClass definitions SHOULD NOT have any environment variables in them.
285+
286+
ClusterClass definitions files should not use variable substitution, given that ClusterClass and managed topologies provide an alternative model for variable definition.
287+
288+
#### Note
289+
290+
A ClusterClass definition is automatically included in the output of `clusterctl generate cluster` if the cluster template uses a managed topology
291+
and a ClusterClass with the same name does not already exists in the Cluster.
292+
245293
## OwnerReferences chain
246294

247295
Each provider is responsible to ensure that all the providers resources (like e.g. `VSphereCluster`, `VSphereMachine`, `VSphereVM` etc.

0 commit comments

Comments
 (0)