Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,7 @@ generate-e2e-templates-main: $(KUSTOMIZE)
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology-kcp-only --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology-kcp-only.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology-autoscaler --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology-autoscaler.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-topology-taints --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-topology-taints.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/cluster-template-ignition --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/cluster-template-ignition.yaml
$(KUSTOMIZE) build $(DOCKER_TEMPLATES)/main/clusterclass-quick-start-kcp-only --load-restrictor LoadRestrictionsNone > $(DOCKER_TEMPLATES)/main/clusterclass-quick-start-kcp-only.yaml

Expand Down
2 changes: 2 additions & 0 deletions api/controlplane/kubeadm/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ func (src *KubeadmControlPlane) ConvertTo(dstRaw conversion.Hub) error {
// Recover other values
if ok {
bootstrapv1beta1.RestoreKubeadmConfigSpec(&restored.Spec.KubeadmConfigSpec, &dst.Spec.KubeadmConfigSpec)
dst.Spec.MachineTemplate.Spec.Taints = restored.Spec.MachineTemplate.Spec.Taints
}

if src.Spec.RemediationStrategy != nil {
Expand Down Expand Up @@ -134,6 +135,7 @@ func (src *KubeadmControlPlaneTemplate) ConvertTo(dstRaw conversion.Hub) error {
// Recover other values
if ok {
bootstrapv1beta1.RestoreKubeadmConfigSpec(&restored.Spec.Template.Spec.KubeadmConfigSpec, &dst.Spec.Template.Spec.KubeadmConfigSpec)
dst.Spec.Template.Spec.MachineTemplate.Spec.Taints = restored.Spec.Template.Spec.MachineTemplate.Spec.Taints
}

if src.Spec.Template.Spec.RemediationStrategy != nil {
Expand Down
17 changes: 17 additions & 0 deletions api/controlplane/kubeadm/v1beta2/kubeadm_control_plane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,23 @@ type KubeadmControlPlaneMachineTemplateSpec struct {
// deletion contains configuration options for Machine deletion.
// +optional
Deletion KubeadmControlPlaneMachineTemplateDeletionSpec `json:"deletion,omitempty,omitzero"`

// taints are the node taints that Cluster API will manage.
// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
// Only those taints defined in this list will be added or removed by core Cluster API controllers.
//
// There can be at most 64 taints.
// A pod would have to tolerate all existing taints to run on the corresponding node.
//
// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
// +optional
// +listType=map
// +listMapKey=key
// +listMapKey=effect
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=64
Taints []clusterv1.MachineTaint `json:"taints,omitempty"`
}

// KubeadmControlPlaneMachineTemplateDeletionSpec contains configuration options for Machine deletion.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,23 @@ type KubeadmControlPlaneTemplateMachineTemplateSpec struct {
// deletion contains configuration options for Machine deletion.
// +optional
Deletion KubeadmControlPlaneTemplateMachineTemplateDeletionSpec `json:"deletion,omitempty,omitzero"`

// taints are the node taints that Cluster API will manage.
// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
// Only those taints defined in this list will be added or removed by core Cluster API controllers.
//
// There can be at most 64 taints.
// A pod would have to tolerate all existing taints to run on the corresponding node.
//
// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
// +optional
// +listType=map
// +listMapKey=key
// +listMapKey=effect
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=64
Taints []clusterv1.MachineTaint `json:"taints,omitempty"`
}

// KubeadmControlPlaneTemplateMachineTemplateDeletionSpec contains configuration options for Machine deletion.
Expand Down
10 changes: 10 additions & 0 deletions api/controlplane/kubeadm/v1beta2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions api/core/v1beta1/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,13 @@ func (src *Cluster) ConvertTo(dstRaw conversion.Hub) error {
}

dst.Spec.Topology.ControlPlane.HealthCheck.Checks.UnhealthyMachineConditions = restored.Spec.Topology.ControlPlane.HealthCheck.Checks.UnhealthyMachineConditions
dst.Spec.Topology.ControlPlane.Taints = restored.Spec.Topology.ControlPlane.Taints
for i, md := range restored.Spec.Topology.Workers.MachineDeployments {
dst.Spec.Topology.Workers.MachineDeployments[i].HealthCheck.Checks.UnhealthyMachineConditions = md.HealthCheck.Checks.UnhealthyMachineConditions
dst.Spec.Topology.Workers.MachineDeployments[i].Taints = md.Taints
}
for i, mp := range restored.Spec.Topology.Workers.MachinePools {
dst.Spec.Topology.Workers.MachinePools[i].Taints = mp.Taints
}

// Recover intent for bool values converted to *bool.
Expand Down Expand Up @@ -151,8 +156,13 @@ func (src *ClusterClass) ConvertTo(dstRaw conversion.Hub) error {
}

dst.Spec.ControlPlane.HealthCheck.Checks.UnhealthyMachineConditions = restored.Spec.ControlPlane.HealthCheck.Checks.UnhealthyMachineConditions
dst.Spec.ControlPlane.Taints = restored.Spec.ControlPlane.Taints
for i, md := range restored.Spec.Workers.MachineDeployments {
dst.Spec.Workers.MachineDeployments[i].HealthCheck.Checks.UnhealthyMachineConditions = md.HealthCheck.Checks.UnhealthyMachineConditions
dst.Spec.Workers.MachineDeployments[i].Taints = md.Taints
}
for i, mp := range restored.Spec.Workers.MachinePools {
dst.Spec.Workers.MachinePools[i].Taints = mp.Taints
}

// Recover intent for bool values converted to *bool.
Expand Down
6 changes: 6 additions & 0 deletions api/core/v1beta1/zz_generated.conversion.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions api/core/v1beta2/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,23 @@ type ControlPlaneTopology struct {
// +optional
Deletion ControlPlaneTopologyMachineDeletionSpec `json:"deletion,omitempty,omitzero"`

// taints are the node taints that Cluster API will manage.
// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
// Only those taints defined in this list will be added or removed by core Cluster API controllers.
//
// There can be at most 64 taints.
// A pod would have to tolerate all existing taints to run on the corresponding node.
//
// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
// +optional
// +listType=map
// +listMapKey=key
// +listMapKey=effect
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=64
Taints []MachineTaint `json:"taints,omitempty"`

// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
//
// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
Expand Down Expand Up @@ -891,6 +908,23 @@ type MachineDeploymentTopology struct {
// +optional
Deletion MachineDeploymentTopologyMachineDeletionSpec `json:"deletion,omitempty,omitzero"`

// taints are the node taints that Cluster API will manage.
// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
// Only those taints defined in this list will be added or removed by core Cluster API controllers.
//
// There can be at most 64 taints.
// A pod would have to tolerate all existing taints to run on the corresponding node.
//
// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
// +optional
// +listType=map
// +listMapKey=key
// +listMapKey=effect
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=64
Taints []MachineTaint `json:"taints,omitempty"`

// minReadySeconds is the minimum number of seconds for which a newly created machine should
// be ready.
// Defaults to 0 (machine will be considered available as soon as it
Expand Down Expand Up @@ -1203,6 +1237,23 @@ type MachinePoolTopology struct {
// +optional
Deletion MachinePoolTopologyMachineDeletionSpec `json:"deletion,omitempty,omitzero"`

// taints are the node taints that Cluster API will manage.
// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
// Only those taints defined in this list will be added or removed by core Cluster API controllers.
//
// There can be at most 64 taints.
// A pod would have to tolerate all existing taints to run on the corresponding node.
//
// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
// +optional
// +listType=map
// +listMapKey=key
// +listMapKey=effect
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=64
Taints []MachineTaint `json:"taints,omitempty"`

// minReadySeconds is the minimum number of seconds for which a newly created machine pool should
// be ready.
// Defaults to 0 (machine will be considered available as soon as it
Expand Down
51 changes: 51 additions & 0 deletions api/core/v1beta2/clusterclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,23 @@ type ControlPlaneClass struct {
// +optional
Deletion ControlPlaneClassMachineDeletionSpec `json:"deletion,omitempty,omitzero"`

// taints are the node taints that Cluster API will manage.
// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
// Only those taints defined in this list will be added or removed by core Cluster API controllers.
//
// There can be at most 64 taints.
// A pod would have to tolerate all existing taints to run on the corresponding node.
//
// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
// +optional
// +listType=map
// +listMapKey=key
// +listMapKey=effect
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=64
Taints []MachineTaint `json:"taints,omitempty"`

// readinessGates specifies additional conditions to include when evaluating Machine Ready condition.
//
// This field can be used e.g. to instruct the machine controller to include in the computation for Machine's ready
Expand Down Expand Up @@ -462,6 +479,23 @@ type MachineDeploymentClass struct {
// +optional
Deletion MachineDeploymentClassMachineDeletionSpec `json:"deletion,omitempty,omitzero"`

// taints are the node taints that Cluster API will manage.
// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
// Only those taints defined in this list will be added or removed by core Cluster API controllers.
//
// There can be at most 64 taints.
// A pod would have to tolerate all existing taints to run on the corresponding node.
//
// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
// +optional
// +listType=map
// +listMapKey=key
// +listMapKey=effect
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=64
Taints []MachineTaint `json:"taints,omitempty"`

// minReadySeconds is the minimum number of seconds for which a newly created machine should
// be ready.
// Defaults to 0 (machine will be considered available as soon as it
Expand Down Expand Up @@ -775,6 +809,23 @@ type MachinePoolClass struct {
// +optional
Deletion MachinePoolClassMachineDeletionSpec `json:"deletion,omitempty,omitzero"`

// taints are the node taints that Cluster API will manage.
// This list is not necessarily complete: other Kubernetes components may add or remove other taints from nodes,
// e.g. the node controller might add the node.kubernetes.io/not-ready taint.
// Only those taints defined in this list will be added or removed by core Cluster API controllers.
//
// There can be at most 64 taints.
// A pod would have to tolerate all existing taints to run on the corresponding node.
//
// NOTE: This list is implemented as a "map" type, meaning that individual elements can be managed by different owners.
// +optional
// +listType=map
// +listMapKey=key
// +listMapKey=effect
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=64
Taints []MachineTaint `json:"taints,omitempty"`

// minReadySeconds is the minimum number of seconds for which a newly created machine pool should
// be ready.
// Defaults to 0 (machine will be considered available as soon as it
Expand Down
3 changes: 2 additions & 1 deletion api/core/v1beta2/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,8 @@ func (r *ContractVersionedObjectReference) GroupKind() schema.GroupKind {

// MachineTaint defines a taint equivalent to corev1.Taint, but additionally having a propagation field.
type MachineTaint struct {
// Note: we do not use CEL for validating the key as qualified name, because it would be too expensive for Cluster and ClusterClass objects.

// key is the taint key to be applied to a node.
// Must be a valid qualified name of maximum size 63 characters
// with an optional subdomain prefix of maximum size 253 characters,
Expand All @@ -419,7 +421,6 @@ type MachineTaint struct {
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=317
// +kubebuilder:validation:Pattern=^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*\/)?([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$
// +kubebuilder:validation:XValidation:rule="self.contains('/') ? ( self.split('/') [0].size() <= 253 && self.split('/') [1].size() <= 63 && self.split('/').size() == 2 ) : self.size() <= 63",message="key must be a valid qualified name of max size 63 characters with an optional subdomain prefix of max size 253 characters"
Key string `json:"key,omitempty"`

// value is the taint value corresponding to the taint key.
Expand Down
Loading
Loading