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 in helpers file #628

Merged
merged 10 commits into from
Mar 20, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ Create user custom defined secret envs
{{- end }}
{{- end }}

{{/*
Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs
*/}}
{{- define "fido2.customJavaOptions"}}
{{ $custom := "" }}
{{ $custom = printf "%s" .Values.global.fido2.gluuCustomJavaOptions }}
{{ $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 -DCN_IDP_HOST=http://oxshibboleth:8080" $custom (printf "%s %s" $maxDirectMemory $xmx) -}}
{{ $customJavaOptions | trimSuffix " " | quote }}
{{- end }}

{{/*
Create topologySpreadConstraints lists
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ spec:
runAsNonRoot: true
{{- end }}
env:
- name: GLUU_JAVA_OPTIONS
value: {{ include "fido2.customJavaOptions" . | trim }}
{{- include "fido2.usr-envs" . | indent 12 }}
{{- include "fido2.usr-secret-envs" . | indent 12 }}
{{- if and (eq .Values.global.isDomainRegistered "false") (or (eq .Values.global.storageClass.provisioner "kubernetes.io/aws-ebs") (eq .Values.global.storageClass.provisioner "openebs.io/local")) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ Create user custom defined secret envs
{{- end }}
{{- end }}

{{/*
Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs
*/}}
{{- define "oxauth.customJavaOptions"}}
{{ $custom := "" }}
{{ $custom = printf "%s" .Values.global.oxauth.gluuCustomJavaOptions }}
{{ $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 -DCN_IDP_HOST=http://oxshibboleth:8080" $custom (printf "%s %s" $maxDirectMemory $xmx) -}}
{{ $customJavaOptions | trimSuffix " " | quote }}
{{- end }}

{{/*
Create topologySpreadConstraints lists
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ spec:
runAsNonRoot: true
{{- end }}
env:
- name: GLUU_JAVA_OPTIONS
value: {{ include "oxauth.customJavaOptions" . | trim }}
{{- include "oxauth.usr-envs" . | indent 12 }}
{{- include "oxauth.usr-secret-envs" . | indent 12 }}
{{- if or (eq .Values.global.storageClass.provisioner "kubernetes.io/aws-ebs") (eq .Values.global.storageClass.provisioner "openebs.io/local") ( .Values.customScripts) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,20 @@ Create user custom defined secret envs
{{- end }}
{{- end }}

{{/*
Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs
*/}}
{{- define "oxd-server.customJavaOptions"}}
{{ $custom := "" }}
{{- $gluuCustomJavaOptions := index .Values.global "oxd-server" "gluuCustomJavaOptions" }}
{{- $custom := printf "%s" $gluuCustomJavaOptions }}
{{ $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 -DCN_IDP_HOST=http://oxshibboleth:8080" $custom (printf "%s %s" $maxDirectMemory $xmx) -}}
{{ $customJavaOptions | trimSuffix " " | quote }}
{{- end }}

{{/*
Create topologySpreadConstraints lists
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ spec:
runAsNonRoot: true
{{- end }}
env:
- name: GLUU_JAVA_OPTIONS
value: {{ include "oxd-server.customJavaOptions" . | trim }}
{{- include "oxd-server.usr-envs" . | indent 12 }}
{{- include "oxd-server.usr-secret-envs" . | indent 12 }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ Create user custom defined secret envs
Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs
*/}}
{{- define "oxshibboleth.detailedLogs"}}
{{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}}
{{ $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" $memory -}}
{{ $xmx := printf "-Xmx%dm" (sub $memory 300) -}}
{{ $ldap := "" }}
{{ $messages := "" }}
{{ $encryption := "" }}
Expand All @@ -81,9 +84,7 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs
{{ $container := "" }}
{{ $xmlsec := "" }}
{{ $custom := "" }}
{{- if .Values.global.oxshibboleth.gluuCustomJavaOptions }}
{{ $custom = printf "%s " .Values.global.oxshibboleth.gluuCustomJavaOptions }}
{{- end}}
{{- if .Values.global.oxshibboleth.appLoggers.ldapLogLevel }}
{{ $ldap = printf "-Didp.loglevel.ldap=%s " .Values.global.oxshibboleth.appLoggers.ldapLogLevel }}
{{- end}}
Expand Down Expand Up @@ -112,7 +113,7 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs
{{ $xmlsec = printf "-Didp.loglevel.xmlsec=%s " .Values.global.oxshibboleth.appLoggers.xmlsecLogLevel }}
{{- end}}

{{ $detailLogs := printf "%s%s%s%s%s%s%s%s%s%s" $custom $ldap $messages $encryption $opensaml $props $httpclient $spring $container $xmlsec }}
{{ $detailLogs := printf "%s%s%s%s%s%s%s%s%s%s %s %s" $custom $ldap $messages $encryption $opensaml $props $httpclient $spring $container $xmlsec $maxDirectMemory $xmx }}
{{ $detailLogs | trimSuffix " " | quote }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs
*/}}
{{- define "oxtrust.customJavaOptions"}}
{{ $custom := "" }}
{{- if .Values.global.oxtrust.gluuCustomJavaOptions }}
{{ $custom = printf "%s" .Values.global.oxtrust.gluuCustomJavaOptions }}
{{- end}}
{{ $customJavaOptions := printf "%s -DCN_IDP_HOST=http://oxshibboleth:8080" $custom }}
{{ $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 -DCN_IDP_HOST=http://oxshibboleth:8080" $custom (printf "%s %s" $maxDirectMemory $xmx) -}}
{{ $customJavaOptions | trimSuffix " " | quote }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ Create user custom defined secret envs
{{- end }}
{{- end }}

{{/*
Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs
*/}}
{{- define "scim.customJavaOptions"}}
{{ $custom := "" }}
{{ $custom = printf "%s" .Values.global.scim.gluuCustomJavaOptions }}
{{ $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 -DCN_IDP_HOST=http://oxshibboleth:8080" $custom (printf "%s %s" $maxDirectMemory $xmx) -}}
{{ $customJavaOptions | trimSuffix " " | quote }}
{{- end }}

{{/*
Create topologySpreadConstraints lists
*/}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ spec:
runAsNonRoot: true
{{- end }}
env:
- name: GLUU_JAVA_OPTIONS
value: {{ include "scim.customJavaOptions" . | trim }}
{{- include "scim.usr-envs" . | indent 12 }}
{{- include "scim.usr-secret-envs" . | indent 12 }}
{{- if or (eq .Values.global.storageClass.provisioner "kubernetes.io/aws-ebs") (eq .Values.global.storageClass.provisioner "openebs.io/local") ( .Values.customScripts) }}
Expand Down
12 changes: 10 additions & 2 deletions pygluu/kubernetes/templates/helm/gluu/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ global:
oxauth:
# -- Boolean flag to enable/disable oxauth chart. You should never set this to false.
enabled: true
# -- passing custom java options to oxauth. Notice you do not need to pass in any loggers optoins as they are introduced below in appLoggers. DO NOT PASS GLUU_JAVA_OPTIONS in envs.
moabu marked this conversation as resolved.
Show resolved Hide resolved
gluuCustomJavaOptions: ""
# -- App loggers can be configured to define where the logs will be redirected to and the level of each in which it should be displayed.
# log levels are "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"
# Targets are "STDOUT" and "FILE"
Expand Down Expand Up @@ -176,6 +178,8 @@ global:
fido2:
# -- Boolean flag to enable/disable the fido2 chart.
enabled: false
# -- passing custom java options to fido2. Notice you do not need to pass in any loggers optoins as they are introduced below in appLoggers. DO NOT PASS GLUU_JAVA_OPTIONS in envs.
gluuCustomJavaOptions: ""
# -- App loggers can be configured to define where the logs will be redirected to and the level of each in which it should be displayed.
# log levels are "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"
# Targets are "STDOUT" and "FILE"
Expand All @@ -193,6 +197,8 @@ global:
scim:
# -- Boolean flag to enable/disable the SCIM chart.
enabled: false
# -- passing custom java options to scim. Notice you do not need to pass in any loggers optoins as they are introduced below in appLoggers. DO NOT PASS GLUU_JAVA_OPTIONS in envs.
gluuCustomJavaOptions: ""
# -- App loggers can be configured to define where the logs will be redirected to and the level of each in which it should be displayed.
# log levels are "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"
# Targets are "STDOUT" and "FILE"
Expand Down Expand Up @@ -237,7 +243,7 @@ global:
oxtrust:
# -- Boolean flag to enable/disable the oxtrust chart.
enabled: true
# -- passing custom java options to oxTrust.
# -- passing custom java options to oxTrust. Notice you do not need to pass in any loggers options as they are introduced below in appLoggers. DO NOT PASS GLUU_JAVA_OPTIONS in envs.
gluuCustomJavaOptions: "-XshowSettings:vm -XX:MaxRAMPercentage=80"
# -- App loggers can be configured to define where the logs will be redirected to and the level of each in which it should be displayed.
# log levels are "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"
Expand Down Expand Up @@ -299,7 +305,7 @@ global:
oxshibboleth:
# -- Boolean flag to enable/disable the oxShibbboleth chart.
enabled: false
# -- passing custom java options to oxShibboleth. Notice you do not need to pass in any loggers optoins as they are introduced below in appLoggers.
# -- passing custom java options to oxShibboleth. Notice you do not need to pass in any loggers optoins as they are introduced below in appLoggers. DO NOT PASS GLUU_JAVA_OPTIONS in envs.
gluuCustomJavaOptions: ""
# -- App loggers can be configured to define where the logs will be redirected to and the level of each in which it should be displayed.
# log levels are "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"
Expand Down Expand Up @@ -337,6 +343,8 @@ global:
oxd-server:
# -- Boolean flag to enable/disable the oxd-server chart.
enabled: true
# -- passing custom java options to oxShibboleth. Notice you do not need to pass in any loggers optoins as they are introduced below in appLoggers. DO NOT PASS GLUU_JAVA_OPTIONS in envs.
gluuCustomJavaOptions: ""
# -- App loggers can be configured to define where the logs will be redirected to and the level of each in which it should be displayed.
# log levels are "OFF", "FATAL", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"
# Targets are "STDOUT" and "FILE"
Expand Down
Loading