Skip to content

Commit 960a1fb

Browse files
fix(kubernetes): make MachineHealthCheck maxUnhealthy configurable
The MachineHealthCheck was hardcoded to maxUnhealthy: 0. In Cluster API semantics this blocks all remediation: as soon as a single machine is unhealthy the threshold is exceeded, so crashed worker nodes are never auto-replaced. Expose maxUnhealthy per node group (integer or percentage) with a default of "100%" so auto-remediation works out of the box while staying tunable for sensitive pools. Signed-off-by: mattia-eleuteri <[email protected]>
1 parent 628ebce commit 960a1fb

6 files changed

Lines changed: 16 additions & 4 deletions

File tree

‎api/apps/v1alpha1/kubernetes/types.go‎

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎packages/apps/kubernetes/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ See the reference for components utilized in this service:
105105
| `nodeGroups` | Worker nodes configuration map. | `map[string]object` | `{...}` |
106106
| `nodeGroups[name].minReplicas` | Minimum number of replicas. | `int` | `0` |
107107
| `nodeGroups[name].maxReplicas` | Maximum number of replicas. | `int` | `10` |
108+
| `nodeGroups[name].maxUnhealthy` | Max unhealthy nodes (integer or percentage) tolerated before the MachineHealthCheck stops auto-remediation. | `string` | `100%` |
108109
| `nodeGroups[name].instanceType` | Virtual machine instance type. | `string` | `u1.medium` |
109110
| `nodeGroups[name].diskSize` | Persistent disk size for kubelet and containerd data. | `quantity` | `20Gi` |
110111
| `nodeGroups[name].storageClass` | StorageClass for worker node persistent disks. When empty, uses the management cluster default StorageClass (the one annotated storageclass.kubernetes.io/is-default-class: true). NOTE: deliberately not marked immutable — the field is optional and undefaulted, so a strict `self == oldSelf` rule would block any future attempt to set it on an existing node group. | `string` | `""` |

‎packages/apps/kubernetes/templates/cluster.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ metadata:
576576
namespace: {{ $.Release.Namespace }}
577577
spec:
578578
clusterName: {{ $.Release.Name }}
579-
maxUnhealthy: 0
579+
maxUnhealthy: {{ $group.maxUnhealthy | default "100%" | quote }}
580580
nodeStartupTimeout: 10m
581581
selector:
582582
matchLabels:

‎packages/apps/kubernetes/values.schema.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"instanceType": "u1.medium",
2424
"kubelet": {},
2525
"maxReplicas": 10,
26+
"maxUnhealthy": "100%",
2627
"minReplicas": 0,
2728
"resources": {},
2829
"roles": [
@@ -113,6 +114,11 @@
113114
"type": "integer",
114115
"default": 10
115116
},
117+
"maxUnhealthy": {
118+
"description": "Max unhealthy nodes (integer or percentage) tolerated before the MachineHealthCheck stops auto-remediation.",
119+
"type": "string",
120+
"default": "100%"
121+
},
116122
"minReplicas": {
117123
"description": "Minimum number of replicas.",
118124
"type": "integer",

‎packages/apps/kubernetes/values.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ storageClass: replicated
7777
## @typedef {struct} NodeGroup - Worker node group configuration.
7878
## @field {int} minReplicas=0 - Minimum number of replicas.
7979
## @field {int} maxReplicas=10 - Maximum number of replicas.
80+
## @field {string} [maxUnhealthy]="100%" - Max unhealthy nodes (integer or percentage) tolerated before the MachineHealthCheck stops auto-remediation.
8081
## @field {string} instanceType="u1.medium" - Virtual machine instance type.
8182
## @field {quantity} diskSize="20Gi" - Persistent disk size for kubelet and containerd data.
8283
## @field {string} [storageClass] - StorageClass for worker node persistent disks. When empty, uses the management cluster default StorageClass (the one annotated storageclass.kubernetes.io/is-default-class: true). NOTE: deliberately not marked immutable — the field is optional and undefaulted, so a strict `self == oldSelf` rule would block any future attempt to set it on an existing node group.
@@ -90,6 +91,7 @@ nodeGroups:
9091
md0:
9192
minReplicas: 0
9293
maxReplicas: 10
94+
maxUnhealthy: "100%"
9395
instanceType: "u1.medium"
9496
diskSize: 20Gi
9597
storageClass: ""

0 commit comments

Comments
 (0)