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
{{ message }}
Repository navigation
Commit 937a27b
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: packages/apps/kubernetes/templates/cluster.yaml
+22-4Lines changed: 22 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -251,14 +251,25 @@ metadata:
251
251
{{- else }}
252
252
{{- fail (printf "nodeGroup %s: evictionHardMemory and evictionSoftMemory must use the same unit type (both percentage or both absolute) — got evictionHardMemory=%s, evictionSoftMemory=%s" $groupName $evictionHardMemory $evictionSoftMemory) }}
253
253
{{- end }}
254
-
{{/* Validate that reserved memory does not exceed effective node memory */}}
254
+
{{/* Resolve eviction hard threshold to bytes for arithmetic.
255
+
Percentage is relative to effective node memory; absolute values are used as-is. */}}
{{- $effectiveMemBytes := include "cozy-lib.resources.toFloat" $effectiveMemory | float64 }}
260
271
{{- if ge $totalReservedBytes $effectiveMemBytes }}
261
-
{{- fail (printf "nodeGroup %s: total reserved memory (systemReservedMemory=%s + kubeReservedMemory=%s) must be less than effective node memory (%s)" $groupName $systemReservedMemory $kubeReservedMemory $effectiveMemory) }}
272
+
{{- fail (printf "nodeGroup %s: total reserved memory (systemReservedMemory=%s + kubeReservedMemory=%s + evictionHardMemory=%s) must be less than effective node memory (%s)" $groupName $systemReservedMemory $kubeReservedMemory $evictionHardMemory $effectiveMemory) }}
Copy file name to clipboardExpand all lines: packages/apps/kubernetes/tests/kubelet-reservation_test.yaml
+9-8Lines changed: 9 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -429,9 +429,9 @@ tests:
429
429
resources:
430
430
memory: "512Mi"
431
431
asserts:
432
-
# 512Mi, 5% = 25Mi, but floor is 256Mi -> 256Mi+256Mi = 512Mi >= 512Mi -> fails validation
432
+
# 512Mi, 5% = 25Mi, but floor is 256Mi -> 256Mi+256Mi+7%eviction(35Mi) = 547Mi > 512Mi -> fails validation
433
433
- failedTemplate:
434
-
errorMessage: "nodeGroup md0: total reserved memory (systemReservedMemory=256Mi + kubeReservedMemory=256Mi) must be less than effective node memory (512Mi)"
434
+
errorMessage: "nodeGroup md0: total reserved memory (systemReservedMemory=256Mi + kubeReservedMemory=256Mi + evictionHardMemory=7%) must be less than effective node memory (512Mi)"
errorMessage: "nodeGroup md0: total reserved memory (systemReservedMemory=512Mi + kubeReservedMemory=600Mi) must be less than effective node memory (1Gi)"
1045
+
errorMessage: "nodeGroup md0: total reserved memory (systemReservedMemory=512Mi + kubeReservedMemory=600Mi + evictionHardMemory=7%) must be less than effective node memory (1Gi)"
1045
1046
1046
1047
- it: rejects reserved memory equal to effective node memory
errorMessage: "nodeGroup md0: total reserved memory (systemReservedMemory=512Mi + kubeReservedMemory=512Mi) must be less than effective node memory (1Gi)"
1074
+
errorMessage: "nodeGroup md0: total reserved memory (systemReservedMemory=512Mi + kubeReservedMemory=512Mi + evictionHardMemory=7%) must be less than effective node memory (1Gi)"
1073
1075
1074
1076
- it: allows reserved memory within effective node memory bounds
1075
1077
release:
@@ -1109,7 +1111,7 @@ tests:
1109
1111
# Eviction thresholds interaction with explicit reservations
0 commit comments