File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,18 @@ func (c *Cluster) Sync(newSpec *spec.Postgresql) (err error) {
5050 return
5151 }
5252
53+ // potentially enlarge volumes before changing the statefulset. By doing that
54+ // in this order we make sure the operator is not stuck waiting for a pod that
55+ // cannot start because it ran out of disk space.
56+ // TODO: handle the case of the cluster that is downsized and enlarged again
57+ // (there will be a volume from the old pod for which we can't act before the
58+ // the statefulset modification is concluded)
59+ c .logger .Debugf ("syncing persistent volumes" )
60+ if err = c .syncVolumes (); err != nil {
61+ err = fmt .Errorf ("could not sync persistent volumes: %v" , err )
62+ return
63+ }
64+
5365 c .logger .Debugf ("syncing statefulsets" )
5466 if err = c .syncStatefulSet (); err != nil {
5567 if ! k8sutil .ResourceAlreadyExists (err ) {
@@ -72,12 +84,6 @@ func (c *Cluster) Sync(newSpec *spec.Postgresql) (err error) {
7284 }
7385 }
7486
75- c .logger .Debugf ("syncing persistent volumes" )
76- if err = c .syncVolumes (); err != nil {
77- err = fmt .Errorf ("could not sync persistent volumes: %v" , err )
78- return
79- }
80-
8187 c .logger .Debug ("syncing pod disruption budgets" )
8288 if err = c .syncPodDisruptionBudget (false ); err != nil {
8389 err = fmt .Errorf ("could not sync pod disruption budget: %v" , err )
You can’t perform that action at this time.
0 commit comments