-
Notifications
You must be signed in to change notification settings - Fork 85
feat: add java memory arguments #8115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: Amro Misbah <amromisba7@gmail.com>
Signed-off-by: Amro Misbah <amromisba7@gmail.com>
Signed-off-by: Amro Misbah <amromisba7@gmail.com>
{{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}} | ||
{{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" $memory -}} | ||
{{- $xmx := printf "-Xmx%dm" (sub $memory 300) -}} | ||
{{- $customJavaOptions := printf "%s %s " $custom (printf "%s %s" $maxDirectMemory $xmx) -}} |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line can be simplified into:
{{- $customJavaOptions := printf "%s %s %s" $custom $maxDirectMemory $xmx -}}
{{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" $memory -}} | ||
{{- $xmx := printf "-Xmx%dm" (sub $memory 300) -}} | ||
{{- $customJavaOptions := printf "%s %s " $custom (printf "%s %s" $maxDirectMemory $xmx) -}} | ||
{{ $customJavaOptions | trimSuffix " " | quote }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If cnCustomJavaOptions
is set to empty string, the generated YAML would be:
- name: CN_AUTH_JAVA_OPTIONS
value: " -XX:MaxDirectMemorySize=2500m -Xmx2200m"
Notice the leading whitespace.
It's better to use trim
instead of trimSuffix
to remove leading and trailing whitespaces.
Signed-off-by: Amro Misbah <amromisba7@gmail.com>
Signed-off-by: Amro Misbah <amromisba7@gmail.com>
closes #8114