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
+23-9Lines changed: 23 additions & 9 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,17 +131,30 @@ 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:
139
+
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.**Limit parking**: If the number of eligible nodes exceeds available slots, only the first `availableSlots` nodes are parked
146
+
5.**Skip if full**: If no slots are available (currentlyParked >= limit), parking is skipped for that eviction interval
140
147
141
148
**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
149
+
-`MaxParkedNodes: "0"` (default): No limit, all eligible nodes are parked
150
+
-`MaxParkedNodes: "5"`: Maximum 5 nodes can be parked at any time
151
+
-`MaxParkedNodes: "20%"`: Maximum 20% of total cluster nodes can be parked (e.g., 2 nodes in a 10-node cluster)
152
+
- Invalid values (e.g., `"-1"`, `"invalid"`): Treated as 0 (no limit) with a warning logged
153
+
154
+
**Percentage Benefits:**
155
+
-**Dynamic scaling**: Limit automatically adjusts as cluster size changes
156
+
-**Proportional safety**: Maintains a consistent percentage of available capacity regardless of cluster size
157
+
-**Auto-scaling friendly**: Works well with cluster auto-scaling by recalculating limits each cycle
145
158
146
159
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.
147
160
@@ -150,6 +163,7 @@ This limit applies to both Karpenter drift detection and node label detection fe
150
163
-**Resource management**: Prevent excessive resource pressure from too many parked nodes
151
164
-**Application stability**: Ensure applications have sufficient capacity during node transitions
152
165
-**Cost optimization**: Balance between node replacement speed and cluster stability
166
+
-**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
Copy file name to clipboardExpand all lines: pkg/config/config.go
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -49,8 +49,11 @@ type Config struct {
49
49
EnableNodeLabelDetectionbool
50
50
// NodeLabelsToDetect is a list of node labels to look for. Can be just keys or key=value pairs
51
51
NodeLabelsToDetect []string
52
-
// MaxParkedNodes is the maximum number of nodes that can be parked simultaneously. If set to 0 (default), no limit is applied.
53
-
MaxParkedNodesint
52
+
// MaxParkedNodes is the maximum number of nodes that can be parked simultaneously.
53
+
// Can be either an integer (e.g. "5") or a percentage (e.g. "20%").
54
+
// If set to "0" or empty (default), no limit is applied.
55
+
// When a percentage is specified, the limit is calculated as (percentage/100) * (total nodes in cluster).
56
+
MaxParkedNodesstring
54
57
// ExtraParkingLabels is a map of additional labels to apply to nodes and pods during the parking process. If not set, no extra labels are applied.
55
58
ExtraParkingLabelsmap[string]string
56
59
// EvictionSafetyCheck controls whether to perform safety checks before force eviction. If true, nodes will be unparked if pods don't have required parking labels.
0 commit comments