mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-01 08:36:55 +02:00
Merge pull request #225 from zalando-incubator/support-many-namespaces
Support many namespaces
This commit is contained in:
@@ -127,6 +127,10 @@ func (c *Cluster) clusterName() spec.NamespacedName {
|
||||
return util.NameFromMeta(c.ObjectMeta)
|
||||
}
|
||||
|
||||
func (c *Cluster) clusterNamespace() string {
|
||||
return c.ObjectMeta.Namespace
|
||||
}
|
||||
|
||||
func (c *Cluster) teamName() string {
|
||||
// TODO: check Teams API for the actual name (in case the user passes an integer Id).
|
||||
return c.Spec.TeamID
|
||||
|
||||
@@ -110,7 +110,7 @@ func (c *Cluster) preScaleDown(newStatefulSet *v1beta1.StatefulSet) error {
|
||||
}
|
||||
|
||||
podName := fmt.Sprintf("%s-0", c.Statefulset.Name)
|
||||
masterCandidatePod, err := c.KubeClient.Pods(c.OpConfig.WatchedNamespace).Get(podName, metav1.GetOptions{})
|
||||
masterCandidatePod, err := c.KubeClient.Pods(c.clusterNamespace()).Get(podName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return fmt.Errorf("could not get master candidate pod: %v", err)
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ func (c *Cluster) Sync(newSpec *spec.Postgresql) (err error) {
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
c.logger.Warningf("error while syncing cluster state: %v", err)
|
||||
c.setStatus(spec.ClusterStatusSyncFailed)
|
||||
} else if c.Status != spec.ClusterStatusRunning {
|
||||
c.setStatus(spec.ClusterStatusRunning)
|
||||
|
||||
Reference in New Issue
Block a user