File tree Expand file tree Collapse file tree 4 files changed +22
-15
lines changed Expand file tree Collapse file tree 4 files changed +22
-15
lines changed Original file line number Diff line number Diff line change @@ -339,10 +339,11 @@ configuration they are grouped under the `kubernetes` key.
339339 cannot fully sync it, there can be leftovers. By enabling finalizers the
340340 operator will ensure all managed resources are deleted prior to the
341341 Postgresql resource. There is a trade-off though: The deletion is only
342- performed at the next cluster SYNC cycle when finding a ` deletionTimestamp `
343- in the metadata and not immediately after issueing a delete command. The
344- final removal of the custom resource will add a DELETE event to the worker
345- queue but the child resources are already gone at this point.
342+ performed after the next two SYNC cycles with the first one updating the
343+ internal spec and the latter reacting on the ` deletionTimestamp ` while
344+ processing the SYNC event. The final removal of the custom resource will
345+ add a DELETE event to the worker queue but the child resources are already
346+ gone at this point.
346347 The default is ` false ` .
347348
348349* ** enable_pod_disruption_budget**
Original file line number Diff line number Diff line change @@ -254,14 +254,18 @@ func (c *Cluster) Create() (err error) {
254254 )
255255
256256 defer func () {
257- var pgUpdatedStatus * acidv1.Postgresql
257+ var (
258+ pgUpdatedStatus * acidv1.Postgresql
259+ errStatus error
260+ )
258261 if err == nil {
259- pgUpdatedStatus , err = c .KubeClient .SetPostgresCRDStatus (c .clusterName (), acidv1 .ClusterStatusRunning ) //TODO: are you sure it's running?
262+ pgUpdatedStatus , errStatus = c .KubeClient .SetPostgresCRDStatus (c .clusterName (), acidv1 .ClusterStatusRunning ) //TODO: are you sure it's running?
260263 } else {
261- pgUpdatedStatus , err = c .KubeClient .SetPostgresCRDStatus (c .clusterName (), acidv1 .ClusterStatusAddFailed )
264+ c .logger .Warningf ("cluster created failed: %v" , err )
265+ pgUpdatedStatus , errStatus = c .KubeClient .SetPostgresCRDStatus (c .clusterName (), acidv1 .ClusterStatusAddFailed )
262266 }
263- if err != nil {
264- c .logger .Warningf ("could not set cluster status: %v" , err )
267+ if errStatus != nil {
268+ c .logger .Warningf ("could not set cluster status: %v" , errStatus )
265269 }
266270 if pgUpdatedStatus != nil {
267271 c .setSpec (pgUpdatedStatus )
Original file line number Diff line number Diff line change @@ -41,15 +41,18 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
4141 c .setSpec (newSpec )
4242
4343 defer func () {
44- var pgUpdatedStatus * acidv1.Postgresql
44+ var (
45+ pgUpdatedStatus * acidv1.Postgresql
46+ errStatus error
47+ )
4548 if err != nil {
4649 c .logger .Warningf ("error while syncing cluster state: %v" , err )
47- pgUpdatedStatus , err = c .KubeClient .SetPostgresCRDStatus (c .clusterName (), acidv1 .ClusterStatusSyncFailed )
50+ pgUpdatedStatus , errStatus = c .KubeClient .SetPostgresCRDStatus (c .clusterName (), acidv1 .ClusterStatusSyncFailed )
4851 } else if ! c .Status .Running () {
49- pgUpdatedStatus , err = c .KubeClient .SetPostgresCRDStatus (c .clusterName (), acidv1 .ClusterStatusRunning )
52+ pgUpdatedStatus , errStatus = c .KubeClient .SetPostgresCRDStatus (c .clusterName (), acidv1 .ClusterStatusRunning )
5053 }
51- if err != nil {
52- c .logger .Warningf ("could not set cluster status: %v" , err )
54+ if errStatus != nil {
55+ c .logger .Warningf ("could not set cluster status: %v" , errStatus )
5356 }
5457 if pgUpdatedStatus != nil {
5558 c .setSpec (pgUpdatedStatus )
Original file line number Diff line number Diff line change @@ -339,7 +339,6 @@ func (c *Controller) processEvent(event ClusterEvent) {
339339 lg .Error (cl .Error )
340340 return
341341 }
342- lg .Infof ("cluster has been deleted" )
343342 } else {
344343 if err = cl .Sync (event .NewSpec ); err != nil {
345344 cl .Error = fmt .Sprintf ("could not sync cluster: %v" , err )
You can’t perform that action at this time.
0 commit comments