Skip to content

Commit dd1a6b9

Browse files
mattia-eleuterimyasnikovdaniil
authored andcommitted
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 aeaedca commit dd1a6b9

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
@@ -588,7 +588,7 @@ metadata:
588588
namespace: {{ $.Release.Namespace }}
589589
spec:
590590
clusterName: {{ $.Release.Name }}
591-
maxUnhealthy: 0
591+
maxUnhealthy: {{ $group.maxUnhealthy | default "100%" | quote }}
592592
nodeStartupTimeout: 10m
593593
selector:
594594
matchLabels:

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"instanceType": "u1.medium",
2727
"kubelet": {},
2828
"maxReplicas": 10,
29+
"maxUnhealthy": "100%",
2930
"minReplicas": 0,
3031
"resources": {},
3132
"roles": [
@@ -122,6 +123,11 @@
122123
"type": "integer",
123124
"default": 10
124125
},
126+
"maxUnhealthy": {
127+
"description": "Max unhealthy nodes (integer or percentage) tolerated before the MachineHealthCheck stops auto-remediation.",
128+
"type": "string",
129+
"default": "100%"
130+
},
125131
"minReplicas": {
126132
"description": "Minimum number of replicas.",
127133
"type": "integer",

‎packages/apps/kubernetes/values.yaml‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ storageClass: replicated
7979
## @typedef {struct} NodeGroup - Worker node group configuration.
8080
## @field {int} minReplicas=0 - Minimum number of replicas.
8181
## @field {int} maxReplicas=10 - Maximum number of replicas.
82+
## @field {string} [maxUnhealthy]="100%" - Max unhealthy nodes (integer or percentage) tolerated before the MachineHealthCheck stops auto-remediation.
8283
## @field {string} instanceType="u1.medium" - Virtual machine instance type.
8384
## @x-cozystack-options {source: instancetype}
8485
## @field {quantity} diskSize="20Gi" - Persistent disk size for kubelet and containerd data.
@@ -94,6 +95,7 @@ nodeGroups:
9495
md0:
9596
minReplicas: 0
9697
maxReplicas: 10
98+
maxUnhealthy: "100%"
9799
instanceType: "u1.medium"
98100
diskSize: 20Gi
99101
storageClass: ""

0 commit comments

Comments
 (0)