Skip to content
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

feat: add java memory arguments #8115

Merged
merged 6 commits into from
Mar 26, 2024
Merged

feat: add java memory arguments #8115

merged 6 commits into from
Mar 26, 2024

Conversation

misba7
Copy link
Contributor

@misba7 misba7 commented Mar 21, 2024

closes #8114

Signed-off-by: Amro Misbah <amromisba7@gmail.com>
@mo-auto mo-auto added comp-charts-jans kind-feature Issue or PR is a new feature request labels Mar 21, 2024
Signed-off-by: Amro Misbah <amromisba7@gmail.com>
charts/janssen/values.yaml Outdated Show resolved Hide resolved
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) -}}
Copy link
Contributor

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 }}
Copy link
Contributor

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>
@moabu moabu merged commit 044290a into main Mar 26, 2024
1 of 2 checks passed
@moabu moabu deleted the feat-jans-javaargs branch March 26, 2024 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-charts-jans kind-feature Issue or PR is a new feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: add java memory arguments to java-based services
4 participants