-
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
Conversation
...-operator/src/main/resources/config-maps/050-ConfigMap-strimzi-cluster-operator-logging.yaml
Outdated
Show resolved
Hide resolved
...s/helm2/strimzi-kafka-operator/templates/050-ConfigMap-strimzi-cluster-operator-logging.yaml
Outdated
Show resolved
Hide resolved
...s/helm3/strimzi-kafka-operator/templates/050-ConfigMap-strimzi-cluster-operator-logging.yaml
Outdated
Show resolved
Hide resolved
install/cluster-operator/050-ConfigMap-strimzi-cluster-operator-logging.yaml
Outdated
Show resolved
Hide resolved
install/cluster-operator/051-Deployment-strimzi-cluster-operator.yaml
Outdated
Show resolved
Hide resolved
@@ -20,7 +20,7 @@ | |||
public class BundleResource { | |||
private static final Logger LOGGER = LogManager.getLogger(BundleResource.class); | |||
|
|||
public static final String PATH_TO_CO_CONFIG = "../install/cluster-operator/050-Deployment-strimzi-cluster-operator.yaml"; | |||
public static final String PATH_TO_CO_CONFIG = "../install/cluster-operator/060-Deployment-strimzi-cluster-operator.yaml"; |
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.
@Frawless Will these renamings play well with upgrade tests which use different versions?
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.
Interesting question, in upgrade tests, we change this file only for upgrade to HEAD, for older versions we basically do kubectl apply -f /tmp/upgrade-54556445/strimzi-0.x.y/install/cluster-operator
and for HEAD Standa did proper changes from my POV. Let's try to run upgrade tests and we will see.
@strimzi-ci run tests profile=upgrade testcase=StrimziUpgradeST#testUpgradeStrimziVersion |
@@ -17,6 +17,10 @@ spec: | |||
strimzi.io/kind: cluster-operator |
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.
Why are we switching 50 to 60? Are none of the numbers between 40-50 appropriate for the new CM?
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.
04x
are for the CRDs. The numbers are basically just an aid for listing files. We need to have ConfigMap file before Deployment. Switching Deployment to 060 makes some space to any future ConfigMap. Maybe @scholzj has more comments.
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.
I'd also argue 51
would also be appropriate for the CM (keeping deployment as 50
) as the CM should not need to be created prior to the deployment due to the dynamic file watcher?
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.
Well, we used different numbers for different types of resources so far. This really just continues.
✔️ Test Summary ✔️TEST_PROFILE: upgrade |
install/cluster-operator/050-ConfigMap-strimzi-cluster-operator-logging.yaml
Outdated
Show resolved
Hide resolved
...s/helm3/strimzi-kafka-operator/templates/050-ConfigMap-strimzi-cluster-operator-logging.yaml
Outdated
Show resolved
Hide resolved
...s/helm3/strimzi-kafka-operator/templates/050-ConfigMap-strimzi-cluster-operator-logging.yaml
Outdated
Show resolved
Hide resolved
helm-charts/helm2/strimzi-kafka-operator/templates/060-Deployment-strimzi-cluster-operator.yaml
Show resolved
Hide resolved
|
||
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 comment
The 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?
Easier to predict behaviour if we don't have this if check here, I can imagine us having to suggets users restart operator pod to make the operator run through this logic again.
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Can we echo
something to say that a static logging configuration is being used because no config was found, and therefore that dynamic log config update won't work.
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.
The code looks good to me. But I think we need to have also some docs:
- You should remove
STRIMZI_LOG_LEVEL
from the docs - You should probably add some small chapter about the log configuration into https://strimzi.io/docs/operators/latest/full/using.html#assembly-operators-cluster-operator-str or something like that.
@@ -121,6 +118,31 @@ 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. | |||
|
|||
== Logging configuration |
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.
@PaulRMellor @laidan6000
Could you please check these changes?
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 👍
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.
Some nits to the docs. But looks mostly good.
CHANGELOG.md
Outdated
@@ -22,6 +22,7 @@ | |||
* enable/disable metrics in the KafkaBridge custom resource | |||
* new Grafana dashboard for the bridge metrics | |||
* Support dynamically changeable logging in the Entity Operator and Kafka Bridge | |||
* Configure Cluster Operator logging using ConfigMap instead of environment variable and support dynamic changes |
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?
Signed-off-by: Stanislav Knot <sknot@redhat.com>
Signed-off-by: Stanislav Knot <sknot@redhat.com>
Signed-off-by: Stanislav Knot <sknot@redhat.com>
Signed-off-by: Stanislav Knot <sknot@redhat.com>
Signed-off-by: Stanislav Knot <sknot@redhat.com>
Signed-off-by: Stanislav Knot <sknot@redhat.com>
Signed-off-by: Stanislav Knot <sknot@redhat.com>
Signed-off-by: Stanislav Knot <sknot@redhat.com>
Signed-off-by: Stanislav Knot <sknot@redhat.com>
Signed-off-by: Stanislav Knot <sknot@redhat.com>
@@ -17,6 +17,10 @@ spec: | |||
strimzi.io/kind: cluster-operator | |||
spec: | |||
serviceAccountName: strimzi-cluster-operator | |||
volumes: | |||
- name: co-logging-volume |
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.
even in this case the volume could be about co-configuration not just logging?
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
should be co-config-volume
as for the Helm 3 values YAML.
Signed-off-by: Stanislav Knot <sknot@redhat.com>
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Can we echo
something to say that a static logging configuration is being used because no config was found, and therefore that dynamic log config update won't work.
helm-charts/helm2/strimzi-kafka-operator/templates/050-ConfigMap-strimzi-cluster-operator.yaml
Outdated
Show resolved
Hide resolved
Signed-off-by: Stanislav Knot <sknot@redhat.com>
# 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" | ||
else | ||
echo "Configuration file log4j2.properties not found. Using default static logging setting. Dynamic updates of logging configuration will not work." |
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.
@laidan6000 Can you please review this message?
* co dyn log Signed-off-by: Stanislav Knot <sknot@redhat.com> * rename files Signed-off-by: Stanislav Knot <sknot@redhat.com> * delete file Signed-off-by: Stanislav Knot <sknot@redhat.com> * default conf Signed-off-by: Stanislav Knot <sknot@redhat.com> * commit Signed-off-by: Stanislav Knot <sknot@redhat.com> * remove redundant vars Signed-off-by: Stanislav Knot <sknot@redhat.com> * Sam's comments Signed-off-by: Stanislav Knot <sknot@redhat.com> * consistency Signed-off-by: Stanislav Knot <sknot@redhat.com> * comment Signed-off-by: Stanislav Knot <sknot@redhat.com> * docu Signed-off-by: Stanislav Knot <sknot@redhat.com> * docomments Signed-off-by: Stanislav Knot <sknot@redhat.com> * rebase + move to 0.20.0 Signed-off-by: Stanislav Knot <sknot@redhat.com> * addressing comments Signed-off-by: Stanislav Knot <sknot@redhat.com> * avoid logging Signed-off-by: Stanislav Knot <sknot@redhat.com> * another comment Signed-off-by: Stanislav Knot <sknot@redhat.com> * Tom's comments Signed-off-by: Stanislav Knot <sknot@redhat.com>
Type of change
Description
The CO is deployed as a
Deployment
so it is not possible just change envvar without rolling update. We need to use an external confingmap (maybe we should allow to configure its name).Whenever this configmap is updated, the volume is updated and thanks to
monitorInterval
entry in thelog4j2.properties
the configuration is reloaded.Checklist