Creating Clusters with Class • Topology

Creating Clusters with Class • Topology

Topology is destiny,’ he said, and put the drawers on. One leg at a time — Neal Stephenson

ClusterTopology is the complimentary component for ClusterClass in ClusterSpec. It allows for overrides and Cluster controls that determine the shape of the Cluster. Using controls like replicas can dictate how many nodes you will be running, and whether to enable the MachineHealthChecks or not, providing variables for customization.

Let’s explore each field in detail

Class

refers to the ClusterClass name this topology is referring to, this field is mutable meaning you can change the associated ClusterClass and associate ControlPlaneTopology and WorkersTopology and Cluster API will take care of reconciling the changes. But great detail and care should be taken to make such drastic changes as these can render Cluster API controllers to remain stuck if changes are not compatible.

Version

central place to control create and upgrade operations of your Kubernetes Cluster version. This change should be done in conjunction with editing KubeadmControlPlaneTemplate and Workers KubeadmConfigTemplate for argument changes and most importantly node image changes in InfrastructureMachineTemplate.

ControlPlane • ControlPlaneTopology

ControlPlaneTopology contains various options and overrides for properties from ClusterClass values. It contains ControlPlane-specific variables.

  • Metadata — is used to specify additional labels and annotations that we want to be present on generate Control plane object.

  • Replicas — which is used to specify the number of replicas for ControlPlane machines.

  • MachineHealthCheckTopology — allows to specify a choice to enable or disable the MachineHealthChecks using Enabled field and contains embedded MachineHealthCheckClass that allows to provide overrides for the same.

  • NodeDrainTimeOut, NodeDeletionTimeOut, and NodeVolumeDetachmTimeout are used to indicate various timeouts used during node drain and deletion.

  • ControlPlaneVariables — allows specifying ControlPlane-specific overriding variables that are applied only in the context of ControlPlanes.

Workers • WorkersTopology

WorkersClass is a very simple class that allows specifying workers as MachineDeploymentClass and MachinePoolClass arrays. All the complexity is abstracted away by MachineDeploymentClass and MachinePoolClass .

Let’s first discuss the common properties shared by the MachineDeploymentClass and MachinePoolClass

  • Metadata — is used to specify additional labels and annotations that we want to be present on generated MachineDeployment or MachinePool object.

  • Class — refers to a unique name for this particular MachineDeploymentClass or MachinePoolClass .

  • FailureDomain — allows users to specify an array of failure domains to spread the worker machines across.

  • Replicas — which are used to specify the number of replicas for MachineDeployment machines or MachinePool replicas.

  • NodeDrainTimeOut, NodeDeletionTimeOut, and NodeVolumeDetachmTimeout are used to indicate various timeouts used during node drain and deletion

  • MinReadySeconds — minimum time for which the machine should remain ready before Cluster API considers it available and moves on to create new machines.

  • Variables — allows specifying MachineDeployment or MachinePool specific overriding variables that are applied only in the context of MachineDeployment or MachinePool respectively.

MachineDeployment specific options are

  • Strategy — allows user to regulate various MachineDeployment rollout options

  • MachineHealthCheckClass — allows users to specify MachineHealthChecks for workers, creation of MachineHealthCheck objects is taken care of by Cluster API

Variables • []ClusterVariable

Variables at the ClusterTopolgy level are applied to the whole cluster these variables can be used to define values that apply to the Cluster, ControlPlane and workers alike. We can think of these as generic values and later you can specify variables at ControlPlane and workers level that apply to those sections respectively.


In the next section, we will explore how name generations are handled for templates and best practices for names.