Skip to content

Commit 71b7c08

Browse files
vbeauchaandrewlecuyer
authored andcommitted
Include logrotate on collector if local volumes are setup
1 parent b53c028 commit 71b7c08

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

internal/controller/postgrescluster/instance.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,10 +1221,12 @@ func (r *Reconciler) reconcileInstance(
12211221

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

12301232
// Add postgres-exporter to the instance Pod spec

0 commit comments

Comments
 (0)