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.
339
339
cannot fully sync it, there can be leftovers. By enabling finalizers the
340
340
operator will ensure all managed resources are deleted prior to the
341
341
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.
346
347
The default is ` false ` .
347
348
348
349
* ** enable_pod_disruption_budget**
Original file line number Diff line number Diff line change @@ -254,14 +254,18 @@ func (c *Cluster) Create() (err error) {
254
254
)
255
255
256
256
defer func () {
257
- var pgUpdatedStatus * acidv1.Postgresql
257
+ var (
258
+ pgUpdatedStatus * acidv1.Postgresql
259
+ errStatus error
260
+ )
258
261
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?
260
263
} 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 )
262
266
}
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 )
265
269
}
266
270
if pgUpdatedStatus != nil {
267
271
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 {
41
41
c .setSpec (newSpec )
42
42
43
43
defer func () {
44
- var pgUpdatedStatus * acidv1.Postgresql
44
+ var (
45
+ pgUpdatedStatus * acidv1.Postgresql
46
+ errStatus error
47
+ )
45
48
if err != nil {
46
49
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 )
48
51
} 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 )
50
53
}
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 )
53
56
}
54
57
if pgUpdatedStatus != nil {
55
58
c .setSpec (pgUpdatedStatus )
Original file line number Diff line number Diff line change @@ -339,7 +339,6 @@ func (c *Controller) processEvent(event ClusterEvent) {
339
339
lg .Error (cl .Error )
340
340
return
341
341
}
342
- lg .Infof ("cluster has been deleted" )
343
342
} else {
344
343
if err = cl .Sync (event .NewSpec ); err != nil {
345
344
cl .Error = fmt .Sprintf ("could not sync cluster: %v" , err )
You can’t perform that action at this time.
0 commit comments