From 32ae5c798b7a399fe74b1af42dae61e7437c0f39 Mon Sep 17 00:00:00 2001 From: Amro Misbah Date: Fri, 8 Sep 2023 14:31:09 +0300 Subject: [PATCH 1/7] fix: add default lbIP to avoid potential errors during helm install Example error: spec.template.spec.hostAliases.ip: Invalid value: "": must be valid IP address --- pygluu/kubernetes/templates/helm/gluu/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pygluu/kubernetes/templates/helm/gluu/values.yaml b/pygluu/kubernetes/templates/helm/gluu/values.yaml index bb94aa35..c08ab741 100644 --- a/pygluu/kubernetes/templates/helm/gluu/values.yaml +++ b/pygluu/kubernetes/templates/helm/gluu/values.yaml @@ -100,7 +100,7 @@ global: # -- Azure storage kind if using Azure disks azureStorageKind: Managed # -- The Loadbalancer IP created by nginx or istio on clouds that provide static IPs. This is not needed if `global.domain` is globally resolvable. - lbIp: "" + lbIp: 22.22.22.22 # -- Fully qualified domain name to be used for Gluu installation. This address will be used to reach Gluu services. domain: demoexample.gluu.org # -- Boolean flag to enable mapping global.lbIp to global.fqdn inside pods on clouds that provide static ip for loadbalancers. On cloud that provide only addresses to the LB this flag will enable a script to actively scan config.configmap.lbAddr and update the hosts file inside the pods automatically. From 267459c4d2fc6df211f34af5d5ffa70b4e03e1a8 Mon Sep 17 00:00:00 2001 From: Amro Misbah Date: Mon, 11 Mar 2024 13:46:53 +0200 Subject: [PATCH 2/7] feat: add memory limit to services --- .../templates/helm/gluu/charts/fido2/templates/deployment.yml | 2 ++ .../templates/helm/gluu/charts/oxauth/templates/deployment.yml | 2 ++ .../helm/gluu/charts/oxd-server/templates/deployment.yaml | 2 ++ .../helm/gluu/charts/oxshibboleth/templates/_helpers.tpl | 1 + .../templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl | 1 + .../templates/helm/gluu/charts/scim/templates/deployment.yml | 2 ++ 6 files changed, 10 insertions(+) diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/deployment.yml b/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/deployment.yml index bae157d4..7aaf8ed1 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/deployment.yml +++ b/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/deployment.yml @@ -73,6 +73,8 @@ spec: runAsNonRoot: true {{- end }} env: + - name: GLUU_JAVA_OPTIONS + value: "-XX:MaxDirectMemorySize={{ (.Values.resources.limits.memory | replace "Mi" "") }}m -Xmx{{sub (.Values.resources.limits.memory | replace "Mi" "") 300}}m" {{- 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")) }} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/deployment.yml b/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/deployment.yml index d3cc41d9..f27381f0 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/deployment.yml +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/deployment.yml @@ -71,6 +71,8 @@ spec: runAsNonRoot: true {{- end }} env: + - name: GLUU_JAVA_OPTIONS + value: "-XX:MaxDirectMemorySize={{ (.Values.resources.limits.memory | replace "Mi" "") }}m -Xmx{{sub (.Values.resources.limits.memory | replace "Mi" "") 300}}m" {{- 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) }} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/deployment.yaml b/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/deployment.yaml index 8e7502bc..b2735036 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/deployment.yaml +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/deployment.yaml @@ -72,6 +72,8 @@ spec: runAsNonRoot: true {{- end }} env: + - name: GLUU_JAVA_OPTIONS + value: "-XX:MaxDirectMemorySize={{ (.Values.resources.limits.memory | replace "Mi" "") }}m -Xmx{{sub (.Values.resources.limits.memory | replace "Mi" "") 300}}m" {{- include "oxd-server.usr-envs" . | indent 12 }} {{- include "oxd-server.usr-secret-envs" . | indent 12 }} imagePullPolicy: {{ .Values.image.pullPolicy }} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl index eda8b796..cc7be205 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl @@ -81,6 +81,7 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs {{ $container := "" }} {{ $xmlsec := "" }} {{ $custom := "" }} +{{- $custom := printf "-XX:MaxDirectMemorySize=%sm -Xmx%s" (.Values.resources.limits.memory | replace "Mi" "") (sub (.Values.resources.limits.memory | replace "Mi" "") 300) }} {{- if .Values.global.oxshibboleth.gluuCustomJavaOptions }} {{ $custom = printf "%s " .Values.global.oxshibboleth.gluuCustomJavaOptions }} {{- end}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl index 89e80a68..d8b8a680 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl @@ -73,6 +73,7 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs */}} {{- define "oxtrust.customJavaOptions"}} {{ $custom := "" }} +{{- $custom := printf "-XX:MaxDirectMemorySize=%sm -Xmx%s" (.Values.resources.limits.memory | replace "Mi" "") (sub (.Values.resources.limits.memory | replace "Mi" "") 300) }} {{- if .Values.global.oxtrust.gluuCustomJavaOptions }} {{ $custom = printf "%s" .Values.global.oxtrust.gluuCustomJavaOptions }} {{- end}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/deployment.yml b/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/deployment.yml index e7389284..c4933afa 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/deployment.yml +++ b/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/deployment.yml @@ -73,6 +73,8 @@ spec: runAsNonRoot: true {{- end }} env: + - name: GLUU_JAVA_OPTIONS + value: "-XX:MaxDirectMemorySize={{ (.Values.resources.limits.memory | replace "Mi" "") }}m -Xmx{{sub (.Values.resources.limits.memory | replace "Mi" "") 300}}m" {{- 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) }} From 99d88a7d215dd2f15818e4591eaa0dbdae330d54 Mon Sep 17 00:00:00 2001 From: Amro Misbah Date: Mon, 11 Mar 2024 14:14:31 +0200 Subject: [PATCH 3/7] fix: remove arguments from helpers file --- .../helm/gluu/charts/oxshibboleth/templates/_helpers.tpl | 1 - .../templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl | 1 - 2 files changed, 2 deletions(-) diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl index cc7be205..eda8b796 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl @@ -81,7 +81,6 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs {{ $container := "" }} {{ $xmlsec := "" }} {{ $custom := "" }} -{{- $custom := printf "-XX:MaxDirectMemorySize=%sm -Xmx%s" (.Values.resources.limits.memory | replace "Mi" "") (sub (.Values.resources.limits.memory | replace "Mi" "") 300) }} {{- if .Values.global.oxshibboleth.gluuCustomJavaOptions }} {{ $custom = printf "%s " .Values.global.oxshibboleth.gluuCustomJavaOptions }} {{- end}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl index d8b8a680..89e80a68 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl @@ -73,7 +73,6 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs */}} {{- define "oxtrust.customJavaOptions"}} {{ $custom := "" }} -{{- $custom := printf "-XX:MaxDirectMemorySize=%sm -Xmx%s" (.Values.resources.limits.memory | replace "Mi" "") (sub (.Values.resources.limits.memory | replace "Mi" "") 300) }} {{- if .Values.global.oxtrust.gluuCustomJavaOptions }} {{ $custom = printf "%s" .Values.global.oxtrust.gluuCustomJavaOptions }} {{- end}} From 3fa9bb940873656797a6311438a972cf05e3bb7e Mon Sep 17 00:00:00 2001 From: Amro Misbah Date: Tue, 12 Mar 2024 17:12:45 +0200 Subject: [PATCH 4/7] feat: add java memory arguments in helpers file --- .../helm/gluu/charts/oxshibboleth/templates/_helpers.tpl | 5 ++++- .../helm/gluu/charts/oxtrust/templates/_helpers.tpl | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl index eda8b796..c1972e64 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl @@ -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 := "" }} @@ -112,7 +115,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 }} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl index 89e80a68..20d55bf3 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl @@ -76,7 +76,10 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs {{- 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 }} From 064e8a9bfb609c5b8753c2a9eaec066dd285fd8a Mon Sep 17 00:00:00 2001 From: Amro Misbah Date: Thu, 14 Mar 2024 11:41:59 +0200 Subject: [PATCH 5/7] feat: introduce gluuCustomJavaOptions to all java-based components --- .../gluu/charts/fido2/templates/_helpers.tpl | 15 +++++++++++++++ .../gluu/charts/fido2/templates/deployment.yml | 2 +- .../gluu/charts/oxauth/templates/_helpers.tpl | 15 +++++++++++++++ .../gluu/charts/oxauth/templates/deployment.yml | 2 +- .../charts/oxd-server/templates/_helpers.tpl | 16 ++++++++++++++++ .../charts/oxd-server/templates/deployment.yaml | 2 +- .../helm/gluu/charts/scim/templates/_helpers.tpl | 15 +++++++++++++++ .../gluu/charts/scim/templates/deployment.yml | 2 +- .../kubernetes/templates/helm/gluu/values.yaml | 8 ++++++++ 9 files changed, 73 insertions(+), 4 deletions(-) diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/_helpers.tpl index 3f66630d..a282ec36 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/_helpers.tpl @@ -67,6 +67,21 @@ Create user custom defined secret envs {{- end }} {{- end }} +{{/* +Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs +*/}} +{{- define "fido2.customJavaOptions"}} +{{ $custom := "" }} +{{- if .Values.global.fido2.gluuCustomJavaOptions }} +{{ $custom = printf "%s" .Values.global.fido2.gluuCustomJavaOptions }} +{{- end}} +{{ $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 */}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/deployment.yml b/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/deployment.yml index 7aaf8ed1..c8bb0f1b 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/deployment.yml +++ b/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/deployment.yml @@ -74,7 +74,7 @@ spec: {{- end }} env: - name: GLUU_JAVA_OPTIONS - value: "-XX:MaxDirectMemorySize={{ (.Values.resources.limits.memory | replace "Mi" "") }}m -Xmx{{sub (.Values.resources.limits.memory | replace "Mi" "") 300}}m" + 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")) }} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/_helpers.tpl index 031555de..231de03d 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/_helpers.tpl @@ -67,6 +67,21 @@ Create user custom defined secret envs {{- end }} {{- end }} +{{/* +Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs +*/}} +{{- define "oxauth.customJavaOptions"}} +{{ $custom := "" }} +{{- if .Values.global.oxauth.gluuCustomJavaOptions }} +{{ $custom = printf "%s" .Values.global.oxauth.gluuCustomJavaOptions }} +{{- end}} +{{ $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 */}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/deployment.yml b/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/deployment.yml index f27381f0..0c4a3f21 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/deployment.yml +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/deployment.yml @@ -72,7 +72,7 @@ spec: {{- end }} env: - name: GLUU_JAVA_OPTIONS - value: "-XX:MaxDirectMemorySize={{ (.Values.resources.limits.memory | replace "Mi" "") }}m -Xmx{{sub (.Values.resources.limits.memory | replace "Mi" "") 300}}m" + 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) }} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/_helpers.tpl index 5f043853..826c41cf 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/_helpers.tpl @@ -67,6 +67,22 @@ 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" }} +{{- if $gluuCustomJavaOptions }} +{{- $custom := printf "%s" $gluuCustomJavaOptions }} +{{- end}} +{{ $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 */}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/deployment.yaml b/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/deployment.yaml index b2735036..a7eccc56 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/deployment.yaml +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/deployment.yaml @@ -73,7 +73,7 @@ spec: {{- end }} env: - name: GLUU_JAVA_OPTIONS - value: "-XX:MaxDirectMemorySize={{ (.Values.resources.limits.memory | replace "Mi" "") }}m -Xmx{{sub (.Values.resources.limits.memory | replace "Mi" "") 300}}m" + 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 }} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/_helpers.tpl index 5c1ea5fa..a078fbee 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/_helpers.tpl @@ -67,6 +67,21 @@ Create user custom defined secret envs {{- end }} {{- end }} +{{/* +Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs +*/}} +{{- define "scim.customJavaOptions"}} +{{ $custom := "" }} +{{- if .Values.global.scim.gluuCustomJavaOptions }} +{{ $custom = printf "%s" .Values.global.scim.gluuCustomJavaOptions }} +{{- end}} +{{ $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 */}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/deployment.yml b/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/deployment.yml index c4933afa..940fde15 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/deployment.yml +++ b/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/deployment.yml @@ -74,7 +74,7 @@ spec: {{- end }} env: - name: GLUU_JAVA_OPTIONS - value: "-XX:MaxDirectMemorySize={{ (.Values.resources.limits.memory | replace "Mi" "") }}m -Xmx{{sub (.Values.resources.limits.memory | replace "Mi" "") 300}}m" + 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) }} diff --git a/pygluu/kubernetes/templates/helm/gluu/values.yaml b/pygluu/kubernetes/templates/helm/gluu/values.yaml index 09f01df8..17cfa4c0 100644 --- a/pygluu/kubernetes/templates/helm/gluu/values.yaml +++ b/pygluu/kubernetes/templates/helm/gluu/values.yaml @@ -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. + 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" @@ -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. + 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" @@ -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. + 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" @@ -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. + 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" From 2c4ac1a8f6c3f17a8a97b873a98af93322488b46 Mon Sep 17 00:00:00 2001 From: Amro Misbah Date: Thu, 14 Mar 2024 12:04:07 +0200 Subject: [PATCH 6/7] docs: DO NOT PASS GLUU_JAVA_OPTIONS in envs. --- pygluu/kubernetes/templates/helm/gluu/values.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pygluu/kubernetes/templates/helm/gluu/values.yaml b/pygluu/kubernetes/templates/helm/gluu/values.yaml index 17cfa4c0..2a8046b4 100644 --- a/pygluu/kubernetes/templates/helm/gluu/values.yaml +++ b/pygluu/kubernetes/templates/helm/gluu/values.yaml @@ -135,7 +135,7 @@ 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. + # -- 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. 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" @@ -178,7 +178,7 @@ 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. + # -- 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" @@ -197,7 +197,7 @@ 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. + # -- 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" @@ -243,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" @@ -305,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" @@ -343,7 +343,7 @@ 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. + # -- 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" From f6a32fa50922d3e39ac713a4bc6f8035536d3401 Mon Sep 17 00:00:00 2001 From: Amro Misbah Date: Thu, 14 Mar 2024 15:03:11 +0200 Subject: [PATCH 7/7] fix: remove the unneeded if condition --- .../templates/helm/gluu/charts/fido2/templates/_helpers.tpl | 2 -- .../templates/helm/gluu/charts/oxauth/templates/_helpers.tpl | 2 -- .../helm/gluu/charts/oxd-server/templates/_helpers.tpl | 2 -- .../helm/gluu/charts/oxshibboleth/templates/_helpers.tpl | 2 -- .../templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl | 2 -- .../templates/helm/gluu/charts/scim/templates/_helpers.tpl | 2 -- 6 files changed, 12 deletions(-) diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/_helpers.tpl index a282ec36..bafe45ca 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/fido2/templates/_helpers.tpl @@ -72,9 +72,7 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs */}} {{- define "fido2.customJavaOptions"}} {{ $custom := "" }} -{{- if .Values.global.fido2.gluuCustomJavaOptions }} {{ $custom = printf "%s" .Values.global.fido2.gluuCustomJavaOptions }} -{{- end}} {{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}} {{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" $memory -}} {{- $xmx := printf "-Xmx%dm" (sub $memory 300) -}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/_helpers.tpl index 231de03d..97f8dd45 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxauth/templates/_helpers.tpl @@ -72,9 +72,7 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs */}} {{- define "oxauth.customJavaOptions"}} {{ $custom := "" }} -{{- if .Values.global.oxauth.gluuCustomJavaOptions }} {{ $custom = printf "%s" .Values.global.oxauth.gluuCustomJavaOptions }} -{{- end}} {{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}} {{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" $memory -}} {{- $xmx := printf "-Xmx%dm" (sub $memory 300) -}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/_helpers.tpl index 826c41cf..0357248c 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxd-server/templates/_helpers.tpl @@ -73,9 +73,7 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs {{- define "oxd-server.customJavaOptions"}} {{ $custom := "" }} {{- $gluuCustomJavaOptions := index .Values.global "oxd-server" "gluuCustomJavaOptions" }} -{{- if $gluuCustomJavaOptions }} {{- $custom := printf "%s" $gluuCustomJavaOptions }} -{{- end}} {{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}} {{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" $memory -}} {{- $xmx := printf "-Xmx%dm" (sub $memory 300) -}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl index c1972e64..b9f3836c 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxshibboleth/templates/_helpers.tpl @@ -84,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}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl index 20d55bf3..4cd1292b 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/oxtrust/templates/_helpers.tpl @@ -73,9 +73,7 @@ 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}} {{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}} {{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" $memory -}} {{- $xmx := printf "-Xmx%dm" (sub $memory 300) -}} diff --git a/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/_helpers.tpl b/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/_helpers.tpl index a078fbee..bd12834f 100644 --- a/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/_helpers.tpl +++ b/pygluu/kubernetes/templates/helm/gluu/charts/scim/templates/_helpers.tpl @@ -72,9 +72,7 @@ Create GLUU_JAVA_OPTIONS ENV for passing custom work and detailed logs */}} {{- define "scim.customJavaOptions"}} {{ $custom := "" }} -{{- if .Values.global.scim.gluuCustomJavaOptions }} {{ $custom = printf "%s" .Values.global.scim.gluuCustomJavaOptions }} -{{- end}} {{ $memory := .Values.resources.limits.memory | replace "Mi" "" | int -}} {{- $maxDirectMemory := printf "-XX:MaxDirectMemorySize=%dm" $memory -}} {{- $xmx := printf "-Xmx%dm" (sub $memory 300) -}}