Skip to content

Commit b1d99ab

Browse files
authored
feat: add custom java options for AIO and tolerations (#2030)
Signed-off-by: moabu <47318409+moabu@users.noreply.github.com>
1 parent 442c648 commit b1d99ab

File tree

18 files changed

+249
-29
lines changed

18 files changed

+249
-29
lines changed

charts/gluu-all-in-one/README.md

Lines changed: 11 additions & 3 deletions
Large diffs are not rendered by default.

charts/gluu-all-in-one/templates/_helpers.tpl

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,100 @@ volumeMounts:
202202
{{- end }}
203203
{{- end }}
204204

205+
206+
{{/*
207+
Create JAVA_OPTIONS ENV for passing custom work and detailed logs
208+
*/}}
209+
{{- define "auth-server.customJavaOptions"}}
210+
{{ $custom := "" }}
211+
{{- $cnCustomJavaOptions := index .Values "auth-server" "cnCustomJavaOptions" }}
212+
{{- $custom := printf "%s" $cnCustomJavaOptions }}
213+
{{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}}
214+
{{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" ( mul (mulf $memory 0.25) 1 ) -}}
215+
{{- $xmx := printf "-Xmx%dm" (sub $memory (mulf $memory 0.7)) -}}
216+
{{- $customJavaOptions := printf "%s %s %s" $custom $maxDirectMemory $xmx -}}
217+
{{ $customJavaOptions | trim | quote }}
218+
{{- end }}
219+
220+
{{/*
221+
Create JAVA_OPTIONS ENV for passing custom work and detailed logs
222+
*/}}
223+
{{- define "casa.customJavaOptions"}}
224+
{{ $custom := "" }}
225+
{{ $custom = printf "%s" .Values.casa.cnCustomJavaOptions }}
226+
{{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}}
227+
{{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" ( mul (mulf $memory 0.10) 1 ) -}}
228+
{{- $xmx := printf "-Xmx%dm" (sub $memory (mulf $memory 0.7)) -}}
229+
{{- $customJavaOptions := printf "%s %s %s" $custom $maxDirectMemory $xmx -}}
230+
{{ $customJavaOptions | trim | quote }}
231+
{{- end }}
232+
233+
{{/*
234+
Create JAVA_OPTIONS ENV for passing custom work and detailed logs
235+
*/}}
236+
{{- define "config-api.customJavaOptions"}}
237+
{{ $custom := "" }}
238+
{{- $cnCustomJavaOptions := index .Values "config-api" "cnCustomJavaOptions" }}
239+
{{- $custom := printf "%s" $cnCustomJavaOptions }}
240+
{{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}}
241+
{{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" ( mul (mulf $memory 0.10) 1 ) -}}
242+
{{- $xmx := printf "-Xmx%dm" (sub $memory (mulf $memory 0.7)) -}}
243+
{{- $customJavaOptions := printf "%s %s %s" $custom $maxDirectMemory $xmx -}}
244+
{{ $customJavaOptions | trim | quote }}
245+
{{- end }}
246+
247+
{{/*
248+
Create JAVA_OPTIONS ENV for passing custom work and detailed logs
249+
*/}}
250+
{{- define "fido2.customJavaOptions"}}
251+
{{ $custom := "" }}
252+
{{ $custom = printf "%s" .Values.fido2.cnCustomJavaOptions }}
253+
{{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}}
254+
{{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" ( mul (mulf $memory 0.08) 1 ) -}}
255+
{{- $xmx := printf "-Xmx%dm" (sub $memory (mulf $memory 0.7)) -}}
256+
{{- $customJavaOptions := printf "%s %s %s" $custom $maxDirectMemory $xmx -}}
257+
{{ $customJavaOptions | trim | quote }}
258+
{{- end }}
259+
260+
{{/*
261+
Create JAVA_OPTIONS ENV for passing custom work and detailed logs
262+
*/}}
263+
{{- define "scim.customJavaOptions"}}
264+
{{ $custom := "" }}
265+
{{ $custom = printf "%s" .Values.scim.cnCustomJavaOptions }}
266+
{{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}}
267+
{{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" ( mul (mulf $memory 0.15) 1 ) -}}
268+
{{- $xmx := printf "-Xmx%dm" (sub $memory (mulf $memory 0.7)) -}}
269+
{{- $customJavaOptions := printf "%s %s %s" $custom $maxDirectMemory $xmx -}}
270+
{{ $customJavaOptions | trim | quote }}
271+
{{- end }}
272+
273+
{{/*
274+
Create JAVA_OPTIONS ENV for passing custom work and detailed logs
275+
*/}}
276+
{{- define "link.customJavaOptions"}}
277+
{{ $custom := "" }}
278+
{{ $custom = printf "%s" .Values.link.cnCustomJavaOptions }}
279+
{{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}}
280+
{{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" ( mul (mulf $memory 0.08) 1 ) -}}
281+
{{- $xmx := printf "-Xmx%dm" (sub $memory (mulf $memory 0.7)) -}}
282+
{{- $customJavaOptions := printf "%s %s %s" $custom $maxDirectMemory $xmx -}}
283+
{{ $customJavaOptions | trim | quote }}
284+
{{- end }}
285+
286+
{{/*
287+
Create JAVA_OPTIONS ENV for passing custom work and detailed logs
288+
*/}}
289+
{{- define "saml.customJavaOptions"}}
290+
{{ $custom := "" }}
291+
{{ $custom = printf "%s" .Values.saml.cnCustomJavaOptions }}
292+
{{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}}
293+
{{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" ( mul (mulf $memory 0.10) 1 ) -}}
294+
{{- $xmx := printf "-Xmx%dm" (sub $memory (mulf $memory 0.7)) -}}
295+
{{- $customJavaOptions := printf "%s %s %s" $custom $maxDirectMemory $xmx -}}
296+
{{ $customJavaOptions | trim | quote }}
297+
{{- end }}
298+
205299
{{/*
206300
Obfuscate configuration schema (only if configuration key is available)
207301
*/}}

charts/gluu-all-in-one/templates/deployment.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ spec:
4242
{{- with .Values.image.pullSecrets }}
4343
imagePullSecrets:
4444
{{- toYaml . | nindent 8 }}
45+
{{- end }}
46+
{{- with .Values.tolerations }}
47+
tolerations:
48+
{{- toYaml . | nindent 8 }}
4549
{{- end }}
4650
dnsPolicy: {{ .Values.dnsPolicy | quote }}
4751
{{- with .Values.dnsConfig }}
@@ -58,6 +62,20 @@ spec:
5862
imagePullPolicy: {{ .Values.image.pullPolicy }}
5963
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
6064
env:
65+
- name: CN_AUTH_JAVA_OPTIONS
66+
value: {{ include "auth-server.customJavaOptions" . | trim }}
67+
- name: CN_FIDO2_JAVA_OPTIONS
68+
value: {{ include "fido2.customJavaOptions" . | trim }}
69+
- name: CN_CASA_JAVA_OPTIONS
70+
value: {{ include "casa.customJavaOptions" . | trim }}
71+
- name: CN_CONFIG_API_JAVA_OPTIONS
72+
value: {{ include "config-api.customJavaOptions" . | trim }}
73+
- name: CN_SAML_JAVA_OPTIONS
74+
value: {{ include "saml.customJavaOptions" . | trim }}
75+
- name: CN_SCIM_JAVA_OPTIONS
76+
value: {{ include "scim.customJavaOptions" . | trim }}
77+
- name: CN_LINK_JAVA_OPTIONS
78+
value: {{ include "link.customJavaOptions" . | trim }}
6179
{{- include "flex-all-in-one.usr-envs" . | indent 12 }}
6280
{{- include "flex-all-in-one.usr-secret-envs" . | indent 12 }}
6381
securityContext:

charts/gluu-all-in-one/values.yaml

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ persistence:
165165
# -- Boolean flag to enable/disable the persistence job.
166166
enabled: true
167167

168-
168+
# -- Add tolerations for the pods
169+
tolerations: []
169170

170171

171172
alb:
@@ -175,6 +176,8 @@ alb:
175176
auth-server:
176177
# -- Boolean flag to enable/disable auth-server chart. You should never set this to false.
177178
enabled: true
179+
# -- passing custom java options to auth-server. Notice you do not need to pass in any loggers options as they are introduced below in appLoggers. DO NOT PASS JAVA_OPTIONS in envs.
180+
cnCustomJavaOptions: ""
178181
# -- 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.
179182
appLoggers:
180183
# -- Enable log prefixing which enables prepending the STDOUT logs with the file name. i.e auth-server-script ===> 2022-12-20 17:49:55,744 INFO
@@ -343,6 +346,7 @@ auth-server-key-rotation:
343346
# exec:
344347
# command: ["sh", "-c", "mkdir /opt/jans/jetty/jans-auth/custom/static/stylesheet/"]
345348
lifecycle: {}
349+
346350
# -- Additional labels that will be added across the gateway in the format of {mylabel: "myapp"}
347351
additionalLabels: { }
348352
# -- Additional annotations that will be added across the gateway in the format of {cert-manager.io/issuer: "letsencrypt-prod"}
@@ -385,6 +389,8 @@ casa:
385389
casaServiceName: casa
386390
# -- Boolean flag to enable/disable the casa chart.
387391
enabled: true
392+
# -- passing custom java options to casa. Notice you do not need to pass in any loggers options as they are introduced below in appLoggers. DO NOT PASS JAVA_OPTIONS in envs.
393+
cnCustomJavaOptions: ""
388394
# -- Enable endpoints in either istio or nginx ingress depending on users choice
389395
ingress:
390396
# -- Enable casa endpoints /casa
@@ -398,6 +404,8 @@ config-api:
398404
configApiServerServiceName: config-api
399405
# -- Boolean flag to enable/disable the config-api chart.
400406
enabled: true
407+
# -- passing custom java options to config-api. Notice you do not need to pass in any loggers options as they are introduced below in appLoggers. DO NOT PASS JAVA_OPTIONS in envs.
408+
cnCustomJavaOptions: ""
401409
# -- 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.
402410
appLoggers:
403411
# -- Enable log prefixing which enables prepending the STDOUT logs with the file name. i.e config-api_persistence ===> 2022-12-20 17:49:55,744 INFO
@@ -444,6 +452,8 @@ fido2:
444452
fido2ServiceName: fido2
445453
# -- Boolean flag to enable/disable the fido2 chart.
446454
enabled: true
455+
# -- passing custom java options to fido2. Notice you do not need to pass in any loggers options as they are introduced below in appLoggers. DO NOT PASS JAVA_OPTIONS in envs.
456+
cnCustomJavaOptions: ""
447457
# -- 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.
448458
appLoggers:
449459
# -- Enable log prefixing which enables prepending the STDOUT logs with the file name. i.e fido2 ===> 2022-12-20 17:49:55,744 INFO
@@ -489,6 +499,8 @@ scim:
489499
scimServiceName: scim
490500
# -- Boolean flag to enable/disable the SCIM chart.
491501
enabled: true
502+
# -- passing custom java options to scim. Notice you do not need to pass in any loggers options as they are introduced below in appLoggers. DO NOT PASS JAVA_OPTIONS in envs.
503+
cnCustomJavaOptions: ""
492504
# -- 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.
493505
appLoggers:
494506
# -- Enable log prefixing which enables prepending the STDOUT logs with the file name. i.e jans-scim ===> 2022-12-20 17:49:55,744 INFO
@@ -528,6 +540,8 @@ link:
528540
linkServiceName: link
529541
# -- Boolean flag to enable/disable the link chart.
530542
enabled: false
543+
# -- passing custom java options to link. Notice you do not need to pass in any loggers options as they are introduced below in appLoggers. DO NOT PASS JAVA_OPTIONS in envs.
544+
cnCustomJavaOptions: ""
531545
# -- 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.
532546
appLoggers:
533547
# -- Enable log prefixing which enables prepending the STDOUT logs with the file name. i.e link-persistence ===> 2022-12-20 17:49:55,744 INFO
@@ -561,6 +575,8 @@ saml:
561575
samlServiceName: saml
562576
# -- Boolean flag to enable/disable the saml chart.
563577
enabled: false
578+
# -- passing custom java options to saml. Notice you do not need to pass in any loggers options as they are introduced below in appLoggers. DO NOT PASS JAVA_OPTIONS in envs.
579+
cnCustomJavaOptions: ""
564580
# -- Enable endpoints in either istio or nginx ingress depending on users choice
565581
ingress:
566582
# Enable saml endpoints /kc
@@ -735,7 +751,7 @@ resources:
735751
# -- Configure the liveness healthcheck for the auth server if needed.
736752
livenessProbe:
737753
# -- Executes the python3 healthcheck.
738-
# https://github.com/GluuProject/docker-jans-auth-server/blob/master/scripts/healthcheck.py
754+
# https://github.com/JanssenProject/docker-jans-auth-server/blob/master/scripts/healthcheck.py
739755
exec:
740756
command:
741757
- python3
@@ -744,7 +760,7 @@ livenessProbe:
744760
periodSeconds: 30
745761
timeoutSeconds: 5
746762
# -- Configure the readiness healthcheck for the auth server if needed.
747-
# https://github.com/GluuProject/docker-jans-auth-server/blob/master/scripts/healthcheck.py
763+
# https://github.com/JanssenProject/docker-jans-auth-server/blob/master/scripts/healthcheck.py
748764
readinessProbe:
749765
exec:
750766
command:
@@ -774,6 +790,7 @@ additionalAnnotations: { }
774790
customScripts: [ ]
775791
# -- Add custom pod's command. If passed, it will override the default conditional command.
776792
customCommand: []
793+
777794
# -- Responsible for synchronizing Keycloak SAML clients
778795
kc-scheduler:
779796
# -- Add custom normal and secret envs to the service

0 commit comments

Comments
 (0)