You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+35-11Lines changed: 35 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,7 @@ The following options can be used to customize the k8s-shredder controller:
58
58
| ParkedNodeTaint | "shredder.ethos.adobe.net/upgrade-status=parked:NoSchedule" | Taint to apply to parked nodes in format key=value:effect|
59
59
| EnableNodeLabelDetection | false | Controls whether to scan for nodes with specific labels and automatically park them |
60
60
| NodeLabelsToDetect |[]| List of node labels to detect. Supports both key-only and key=value formats |
61
-
| MaxParkedNodes |0| Maximum number of nodes that can be parked simultaneously. Set to 0 (default) for no limit. |
61
+
| MaxParkedNodes |"0"| Maximum number of nodes that can be parked simultaneously. Can be an integer (e.g., "5") or percentage (e.g., "20%"). Set to "0" (default) for no limit.|
62
62
| ExtraParkingLabels | {} | (Optional) Map of extra labels to apply to nodes and pods during parking. Example: `{ "example.com/owner": "infrastructure" }`|
63
63
| EvictionSafetyCheck | true | Controls whether to perform safety checks before force eviction. If true, nodes will be unparked if pods don't have required parking labels. |
64
64
| ParkingReasonLabel | "shredder.ethos.adobe.net/parked-reason" | Label used to track why a node or pod was parked (values: node-label, karpenter-drifted, karpenter-disrupted) |
@@ -131,25 +131,49 @@ This integration allows k8s-shredder to automatically handle node lifecycle mana
131
131
132
132
k8s-shredder supports limiting the maximum number of nodes that can be parked simultaneously using the `MaxParkedNodes` configuration option. This feature helps prevent overwhelming the cluster with too many parked nodes at once, which could impact application availability.
133
133
134
-
When `MaxParkedNodes` is set to a positive integer:
134
+
`MaxParkedNodes` can be specified as either:
135
+
-**Integer value** (e.g., `"5"`): Absolute maximum number of nodes that can be parked
136
+
-**Percentage value** (e.g., `"20%"`): Maximum percentage of total cluster nodes that can be parked (calculated dynamically each cycle)
135
137
136
-
1.**Before parking nodes**: k8s-shredder counts the number of currently parked nodes
137
-
2.**Calculate available slots**: `availableSlots = MaxParkedNodes - currentlyParked`
138
-
3.**Limit parking**: If the number of eligible nodes exceeds available slots, only the first `availableSlots` nodes are parked
139
-
4.**Skip if full**: If no slots are available (currentlyParked >= MaxParkedNodes), parking is skipped for that eviction interval
138
+
When `MaxParkedNodes` is set to a non-zero value:
140
139
141
-
**Examples:**
142
-
-`MaxParkedNodes: 0` (default): No limit, all eligible nodes are parked
143
-
-`MaxParkedNodes: 5`: Maximum 5 nodes can be parked at any time
144
-
-`MaxParkedNodes: -1`: Invalid value, treated as 0 (no limit) with a warning logged
140
+
1.**Parse the limit**: The configuration is parsed to determine the actual limit
2.**Count parked nodes**: k8s-shredder counts the number of currently parked nodes
144
+
3.**Calculate available slots**: `availableSlots = limit - currentlyParked`
145
+
4.**Sort by age**: Eligible nodes are sorted by creation timestamp (oldest first) to ensure predictable parking order
146
+
5.**Limit parking**: If the number of eligible nodes exceeds available slots, only the oldest `availableSlots` nodes are parked
147
+
6.**Skip if full**: If no slots are available (currentlyParked >= limit), parking is skipped for that eviction interval
145
148
146
-
This limit applies to both Karpenter drift detection and node label detection features. When multiple nodes are eligible for parking but the limit would be exceeded, k8s-shredder will park the nodes in the order they are discovered and skip the remaining nodes until the next eviction interval.
149
+
**Examples:**
150
+
-`MaxParkedNodes: "0"` (default): No limit, all eligible nodes are parked
151
+
-`MaxParkedNodes: "5"`: Maximum 5 nodes can be parked at any time
152
+
-`MaxParkedNodes: "20%"`: Maximum 20% of total cluster nodes can be parked (e.g., 2 nodes in a 10-node cluster)
153
+
- Invalid values (e.g., `"-1"`, `"invalid"`): Treated as 0 (no limit) with a warning logged
154
+
155
+
**Percentage Benefits:**
156
+
-**Dynamic scaling**: Limit automatically adjusts as cluster size changes
157
+
-**Proportional safety**: Maintains a consistent percentage of available capacity regardless of cluster size
158
+
-**Auto-scaling friendly**: Works well with cluster auto-scaling by recalculating limits each cycle
159
+
160
+
**Predictable Parking Order:**
161
+
Eligible nodes are **always sorted by creation timestamp (oldest first)**, regardless of whether `MaxParkedNodes` is set. This ensures:
162
+
-**Consistent behavior**: The same nodes will be parked first across multiple eviction cycles
163
+
-**Fair rotation**: Oldest nodes are prioritized for replacement during rolling upgrades
164
+
-**Predictable capacity**: You can anticipate which nodes will be parked next when slots become available
165
+
-**Deterministic ordering**: Even when parking all eligible nodes (no limit), they are processed in a predictable order
166
+
167
+
This sorting behavior applies to both Karpenter drift detection and node label detection features. When multiple nodes are eligible for parking:
168
+
-**With no limit** (`MaxParkedNodes: "0"`): All nodes are parked in order from oldest to newest
169
+
-**With a limit**: Only the oldest nodes up to the limit are parked; newer nodes wait for the next eviction interval
147
170
148
171
**Use cases:**
149
172
-**Gradual node replacement**: Control the pace of node cycling during cluster upgrades
150
173
-**Resource management**: Prevent excessive resource pressure from too many parked nodes
151
174
-**Application stability**: Ensure applications have sufficient capacity during node transitions
152
175
-**Cost optimization**: Balance between node replacement speed and cluster stability
176
+
-**Auto-scaling clusters**: Use percentage-based limits to maintain consistent safety margins as cluster size changes
@@ -74,7 +74,7 @@ a novel way of dealing with kubernetes nodes blocked from draining
74
74
| shredder.EvictionSafetyCheck | bool |`true`| Controls whether to perform safety checks before force eviction |
75
75
| shredder.ExpiresOnLabel | string |`"shredder.ethos.adobe.net/parked-node-expires-on"`| Label used to track when a parked node expires |
76
76
| shredder.ExtraParkingLabels | object |`{}`| Additional labels to apply to nodes and pods during parking |
77
-
| shredder.MaxParkedNodes |int|`0`| Maximum number of nodes that can be parked simultaneously (0 = no limit)|
77
+
| shredder.MaxParkedNodes |string|`"0"`| Maximum number of nodes that can be parked simultaneously. Can be an integer (e.g., "5") or percentage (e.g., "20%"). Set to "0" for no limit |
78
78
| shredder.NamespacePrefixSkipInitialEviction | string |`"ns-ethos-"`| Namespace prefix to skip during initial eviction (useful for system namespaces) |
79
79
| shredder.NodeLabelsToDetect | list |`[]`| List of node labels to monitor for triggering shredder actions |
80
80
| shredder.ParkedByLabel | string |`"shredder.ethos.adobe.net/parked-by"`| Label to track which component parked a node |
Copy file name to clipboardExpand all lines: config.yaml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ NodeLabelsToDetect: [] # List of node labels to detect. Supports both key-only
32
32
# - "node.example.com/park" # Matches any node with the "node.example.com/park" label
33
33
34
34
# Parking limits
35
-
MaxParkedNodes: 0# Maximum number of nodes that can be parked simultaneously. Set to 0 (default) for no limit.
35
+
MaxParkedNodes: '0'# Maximum number of nodes that can be parked simultaneously. Can be an integer (e.g., "5") or percentage (e.g., "20%"). Set to "0" (default) for no limit.
36
36
37
37
# Extra labels to apply to parked nodes and pods
38
38
# ExtraParkingLabels: # (optional) Additional labels to apply to nodes and pods during parking
0 commit comments