diff --git a/packages/apps/opensearch/templates/jvm-options.yaml b/packages/apps/opensearch/templates/jvm-options.yaml new file mode 100644 index 000000000..7228c53b2 --- /dev/null +++ b/packages/apps/opensearch/templates/jvm-options.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-jvm-options +data: + # -XX:-UseBASE64Intrinsics turns off the AVX-512 Base64 decoder hit by + # CVE-2026-114938: OpenSearch decodes the Basic credentials of a request + # before it authenticates it, and the image may bundle an OpenJDK that + # predates the fix. + cozystack.options: | + -XX:-UseBASE64Intrinsics diff --git a/packages/apps/opensearch/templates/opensearch.yaml b/packages/apps/opensearch/templates/opensearch.yaml index 9aba247ec..2f7cdbfef 100644 --- a/packages/apps/opensearch/templates/opensearch.yaml +++ b/packages/apps/opensearch/templates/opensearch.yaml @@ -17,6 +17,18 @@ spec: version: {{ include "opensearch.versionMap" $ }} httpPort: 9200 {{- /* + JVM options go in as a jvm.options.d file because neither other route works: + bin/opensearch-env unsets JAVA_TOOL_OPTIONS, and setting nodePools[].jvm makes + the operator stop sizing the heap from the memory request. + */}} + additionalVolumes: + - name: jvm-options + path: /usr/share/opensearch/config/jvm.options.d/cozystack.options + subPath: cozystack.options + restartPods: true + configMap: + name: {{ .Release.Name }}-jvm-options + {{- /* The operator's own way to raise vm.max_map_count is a privileged init container in every OpenSearch pod, and the PodSecurity level tenant namespaces run at refuses that before any pod exists. The sysctl comes from diff --git a/packages/apps/opensearch/tests/jvm_options_test.yaml b/packages/apps/opensearch/tests/jvm_options_test.yaml new file mode 100644 index 000000000..8195ee1d8 --- /dev/null +++ b/packages/apps/opensearch/tests/jvm_options_test.yaml @@ -0,0 +1,42 @@ +suite: opensearch JVM options + +release: + name: test-os + namespace: tenant-test + +set: + _cluster: + cluster-domain: cozy.local + +tests: + - it: ships the Base64 intrinsics switch as a jvm.options.d file + template: templates/jvm-options.yaml + asserts: + - isKind: + of: ConfigMap + - equal: + path: metadata.name + value: test-os-jvm-options + - equal: + path: data["cozystack.options"] + value: | + -XX:-UseBASE64Intrinsics + + - it: mounts that file into every pod of the cluster + template: templates/opensearch.yaml + documentSelector: + path: kind + value: OpenSearchCluster + asserts: + - contains: + path: spec.general.additionalVolumes + content: + name: jvm-options + path: /usr/share/opensearch/config/jvm.options.d/cozystack.options + subPath: cozystack.options + restartPods: true + configMap: + name: test-os-jvm-options + # setting jvm would stop the operator sizing the heap from the memory request + - notExists: + path: spec.nodePools[0].jvm