Fix deletion of the failed cluster; more debug messages

This commit is contained in:
Murat Kabilov
2017-05-12 11:41:32 +02:00
parent ce90a54cf9
commit bb4fec25ae
5 changed files with 57 additions and 36 deletions
+1 -1
View File
@@ -125,7 +125,7 @@ func (c *Controller) podEventsDispatcher(stopCh <-chan struct{}) {
c.logger.Debugf("Sending %s event of Pod '%s' to the '%s' cluster channel", event.EventType, event.PodName, event.ClusterName)
go subscriber.ReceivePodEvent(event)
} else {
c.logger.Debugf("Skipping Pods unrelated to clusters: %s", event.PodName)
c.logger.Debugf("Skipping %s event of the '%s' pod", event.EventType, event.PodName)
}
case <-stopCh:
return
+3 -3
View File
@@ -98,6 +98,8 @@ func (c *Controller) postgresqlAdd(obj interface{}) {
cl := cluster.New(c.makeClusterConfig(), *pg, c.logger.Logger)
c.clusters[clusterName] = cl
stopCh := make(chan struct{})
c.stopChMap[clusterName] = stopCh
cl.SetStatus(spec.ClusterStatusCreating)
if err := cl.Create(); err != nil {
@@ -106,8 +108,6 @@ func (c *Controller) postgresqlAdd(obj interface{}) {
return
}
cl.SetStatus(spec.ClusterStatusRunning) //TODO: are you sure it's running?
stopCh := make(chan struct{})
c.stopChMap[clusterName] = stopCh
go cl.Run(stopCh)
c.logger.Infof("Postgresql cluster '%s' has been created", clusterName)
@@ -165,7 +165,7 @@ func (c *Controller) postgresqlDelete(obj interface{}) {
return
}
c.logger.Infof("Cluster delete: %s", util.NameFromMeta(pgCur.Metadata))
c.logger.Infof("Starting deletion of the '%s' cluster", util.NameFromMeta(pgCur.Metadata))
if err := pgCluster.Delete(); err != nil {
c.logger.Errorf("Can't delete cluster '%s': %s", clusterName, err)
return