Skip to content

Commit 91e6a8e

Browse files
committed
review fixes
1 parent f78a6f3 commit 91e6a8e

File tree

1 file changed

+22
-21
lines changed

1 file changed

+22
-21
lines changed

docs/proposals/20250513-propogate-taints.md

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -213,14 +213,14 @@ The following table shows the resulting behavior, depending on where taints are
213213

214214
**Note:** The taints field on machine's will only allow being set or not being set, there will be no "empty / `[]`" option.
215215

216-
| Machine | CABPK | Result for CABPK |
217-
|---------|--------------|-----------------------------------------------------------------------------------------------------|
218-
| Set | Set | **CABPK** and **Machine** taints, on same key + effect use the value from the Machine defined taint |
219-
| Set | Not set | **CABPK default** and **Machine** taints |
220-
| Set | empty / `[]` | **Machine** taints |
221-
| Not set | Set | **CABPK** taints |
222-
| Not set | Not set | **CABPK default** taint |
223-
| Not set | empty / `[]` | no taints |
216+
| Machine | CABPK | Result for CABPK |
217+
|---------|--------------|-------------------------------------------------------------------------------------------------------------|
218+
| Set | Set | **CABPK** and **Machine** taints, on same key + effect use the value from the Machine defined taint |
219+
| Set | Not set | **CABPK default** and **Machine** taints, on same key + effect use the value from the Machine defined taint |
220+
| Set | empty / `[]` | **Machine** taints |
221+
| Not set | Set | **CABPK** taints |
222+
| Not set | Not set | **CABPK default** taint |
223+
| Not set | empty / `[]` | no taints |
224224

225225
So the desired behavior of the new taints field does not change the behavior for taints configured via CABPK.
226226

@@ -230,8 +230,6 @@ In future CABPK could consider deprecating the related fields and propose using
230230

231231
##### Type definition of a taint in Cluster API objects
232232

233-
**Note:** To reduce verbosity, this proposal does not include all kinds of validation markers.
234-
235233
The following defines a new struct which should be used to define taints at the corresponding API types.
236234
It replicates the upstream `corev1.Taint` specification and extends it by a field called `propagation`, which will define the propagation mechanism to use for the taint.
237235
Using a type definition allows to be extensible and add additional propagation mechanisms when necessary.
@@ -241,14 +239,12 @@ Using a type definition allows to be extensible and add additional propagation m
241239
type MachineTaint struct {
242240
// key is the taint key to be applied to a node.
243241
// +required
244-
// +kubebuilder:validation:Pattern=`^(([a-zA-Z0-9\-\.]+\/)?([a-zA-Z0-9][a-zA-Z0-9\-\._]*))?$`
245242
// +kubebuilder:validation:MinLength=1
246243
// +kubebuilder:validation:MaxLength=253
247244
Key string `json:"key,omitempty"`
248245

249246
// value is the taint value corresponding to the taint key.
250247
// +optional
251-
// +kubebuilder:validation:Pattern=`^([a-zA-Z0-9][a-zA-Z0-9\-\._]*)?$`
252248
// +kubebuilder:validation:MaxLength=63
253249
Value *string `json:"value,omitempty"`
254250

@@ -286,15 +282,20 @@ const (
286282
)
287283
```
288284

289-
Proper validations on the new field has to ensure that no taint with a key of `node.cluster.x-k8s.io/uninitialized` or `node.cluster.x-k8s.io/outdated-revision` is getting added, because these taints are managed by Cluster API and providers.
285+
Proper validations on the new field has to ensure that:
286+
287+
* the `key` and `value` fields are validated as done in the upstream node validation
288+
[3](https://github.com/kubernetes/kubernetes/blob/51f02aa58a21aca9e3d3b8ac1aaebfbdc1481847/pkg/apis/core/validation/validation.go#L6879)
289+
[4](https://github.com/kubernetes/kubernetes/blob/51f02aa58a21aca9e3d3b8ac1aaebfbdc1481847/pkg/apis/core/validation/validation.go#L6881).
290+
* no taint with a key of `node.cluster.x-k8s.io/uninitialized` or `node.cluster.x-k8s.io/outdated-revision` is getting added, because these taints are managed by Cluster API and providers.
291+
* no taint with a prefix of `node.kubernetes.io/` is getting added, because these taints are managed by Kubernetes.
292+
290293
If in the future we are introducing new taints that users should not be able to set, ratcheting may be used.
291294

292295
**Note:** Other taints normally set by kubeadm should be able to get set by Cluster API too and not be blocked on to allow more flexibility and use-cases.
293296

294297
##### Changes to the Machine, MachineSet, MachineDeployment and MachinePool resources via MachineSpec
295298

296-
**Note:** To reduce verbosity, this proposal does not include all kinds of required validation markers.
297-
298299
This proposes to add a field array to the `MachineSpec` struct.
299300
This implicitly leads to adding the field to the following types:
300301

@@ -343,12 +344,12 @@ The following table summarizes the new fields:
343344

344345
The propagation of the fields should follow the prior art and is summarized in the following table and picture:
345346

346-
| ClusterClass | Cluster | Result |
347-
|--------------|---------|----------------------------------------------------------------------------------------------------------------------------------------------------|
348-
| Set | Set | Merge **ClusterClass** and **Cluster** taints (like for labels and annotations), on same key + effect use the value from the Cluster defined taint |
349-
| Set | Not set | **ClusterClass** taints |
350-
| Not set | Set | **Cluster** taints |
351-
| Not set | Not set | No taints from ClusterClass or Cluster |
347+
| ClusterClass | Cluster | Result |
348+
|--------------|---------|------------------------------------------------------|
349+
| Set | Set | **Cluster** taints (ClusterClass taints are ignored) |
350+
| Set | Not set | **ClusterClass** taints |
351+
| Not set | Set | **Cluster** taints |
352+
| Not set | Not set | No taints from ClusterClass or Cluster |
352353

353354
![propagation of taints across a topology Cluster](./images/propagate-taints/topology-propagation.excalidraw.png)
354355

0 commit comments

Comments
 (0)