mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-09-30 13:33:50 +02:00
Sync clusters states
* move statefulset creation from cluster spec to the separate function * sync cluster state with desired state; * move out from arrays for cluster resources; * recreate pods instead of deleting them in case of statefulset change * check for master while creating cluster/updating pods * simplify retryutil * list pvc while listing resources * name kubernetes resources with capital letter * do rolling update in case of env variables change
This commit is contained in:
@@ -117,15 +117,15 @@ func (c *Controller) podDelete(obj interface{}) {
|
||||
}
|
||||
|
||||
func (c *Controller) podEventsDispatcher(stopCh <-chan struct{}) {
|
||||
c.logger.Infof("Watching all pod events")
|
||||
c.logger.Infof("Watching all Pod events")
|
||||
for {
|
||||
select {
|
||||
case event := <-c.podCh:
|
||||
if subscriber, ok := c.clusters[event.ClusterName]; ok {
|
||||
c.logger.Debugf("Sending %s event of pod '%s' to the '%s' cluster channel", event.EventType, event.PodName, event.ClusterName)
|
||||
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 Pods unrelated to clusters: %s", event.PodName)
|
||||
}
|
||||
case <-stopCh:
|
||||
return
|
||||
|
||||
@@ -53,7 +53,9 @@ func (c *Controller) clusterListFunc(options api.ListOptions) (runtime.Object, e
|
||||
c.clusters[clusterName] = cl
|
||||
cl.LoadResources()
|
||||
go cl.Run(stopCh)
|
||||
|
||||
cl.ListResources()
|
||||
cl.SyncCluster()
|
||||
}
|
||||
if len(c.clusters) > 0 {
|
||||
c.logger.Infof("There are %d clusters currently running", len(c.clusters))
|
||||
|
||||
@@ -24,7 +24,7 @@ func (c *Controller) getOAuthToken() (string, error) {
|
||||
credentialsSecret, err := c.config.KubeClient.Secrets(api.NamespaceDefault).Get(constants.OAuthTokenSecretName)
|
||||
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("Can't get credentials secret: %s", err)
|
||||
return "", fmt.Errorf("Can't get credentials Secret: %s", err)
|
||||
}
|
||||
data := credentialsSecret.Data
|
||||
|
||||
|
||||
Reference in New Issue
Block a user