-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cluster Operator dynamic logging configuration #3328
Changes from 14 commits
4070c27
71d1741
ba67fbe
29b5ef6
4a93f45
c73aa66
e56fb57
7ecf878
7e8be11
ad7cdfa
c24a8d6
eff4bd2
276ae0a
961c674
a89fc7e
69f6a4f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
#!/usr/bin/env bash | ||
export JAVA_CLASSPATH=lib/io.strimzi.@project.build.finalName@.@project.packaging@:@project.dist.classpath@ | ||
export JAVA_MAIN=io.strimzi.operator.cluster.Main | ||
|
||
if [ -f /opt/strimzi/custom-config/log4j2.properties ]; then | ||
# if ConfigMap was not mounted and thus this file was not created, use properties file from the classpath | ||
export JAVA_OPTS="${JAVA_OPTS} -Dlog4j2.configurationFile=file:/opt/strimzi/custom-config/log4j2.properties" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we not instead always deploy the CM and pre-seed the CM with the properties from the properties file? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are deploying it always. @scholzj thinks there may be some edge cases when the CM is not deployed/mounted as a volume. In that case, we should use at least some defaults (what is done by loading log4j2.properties from classpath). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we |
||
fi | ||
exec "${STRIMZI_HOME}/bin/launch_java.sh" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
[id='ref-operator-cluster-{context}'] | ||
= Cluster Operator configuration | ||
|
||
The Cluster Operator can be configured through the following supported environment variables. | ||
The Cluster Operator can be configured through the following supported environment variables and through the logging configuration. | ||
|
||
`STRIMZI_NAMESPACE`:: A comma-separated list of namespaces that the operator should operate in. | ||
When not set, set to empty string, or to `*` the Cluster Operator will operate in all namespaces. | ||
|
@@ -23,9 +23,6 @@ env: | |
|
||
[[STRIMZI_FULL_RECONCILIATION_INTERVAL_MS]] `STRIMZI_FULL_RECONCILIATION_INTERVAL_MS`:: Optional, default is 120000 ms. The interval between periodic reconciliations, in milliseconds. | ||
|
||
`STRIMZI_LOG_LEVEL`:: Optional, default `INFO`. | ||
The level for printing logging messages. The value can be set to: `ERROR`, `WARNING`, `INFO`, `DEBUG`, and `TRACE`. | ||
|
||
`STRIMZI_OPERATION_TIMEOUT_MS`:: Optional, default 300000 ms. | ||
The timeout for internal operations, in milliseconds. This value should be | ||
increased when using Strimzi on clusters where regular Kubernetes operations take longer than usual (because of slow downloading of Docker images, for example). | ||
|
@@ -121,6 +118,32 @@ The DNS domain name is added to the Kafka broker certificates used for hostname | |
+ | ||
If you are using a different DNS domain name suffix in your cluster, change the `KUBERNETES_SERVICE_DNS_DOMAIN` environment variable from the default to the one you are using in order to establish a connection with the Kafka brokers. | ||
|
||
[discrete] | ||
== Configuration by ConfigMap | ||
|
||
Currently only Cluster Operator logging can be configured by ConfigMap. | ||
sknot-rh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
A `ConfigMap` containing logging configuration is created when installing the Cluster Operator. | ||
This `ConfigMap` is described in the file `install/cluster-operator/050-ConfigMap-strimzi-cluster-operator.yaml`. | ||
You configure Cluster Operator logging by changing the data field `log4j2.properties` in this `ConfigMap`. | ||
|
||
To update the logging configuration, you can edit the `050-ConfigMap-strimzi-cluster-operator.yaml` file and then run the following command: | ||
[source,shell,subs=+quotes] | ||
kubectl apply -f _install/cluster-operator/050-ConfigMap-strimzi-cluster-operator.yaml_ | ||
|
||
Alternatively, edit the `ConfigMap` directly: | ||
[source,shell,subs=+quotes] | ||
kubectl edit cm strimzi-cluster-operator | ||
|
||
To change the frequency of the reload interval, set a time in seconds in the monitorInterval option in the created ConfigMap. | ||
sknot-rh marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To change the frequency of the reload interval, set a time in seconds in the |
||
If the `ConfigMap` is missing when the Cluster Operator is deployed, the default logging values are used. | ||
|
||
If the `ConfigMap` is accidentally deleted after the Cluster Operator is deployed, the most recently loaded logging configuration is used. | ||
Create a new `ConfigMap` to load a new logging configuration. | ||
|
||
NOTE: Do not remove the monitorInterval option from the ConfigMap. | ||
|
||
== Periodic reconciliation | ||
|
||
Although the Cluster Operator reacts to all notifications about the desired cluster resources received from the Kubernetes cluster, | ||
|
@@ -174,7 +197,7 @@ The `Deployment` of the operator then needs to specify this in its `spec.templat | |
[source,yaml,numbered,options="nowrap",highlight='12'] | ||
.Partial example of `Deployment` for the Cluster Operator | ||
---- | ||
include::install/cluster-operator/050-Deployment-strimzi-cluster-operator.yaml[lines=1..13] | ||
include::install/cluster-operator/060-Deployment-strimzi-cluster-operator.yaml[lines=1..13] | ||
# ... | ||
---- | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: {{ .Values.logConfigMap }} | ||
data: | ||
log4j2.properties: | | ||
name = COConfig | ||
|
||
appender.console.type = Console | ||
appender.console.name = STDOUT | ||
appender.console.layout.type = PatternLayout | ||
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n | ||
|
||
rootLogger.level = INFO | ||
rootLogger.appenderRefs = stdout | ||
rootLogger.appenderRef.console.ref = STDOUT | ||
rootLogger.additivity = false | ||
|
||
# Kafka AdminClient logging is a bit noisy at INFO level | ||
logger.kafka.name = org.apache.kafka | ||
logger.kafka.level = WARN | ||
logger.kafka.additivity = false | ||
|
||
# Zookeeper is very verbose even on INFO level -> We set it to WARN by default | ||
logger.zookeepertrustmanager.name = org.apache.zookeeper | ||
logger.zookeepertrustmanager.level = WARN | ||
logger.zookeepertrustmanager.additivity = false | ||
monitorInterval = 30 | ||
sknot-rh marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,8 @@ image: | |
repository: strimzi | ||
name: operator | ||
tag: latest | ||
logLevel: INFO | ||
logVolume: cluster-operator-logging-volume | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be |
||
logConfigMap: strimzi-cluster-operator | ||
fullReconciliationIntervalMs: 120000 | ||
operationTimeoutMs: 300000 | ||
kubernetesServiceDnsDomain: cluster.local | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: Looks like this will not get into 0.19.0, so you might need to move this to 0.20.0.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stanlyDoge I still see this here in 0.19.0, should you remove it as asked by Jakub?