From 92f5b2187d4056cd542d90ba42cbafde3edab538 Mon Sep 17 00:00:00 2001 From: Tharsanan1 Date: Tue, 15 Oct 2024 10:06:03 +0530 Subject: [PATCH] Template java opts --- helm-charts/templates/_helpers.tpl | 14 ++++++++++++++ .../gateway-runtime-deployment.yaml | 6 +----- .../data-plane/gateway-components/log-conf.yaml | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/helm-charts/templates/_helpers.tpl b/helm-charts/templates/_helpers.tpl index 0fdabc832f..0bb66ff6d0 100644 --- a/helm-charts/templates/_helpers.tpl +++ b/helm-charts/templates/_helpers.tpl @@ -142,3 +142,17 @@ env: - "prod.gw.wso2.com" {{- end -}} {{- end -}} + +{{- define "apk.javaOptions" -}} + {{- if .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.javaOpts }} + {{- .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.javaOpts }} + {{- if and .Values.wso2.apk.metrics .Values.wso2.apk.metrics.enabled -}} + {{- " " }}-Dapk.jmx.metrics.enabled=true -javaagent:/home/wso2/lib/jmx_prometheus_javaagent-0.20.0.jar=18006:/tmp/metrics/prometheus-jmx-config-enforcer.yml + {{- end }} + {{- else -}} + -Dhttpclient.hostnameVerifier=AllowAll -Xms5512m -Xmx512m -XX:MaxRAMFraction=2 + {{- if and .Values.wso2.apk.metrics .Values.wso2.apk.metrics.enabled }} + {{- " " }}-Dapk.jmx.metrics.enabled=true -javaagent:/home/wso2/lib/jmx_prometheus_javaagent-0.20.0.jar=18006:/tmp/metrics/prometheus-jmx-config-enforcer.yml + {{- end }} + {{- end }} +{{- end }} diff --git a/helm-charts/templates/data-plane/gateway-components/gateway-runtime/gateway-runtime-deployment.yaml b/helm-charts/templates/data-plane/gateway-components/gateway-runtime/gateway-runtime-deployment.yaml index 0bd96a5bd2..72caebf252 100644 --- a/helm-charts/templates/data-plane/gateway-components/gateway-runtime/gateway-runtime-deployment.yaml +++ b/helm-charts/templates/data-plane/gateway-components/gateway-runtime/gateway-runtime-deployment.yaml @@ -102,11 +102,7 @@ spec: - name: enforcer_admin_pwd value: admin - name: JAVA_OPTS - {{- if and .Values.wso2.apk.metrics .Values.wso2.apk.metrics.enabled }} - value: -Dhttpclient.hostnameVerifier=AllowAll -Xms512m -Xmx512m -XX:MaxRAMFraction=2 -Dapk.jmx.metrics.enabled=true -javaagent:/home/wso2/lib/jmx_prometheus_javaagent-0.20.0.jar=18006:/tmp/metrics/prometheus-jmx-config-enforcer.yml - {{- else }} - value: -Dhttpclient.hostnameVerifier=AllowAll -Xms512m -Xmx512m -XX:MaxRAMFraction=2 - {{- end }} + value: {{ include "apk.javaOptions" . }} {{- if and .Values.wso2.apk.dp.gatewayRuntime.analytics .Values.wso2.apk.dp.gatewayRuntime.analytics.publishers }} {{- $defaultPublisherSecretName := "" }} {{- $moesifPublisherSecretName := "" }} diff --git a/helm-charts/templates/data-plane/gateway-components/log-conf.yaml b/helm-charts/templates/data-plane/gateway-components/log-conf.yaml index b533d3031f..8ab3f1821b 100644 --- a/helm-charts/templates/data-plane/gateway-components/log-conf.yaml +++ b/helm-charts/templates/data-plane/gateway-components/log-conf.yaml @@ -131,7 +131,7 @@ data: {{ if and .Values.wso2.apk.dp.gatewayRuntime.deployment .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.authService }} [enforcer.authService] {{ if .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.authService.maxMessageSize }} - maxMessageSize = {{ .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.authService.maxMessageSize }} + maxMessageSize = {{ .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.authService.maxMessageSize | int64 }} {{end}} {{ if .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.authService.maxHeaderLimit }} maxHeaderLimit = {{ .Values.wso2.apk.dp.gatewayRuntime.deployment.enforcer.configs.authService.maxHeaderLimit }}