Skip to content

Commit 8b1e465

Browse files
authored
Merge pull request #1263 from dannyzaken/danny-postgres
Added preStop hook to DB statefulset
2 parents bbef9b2 + 92e187c commit 8b1e465

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/system/phase2_creating.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,15 @@ func (r *Reconciler) SetDesiredNooBaaDB() error {
309309
if r.NooBaa.Spec.DBResources != nil {
310310
c.Resources = *r.NooBaa.Spec.DBResources
311311
}
312+
313+
c.Lifecycle = &corev1.Lifecycle{
314+
PreStop: &corev1.LifecycleHandler{
315+
Exec: &corev1.ExecAction{
316+
Command: []string{"/bin/sh", "-c", "pg_ctl -D /var/lib/pgsql/data/userdata/ -w -t 60 -m fast stop"},
317+
},
318+
},
319+
}
320+
312321
}
313322
}
314323

0 commit comments

Comments
 (0)