Do sync also when there are no deployment
This commit is contained in:
parent
4add317b48
commit
35d82e5a17
|
|
@ -110,17 +110,35 @@ func (c *Cluster) Sync(newSpec *acidv1.Postgresql) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// connection pool
|
// sync connection pool
|
||||||
oldPool := oldSpec.Spec.ConnectionPool
|
if c.needConnectionPool() {
|
||||||
newPool := newSpec.Spec.ConnectionPool
|
oldPool := oldSpec.Spec.ConnectionPool
|
||||||
if c.needConnectionPool() &&
|
newPool := newSpec.Spec.ConnectionPool
|
||||||
(c.ConnectionPool == nil || !reflect.DeepEqual(oldPool, newPool)) {
|
|
||||||
|
|
||||||
c.logger.Debug("syncing connection pool")
|
// do sync in case if any resources were not remembered (it means they
|
||||||
|
// probably were not created, or if specification differs
|
||||||
|
if c.ConnectionPool == nil ||
|
||||||
|
c.ConnectionPool.Deployment == nil ||
|
||||||
|
c.ConnectionPool.Service == nil ||
|
||||||
|
!reflect.DeepEqual(oldPool, newPool) {
|
||||||
|
|
||||||
if err := c.syncConnectionPool(&oldSpec, newSpec); err != nil {
|
c.logger.Debug("syncing connection pool")
|
||||||
c.logger.Errorf("could not sync connection pool: %v", err)
|
|
||||||
return err
|
if err := c.syncConnectionPool(&oldSpec, newSpec); err != nil {
|
||||||
|
c.logger.Errorf("could not sync connection pool: %v", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// check if we need to clean up connection pool resources after it was
|
||||||
|
// disabled
|
||||||
|
if c.ConnectionPool != nil &&
|
||||||
|
(c.ConnectionPool.Deployment != nil ||
|
||||||
|
c.ConnectionPool.Service != nil) {
|
||||||
|
|
||||||
|
if err := c.deleteConnectionPool(); err != nil {
|
||||||
|
c.logger.Warningf("could not remove connection pool: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue