This is an automated email from the ASF dual-hosted git repository.

janhoy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr-operator.git


The following commit(s) were added to refs/heads/main by this push:
     new 04f02c1  Configure operator logging in helm chart (#779)
04f02c1 is described below

commit 04f02c15d8bbc01fc21ac2f91eddac73392c3207
Author: Jan Høydahl <[email protected]>
AuthorDate: Tue Apr 22 09:31:31 2025 +0200

    Configure operator logging in helm chart (#779)
    
    Co-authored-by: Jason Gerlowski <[email protected]>
---
 docs/running-the-operator.md                 | 13 ++++++++++++-
 docs/upgrade-notes.md                        |  6 ++++++
 helm/solr-operator/Chart.yaml                | 12 ++++++++++++
 helm/solr-operator/README.md                 |  4 ++++
 helm/solr-operator/templates/deployment.yaml | 10 ++++++++++
 helm/solr-operator/values.yaml               | 10 ++++++++++
 6 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/docs/running-the-operator.md b/docs/running-the-operator.md
index 0b3ba1e..16dd6c3 100644
--- a/docs/running-the-operator.md
+++ b/docs/running-the-operator.md
@@ -148,7 +148,18 @@ The final image will only contain the solr-operator binary 
and necessary License
 * **--health-probe-bind-address=** The address to bind the health probe 
servlet on.
   If only a port is provided (e.g. `:8081`), then the metrics server will 
respond to requests with any Host header.
   (defaults to _:8081_)
-                        
+
+* **--zap-devel** Enables development mode. 
+  Changes logging to `console` encoder and `debug` level. (_true_ | _false_, 
defaults to _false_)
+
+* **--zap-log-level** Overrides the log level. 
+  Can be one of `debug`, `info`, `error`, or any integer value > 0 for custom 
verbosity. (_string_, defaults to _empty_)
+
+* **--zap-encoder** Overrides the log format.
+  Use `console` or `json`. (_string_, defaults to _empty_)
+
+* **--zap-stacktrace-level** Overrides the level for stack trace logging. 
(_string_, defaults to _empty_)
+
 ## Client Auth for mTLS-enabled Solr clusters
 
 For SolrCloud instances that run with mTLS enabled (see 
`spec.solrTLS.clientAuth`), the operator needs to supply a trusted certificate 
when making API calls to the Solr pods it is managing.
diff --git a/docs/upgrade-notes.md b/docs/upgrade-notes.md
index bd2f2b2..267a80b 100644
--- a/docs/upgrade-notes.md
+++ b/docs/upgrade-notes.md
@@ -125,6 +125,12 @@ _Note that the Helm chart version does not contain a `v` 
prefix, which the downl
 
 ## Upgrade Warnings and Notes
 
+### v0.10.0
+- **Logging now defaults to JSON format**
+  The new default for CLI flag `--zap-devel` is now `false`, causing log 
encoding to be `json` and log level to be `info`.
+  There is a new helm value `development` that can be set to `true` to switch 
to `console` encoding and `debug` level
+  that was the default in previous versions.
+
 ### v0.8.0
 - **The minimum supported Solr version is now 8.11**
   If you are unable to use a newer version of Solr, please install the 
`v0.7.1` version of the Solr Operator.
diff --git a/helm/solr-operator/Chart.yaml b/helm/solr-operator/Chart.yaml
index ef3e7d1..fb16b8e 100644
--- a/helm/solr-operator/Chart.yaml
+++ b/helm/solr-operator/Chart.yaml
@@ -60,6 +60,18 @@ annotations:
       links:
         - name: Github PR
           url: https://github.com/apache/solr-operator/pull/774
+    - kind: changed
+      description: The default logging format is now `json`, and default log 
level is `info`.
+      links:
+        - name: Github PR
+          url: https://github.com/apache/solr-operator/pull/779
+    - kind: added
+      description: Ability to configure `development` mode as well as log 
encoder, log level and stacktrace log level
+      links:
+        - name: Github Issue
+          url: https://github.com/apache/solr-operator/issues/778
+        - name: Github PR
+          url: https://github.com/apache/solr-operator/pull/779
   artifacthub.io/images: |
     - name: solr-operator
       image: apache/solr-operator:v0.10.0-prerelease
diff --git a/helm/solr-operator/README.md b/helm/solr-operator/README.md
index 23766cf..2e44b87 100644
--- a/helm/solr-operator/README.md
+++ b/helm/solr-operator/README.md
@@ -191,6 +191,10 @@ The command removes all the Kubernetes components 
associated with the chart and
 | tolerations | []object |  | Specify a list of Kubernetes tolerations for the 
Solr Operator pod |
 | priorityClassName | string | `""` | Give a priorityClassName for the Solr 
Operator pod |
 | sidecarContainers | []object |  | An optional list of additional containers 
to run along side the Solr Operator in its pod |
+| logger.level | string |  | Overrides the log level. Can be one of `debug`, 
`info`, `error`, or any integer value > 0 which corresponds to custom debug 
levels of increasing verbosity|
+| logger.encoder | string | | Overrides the log format. Use `console` or 
`json`. |
+| logger.stacktraceLevel | string | | Overrides the level for stackTrace 
logging. |
+| development | boolean | `false` | Enables development mode. This will change 
logging to `console` encoder and `debug` level |
 
 ### Configuring the Zookeeper Operator
 
diff --git a/helm/solr-operator/templates/deployment.yaml 
b/helm/solr-operator/templates/deployment.yaml
index e625124..b967e7b 100644
--- a/helm/solr-operator/templates/deployment.yaml
+++ b/helm/solr-operator/templates/deployment.yaml
@@ -78,6 +78,16 @@ spec:
         {{- else }}
         - "--leader-elect=false"
         {{- end }}
+        - --zap-devel={{ .Values.development }}
+        {{- if .Values.logger.encoder }}
+        - --zap-encoder={{ .Values.logger.encoder }}
+        {{- end }}
+        {{- if .Values.logger.level }}
+        - --zap-log-level={{ .Values.logger.level }}
+        {{- end }}
+        {{- if .Values.logger.stacktraceLevel }}
+        - --zap-stacktrace-level={{ .Values.logger.stacktraceLevel }}
+        {{- end }}
 
         env:
           - name: POD_NAMESPACE
diff --git a/helm/solr-operator/values.yaml b/helm/solr-operator/values.yaml
index 523b9fa..efdbe0a 100644
--- a/helm/solr-operator/values.yaml
+++ b/helm/solr-operator/values.yaml
@@ -19,6 +19,16 @@
 
 replicaCount: 1
 
+# Development mode configures certain settings for convenient development.
+# When 'true', logging will use: encoder=console, level=debug, 
stacktrace-level=warn
+development: false
+
+# These are default logger settings in production mode, but can be overridden 
here
+logger: {}
+  #encoder: json
+  #level: error
+  #stacktraceLevel: error
+
 image:
   repository: apache/solr-operator
   tag: v0.10.0-prerelease

Reply via email to