Skip to content

Commit 202beef

Browse files
committed
tweak: ensure max ram is limited to 100%
1 parent 3fd5ec4 commit 202beef

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

ignition/templates/_helpers.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Assumes that "ignition.gateway.useMaxRAMPercentage" has already been checked.
195195
{{- end -}}
196196
{{- end -}}
197197

198-
{{- printf "%v" $maxRAMPercentage }}
198+
{{- printf "%v" (int (min $maxRAMPercentage 100)) }}
199199
{{- end }}
200200

201201
{{/*

ignition/tests/helpers_test.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,25 @@ tests:
213213
- contains:
214214
path: data["gateway.jvmArgs"]
215215
content: -XX:InitialRAMPercentage=60
216+
- it: check gateway.maxRAMPercentage over 100
217+
set:
218+
gateway.maxRAMPercentage: 150
219+
asserts:
220+
- contains:
221+
path: data["gateway.jvmArgs"]
222+
content: -XX:InitialRAMPercentage=100
223+
- it: check gateway.maxRAMPercentage negative value
224+
set:
225+
gateway.maxRAMPercentage: -1
226+
gateway.resourcesEnabled: false
227+
asserts:
228+
- equal:
229+
path: data["gateway.useMaxRAMPercentage"]
230+
value: false
231+
- notExists :
232+
path: data["gateway.jvmArgs"]
233+
- notExists:
234+
path: data["gateway.wrapperArgs"]
216235
- it: check gateway.maxRAMPercentage of auto with resources disabled
217236
set:
218237
gateway.maxRAMPercentage: "auto"

0 commit comments

Comments
 (0)