Skip to content

fix: include logrotate on collector only if local volumes are setup #4195

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions internal/controller/postgrescluster/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1220,10 +1220,12 @@ func (r *Reconciler) reconcileInstance(

// For now, we are not using logrotate to rotate postgres or patroni logs,
// but we are using it for pgbackrest logs in the postgres pod, so we will
// set includeLogrotate to true, but only if backups are enabled.
// set includeLogrotate to true, but only if backups are enabled
// and local volumes are available.
includeLogrotate := backupsSpecFound && pgbackrest.RepoHostVolumeDefined(cluster)
collector.AddToPod(ctx, cluster.Spec.Instrumentation, cluster.Spec.ImagePullPolicy, instanceConfigMap, &instance.Spec.Template,
[]corev1.VolumeMount{postgres.DataVolumeMount()}, pgPassword,
[]string{naming.PGBackRestPGDataLogPath}, backupsSpecFound, true)
[]string{naming.PGBackRestPGDataLogPath}, includeLogrotate, true)
}

// Add postgres-exporter to the instance Pod spec
Expand Down