Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 ClusterClass: add MD variables to the ClusterClass proposal #5981

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion docs/proposals/202105256-cluster-class-and-managed-topologies.md
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,10 @@ Note: Builtin variables are defined in [Builtin variables](#builtin-variables) b
// of this value.
// +optional
Replicas *int `json:"replicas,omitempty"`

// Variables can be used to customize the MachineDeployment through patches.
// +optional
Variables *MachineDeploymentVariables `json:"variables,omitempty"`
}
```
1. The `ClusterVariable` object represents an instance of a variable.
Expand All @@ -630,6 +634,16 @@ Note: Builtin variables are defined in [Builtin variables](#builtin-variables) b
}
```

1. The `MachineDeploymentVariables` represents variable overrides for a MachineDeployment topology .
```golang
// MachineDeploymentVariables can be used to provide variables for a specific MachineDeployment.
type MachineDeploymentVariables struct {
// Overrides can be used to override Cluster level variables.
// +optional
Overrides []ClusterVariable `json:"overrides,omitempty"`
}
```

#### Builtin variables

It’s also possible to use so-called builtin variables in addition to user-defined variables. The following builtin variables are available:
Expand Down Expand Up @@ -720,6 +734,8 @@ Builtin variables are available under the `builtin.` prefix. Some examples:
- `spec.topology.workers.machineDeployments[i].name` field must be unique within a Cluster
- (defaulting) variables are defaulted according to the corresponding `ClusterClassVariable`
- all required variables must exist and match the schema defined in the corresponding `ClusterClassVariable` in the ClusterClass
- (defaulting) nested fields of `spec.topology.workers.machineDeployments[i].variables.overrides` are defaulted according to the corresponding `ClusterClassVariable`
- `spec.topology.workers.machineDeployments[i].variables.overrides` must match the schema defined in the corresponding `ClusterClassVariable` in the ClusterClass

- For object updates:
- If `spec.topology.class` is set it cannot be unset or modified, and if it's unset it cannot be set.
Expand All @@ -729,7 +745,9 @@ Builtin variables are available under the `builtin.` prefix. Some examples:
- A set of worker nodes can be added to or removed from the `spec.topology.workers.machineDeployments` list.
- (defaulting) variables are defaulted according to the corresponding `ClusterClassVariable`
- all required variables must exist and match the schema defined in the corresponding `ClusterClassVariable` in the ClusterClass

- (defaulting) nested fields of `spec.topology.workers.machineDeployments[i].variables.overrides` are defaulted according to the corresponding `ClusterClassVariable`
- `spec.topology.workers.machineDeployments[i].variables.overrides` must match the schema defined in the corresponding `ClusterClassVariable` in the ClusterClass

#### ClusterClass compatibility

There are cases where we must consider whether two ClusterClasses are compatible:
Expand Down Expand Up @@ -990,6 +1008,7 @@ to avoid creating separate ClusterClasses for every small deviation, e.g. a diff
- Calculate patches:
- evaluate patch selector
- evaluate patch values
- if variable overrides are set, they are used instead of the Cluster-level variables.
- Apply patches to our local copies of the templates.
<br>**Note**: Patches are applied in the order in which they are defined in the ClusterClass.

Expand Down