diff --git a/charts/network/charts/network-nodes/Chart.yaml b/charts/network/charts/network-nodes/Chart.yaml index f50d6ded..e9a862a 100644 --- a/charts/network/charts/network-nodes/Chart.yaml +++ b/charts/network/charts/network-nodes/Chart.yaml @@ -3,7 +3,7 @@ name: network-nodes description: A Helm chart for Kubernetes type: application version: 0.1.1 -appVersion: "0.1.0" +appVersion: "0.1.1" maintainers: - name: SettleMint email: support@settlemint.com diff --git a/charts/network/charts/network-nodes/README.md b/charts/network/charts/network-nodes/README.md index 090fe86..d9b2ca9 100644 --- a/charts/network/charts/network-nodes/README.md +++ b/charts/network/charts/network-nodes/README.md @@ -1,6 +1,6 @@ # network-nodes -![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square) +![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.1](https://img.shields.io/badge/AppVersion-0.1.1-informational?style=flat-square) A Helm chart for Kubernetes @@ -30,6 +30,7 @@ A Helm chart for Kubernetes | config.http.maxActiveConnections | int | `2000` | Maximum concurrent HTTP JSON-RPC connections. | | config.http.maxBatchSize | int | `512` | Maximum number of batched JSON-RPC calls per request. | | config.http.maxRequestContentLength | int | `524288000` | Maximum HTTP request body size in bytes. | +| config.logFormat | string | `"plain"` | Log output format. Supports "plain" (default) or "json". | | config.logging | string | `"INFO"` | Log verbosity level for Besu components. | | config.metrics.categories | list | `["BLOCKCHAIN","ETHEREUM","EXECUTORS","JVM","NETWORK","PEERS","PROCESS","PRUNER","RPC","SYNCHRONIZER","TRANSACTION_POOL"]` | Metrics categories exposed to Prometheus. | | config.metrics.enabled | bool | `true` | Enable the Prometheus metrics endpoint. | diff --git a/charts/network/charts/network-nodes/templates/_helpers.tpl b/charts/network/charts/network-nodes/templates/_helpers.tpl index 5662404..9236957 100644 --- a/charts/network/charts/network-nodes/templates/_helpers.tpl +++ b/charts/network/charts/network-nodes/templates/_helpers.tpl @@ -21,6 +21,7 @@ If release name contains chart name it will be used as a full name. {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} {{- end }} {{- end }} + {{- end }} {{/* @@ -61,6 +62,28 @@ Create the name of the service account to use {{- end }} {{- end }} +{{/* +Render optional Log4j environment variables when structured logging is enabled. +*/}} +{{- define "nodes.log4jEnv" -}} +{{- if eq (default "plain" .Values.config.logFormat) "json" }} +- name: LOG4J_CONFIGURATION_FILE + value: /etc/besu/log-config.xml +{{- end }} +{{- end }} + +{{/* +Render optional volume mounts for the Log4j configuration file. +*/}} +{{- define "nodes.log4jVolumeMount" -}} +{{- if eq (default "plain" .Values.config.logFormat) "json" }} +- name: besu-config + mountPath: /etc/besu/log-config.xml + subPath: log-config.xml + readOnly: true +{{- end }} +{{- end }} + {{/* Resolve the number of validator replicas, falling back to global overrides when provided. */}} diff --git a/charts/network/charts/network-nodes/templates/configmap.yaml b/charts/network/charts/network-nodes/templates/configmap.yaml index 1369dce..5969203 100644 --- a/charts/network/charts/network-nodes/templates/configmap.yaml +++ b/charts/network/charts/network-nodes/templates/configmap.yaml @@ -8,6 +8,7 @@ metadata: {{- $persistenceEnabled := default false (get $persistence "enabled") }} {{- $mountPath := default "" (get $persistence "mountPath") }} {{- $privateKeyFilename := default "privateKey" .Values.config.privateKeyFilename }} +{{- $logFormat := default "plain" .Values.config.logFormat }} data: config.toml: |- data-path="/data" @@ -61,3 +62,21 @@ data: metrics-host={{ .Values.config.metrics.host | quote }} metrics-port={{ .Values.service.ports.metrics | int }} metrics-category={{ .Values.config.metrics.categories | toJson }} + {{- if eq $logFormat "json" }} + log-config.xml: |- + + + + + + + + + + + + + + + + {{- end }} diff --git a/charts/network/charts/network-nodes/templates/statefulset-rpc.yaml b/charts/network/charts/network-nodes/templates/statefulset-rpc.yaml index 6d60106..297d430 100644 --- a/charts/network/charts/network-nodes/templates/statefulset-rpc.yaml +++ b/charts/network/charts/network-nodes/templates/statefulset-rpc.yaml @@ -85,6 +85,10 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP +{{- $log4jEnv := include "nodes.log4jEnv" . }} +{{- if $log4jEnv }} +{{ $log4jEnv | nindent 12 }} +{{- end }} {{- with .Values.securityContext }} securityContext: {{- toYaml . | nindent 12 }} @@ -141,6 +145,10 @@ spec: mountPath: /etc/besu/config.toml subPath: config.toml readOnly: true +{{- $log4jMount := include "nodes.log4jVolumeMount" . }} +{{- if $log4jMount }} +{{ $log4jMount | nindent 12 }} +{{- end }} - name: besu-genesis mountPath: /etc/besu/genesis.json subPath: genesis.json diff --git a/charts/network/charts/network-nodes/templates/statefulset-validator.yaml b/charts/network/charts/network-nodes/templates/statefulset-validator.yaml index b13981c..41051f2 100644 --- a/charts/network/charts/network-nodes/templates/statefulset-validator.yaml +++ b/charts/network/charts/network-nodes/templates/statefulset-validator.yaml @@ -84,6 +84,10 @@ spec: valueFrom: fieldRef: fieldPath: status.podIP +{{- $log4jEnv := include "nodes.log4jEnv" . }} +{{- if $log4jEnv }} +{{ $log4jEnv | nindent 12 }} +{{- end }} {{- with .Values.securityContext }} securityContext: {{- toYaml . | nindent 12 }} @@ -140,6 +144,10 @@ spec: mountPath: /etc/besu/config.toml subPath: config.toml readOnly: true +{{- $log4jMount := include "nodes.log4jVolumeMount" . }} +{{- if $log4jMount }} +{{ $log4jMount | nindent 12 }} +{{- end }} - name: besu-genesis mountPath: /etc/besu/genesis.json subPath: genesis.json diff --git a/charts/network/charts/network-nodes/values.yaml b/charts/network/charts/network-nodes/values.yaml index 688a372..41d0363 100644 --- a/charts/network/charts/network-nodes/values.yaml +++ b/charts/network/charts/network-nodes/values.yaml @@ -87,6 +87,8 @@ service: config: # -- (string) Log verbosity level for Besu components. logging: INFO + # -- (string) Log output format. Supports "plain" (default) or "json". + logFormat: plain # -- (string) Ledger storage backend (FOREST or BONSAI). dataStorageFormat: FOREST # -- (string) Filename containing each node's private key within mounted secrets.