Do not create roles if cluster is masterless

fix pod deletion
This commit is contained in:
Murat Kabilov
2017-05-12 11:41:34 +02:00
parent da438aab3a
commit a7c57874d5
5 changed files with 59 additions and 42 deletions
+2 -5
View File
@@ -48,10 +48,8 @@ func (c *Controller) clusterListFunc(options api.ListOptions) (runtime.Object, e
c.stopChMap[clusterName] = stopCh
c.clusters[clusterName] = cl
cl.LoadResources()
go cl.Run(stopCh)
cl.ListResources()
cl.SyncCluster()
cl.SyncCluster(stopCh)
}
if len(c.clusters) > 0 {
c.logger.Infof("There are %d clusters currently running", len(c.clusters))
@@ -95,13 +93,12 @@ func (c *Controller) postgresqlAdd(obj interface{}) {
c.stopChMap[clusterName] = stopCh
cl.SetStatus(spec.ClusterStatusCreating)
if err := cl.Create(); err != nil {
if err := cl.Create(stopCh); err != nil {
c.logger.Errorf("Can't create cluster: %s", err)
cl.SetStatus(spec.ClusterStatusAddFailed)
return
}
cl.SetStatus(spec.ClusterStatusRunning) //TODO: are you sure it's running?
go cl.Run(stopCh)
c.logger.Infof("Postgresql cluster '%s' has been created", clusterName)
}