Skip to content

Commit 575e617

Browse files
authored
Merge pull request #13308 from LiangquanLi930/from-zero
📖 Update autoscaling from zero enhancement proposal with node labels and taints configuration clarification
2 parents eaf086b + d00d6e8 commit 575e617

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

docs/proposals/20210310-opt-in-autoscaling-from-zero.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ I can utilize this feature until my infrastructure provider has completed updati
140140

141141
### Implementation Details/Notes/Constraints
142142

143-
There are 2 methods described for informing the cluster autoscaler about the resource needs of the
143+
There are 2 methods described for informing the cluster autoscaler about the properties of the
144144
nodes in each node group: through a status field on Infrastructure Machine Templates, and through
145145
annotations on MachineSets or MachineDeployments. The first method requires updates to a infrastructure provider's
146146
controllers and will require more coordination between developers and users. The second method
@@ -277,14 +277,28 @@ metadata:
277277
capacity.cluster-autoscaler.kubernetes.io/memory: "500mb"
278278
capacity.cluster-autoscaler.kubernetes.io/cpu: "1"
279279
capacity.cluster-autoscaler.kubernetes.io/ephemeral-disk: "100Gi"
280+
capacity.cluster-autoscaler.kubernetes.io/labels: "kubernetes.io/arch=amd64,kubernetes.io/os=linux"
280281
```
281282
_Note: the annotations will be defined in the cluster autoscaler, not in cluster-api._
282283

283284
**Node Labels and Taints**
284285

285-
When a user would like to signal that the node being created from a MachineSet or
286-
MachineDeployment will have specific taints or labels on it, they can use the following
287-
annotations to specify that information.
286+
Users may specify node labels and taints through the following mechanisms:
287+
288+
1. **MachineSet or MachineDeployment labels** - Labels with the `node.cluster.x-k8s.io/` prefix in `spec.template.spec.metadata.labels` will be propagated to Nodes per CAPI's [metadata propagation](https://cluster-api.sigs.k8s.io/reference/api/metadata-propagation) behavior.
289+
290+
```
291+
kind: <MachineSet or MachineDeployment>
292+
spec:
293+
template:
294+
spec:
295+
metadata:
296+
labels:
297+
node.cluster.x-k8s.io/key1: "value1"
298+
node.cluster.x-k8s.io/key2: "value2"
299+
```
300+
301+
2. **Capacity annotations** - For explicit control or overrides:
288302

289303
```
290304
kind: <MachineSet or MachineDeployment>
@@ -294,10 +308,9 @@ metadata:
294308
capacity.cluster-autoscaler.kubernetes.io/taints: "key1=value1:NoSchedule,key2=value2:NoExecute"
295309
```
296310

297-
If the `capacity.cluster-autoscaler.kubernetes.io/labels` annotation specifies a label that would otherwise be
298-
generated from the fields in the `status` field of the Machine Template, the autoscaler will prioritize and use
299-
the label defined in the annotation. This means any label set by the annotation will override the corresponding
300-
value provided by the infrastructure provider in the Machine Template status.
311+
When multiple sources provide labels, the following precedence applies (highest to lowest):
312+
1. `capacity.cluster-autoscaler.kubernetes.io/labels` annotation
313+
2. MachineSet or MachineDeployment labels (CAPI managed prefix applied)
301314

302315
For example, assume the following objects
303316

0 commit comments

Comments
 (0)