From 2eb7e67b5a0e97ad55a5c1f1e955eb27a0967bd3 Mon Sep 17 00:00:00 2001 From: Ben Blattberg Date: Mon, 24 Mar 2025 10:48:01 -0500 Subject: [PATCH 1/2] Fix bug in logrotate mounting logrotate conf should be optional --- internal/collector/instance.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/collector/instance.go b/internal/collector/instance.go index 54081b2684..401c0ace73 100644 --- a/internal/collector/instance.go +++ b/internal/collector/instance.go @@ -152,6 +152,7 @@ func AddToPod( Key: "logrotate.conf", Path: "logrotate.conf", }}, + Optional: initialize.Bool(true), }, }}, } From 054dbff7df0e1f21002ef152c0cc1105f9496ca6 Mon Sep 17 00:00:00 2001 From: Ben Blattberg Date: Mon, 24 Mar 2025 11:05:02 -0500 Subject: [PATCH 2/2] Change logic to includeLogrotate Only logrotate if - boolean is true and - OTel log gate is on --- internal/collector/instance.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/collector/instance.go b/internal/collector/instance.go index 401c0ace73..f37eb7f4c3 100644 --- a/internal/collector/instance.go +++ b/internal/collector/instance.go @@ -54,6 +54,11 @@ func AddToPod( return } + // We only want to include log rotation if this type of pod requires it + // (indicate by the includeLogrotate boolean) AND if logging is enabled + // for this PostgresCluster/PGAdmin + includeLogrotate = includeLogrotate && OpenTelemetryLogsEnabled(ctx, spec) + // Create volume and volume mount for otel collector config configVolumeMount := corev1.VolumeMount{ Name: "collector-config", @@ -152,7 +157,6 @@ func AddToPod( Key: "logrotate.conf", Path: "logrotate.conf", }}, - Optional: initialize.Bool(true), }, }}, }