Skip to content

Commit ffb5445

Browse files
author
tony-landreth
committed
Acknowledge NotFound error for monitor user
1 parent 476452e commit ffb5445

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

internal/controller/postgrescluster/instance.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,15 +1213,13 @@ func (r *Reconciler) reconcileInstance(
12131213
feature.Enabled(ctx, feature.OpenTelemetryMetrics) {
12141214

12151215
monitoringUserSecret := &corev1.Secret{ObjectMeta: naming.MonitoringUserSecret(cluster)}
1216-
err := errors.WithStack(
1216+
err = errors.WithStack(
12171217
r.Client.Get(ctx, client.ObjectKeyFromObject(monitoringUserSecret), monitoringUserSecret))
12181218

1219-
if client.IgnoreNotFound(err) != nil {
1220-
return err
1219+
if err == nil {
1220+
collector.AddToPod(ctx, cluster.Spec.Instrumentation, cluster.Spec.ImagePullPolicy, instanceConfigMap, &instance.Spec.Template.Spec,
1221+
[]corev1.VolumeMount{postgres.DataVolumeMount()}, string(monitoringUserSecret.Data["password"]), false)
12211222
}
1222-
1223-
collector.AddToPod(ctx, cluster.Spec.Instrumentation, cluster.Spec.ImagePullPolicy, instanceConfigMap, &instance.Spec.Template.Spec,
1224-
[]corev1.VolumeMount{postgres.DataVolumeMount()}, string(monitoringUserSecret.Data["password"]), false)
12251223
}
12261224

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

0 commit comments

Comments
 (0)