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) {
50
50
return
51
51
}
52
52
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
+
53
65
c .logger .Debugf ("syncing statefulsets" )
54
66
if err = c .syncStatefulSet (); err != nil {
55
67
if ! k8sutil .ResourceAlreadyExists (err ) {
@@ -72,12 +84,6 @@ func (c *Cluster) Sync(newSpec *spec.Postgresql) (err error) {
72
84
}
73
85
}
74
86
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
-
81
87
c .logger .Debug ("syncing pod disruption budgets" )
82
88
if err = c .syncPodDisruptionBudget (false ); err != nil {
83
89
err = fmt .Errorf ("could not sync pod disruption budget: %v" , err )
You can’t perform that action at this time.
0 commit comments