mirror of
https://github.com/zalando/postgres-operator.git
synced 2026-10-01 01:53:18 +02:00
Introduce changes from the PR #200 by @alexeyklyukin
This commit is contained in:
@@ -80,7 +80,7 @@ func (c *Controller) moveMasterPodsOffNode(node *v1.Node) {
|
||||
opts := metav1.ListOptions{
|
||||
LabelSelector: labels.Set(c.opConfig.ClusterLabels).String(),
|
||||
}
|
||||
podList, err := c.KubeClient.Pods(c.opConfig.WatchedNamespace).List(opts)
|
||||
podList, err := c.KubeClient.Pods("").List(opts)
|
||||
if err != nil {
|
||||
c.logger.Errorf("could not fetch list of the pods: %v", err)
|
||||
return
|
||||
|
||||
@@ -17,7 +17,7 @@ func (c *Controller) podListFunc(options metav1.ListOptions) (runtime.Object, er
|
||||
TimeoutSeconds: options.TimeoutSeconds,
|
||||
}
|
||||
|
||||
return c.KubeClient.Pods(c.opConfig.WatchedNamespace).List(opts)
|
||||
return c.KubeClient.Pods("").List(opts)
|
||||
}
|
||||
|
||||
func (c *Controller) podWatchFunc(options metav1.ListOptions) (watch.Interface, error) {
|
||||
@@ -27,7 +27,7 @@ func (c *Controller) podWatchFunc(options metav1.ListOptions) (watch.Interface,
|
||||
TimeoutSeconds: options.TimeoutSeconds,
|
||||
}
|
||||
|
||||
return c.KubeClient.Pods(c.opConfig.WatchedNamespace).Watch(opts)
|
||||
return c.KubeClient.Pods("").Watch(opts)
|
||||
}
|
||||
|
||||
func (c *Controller) dispatchPodEvent(clusterName spec.NamespacedName, event spec.PodEvent) {
|
||||
|
||||
@@ -46,7 +46,7 @@ func (c *Controller) clusterListFunc(options metav1.ListOptions) (runtime.Object
|
||||
|
||||
req := c.KubeClient.CRDREST.
|
||||
Get().
|
||||
Namespace(c.opConfig.WatchedNamespace).
|
||||
Namespace("").
|
||||
Resource(constants.CRDResource).
|
||||
VersionedParams(&options, metav1.ParameterCodec)
|
||||
|
||||
@@ -110,7 +110,7 @@ func (c *Controller) clusterWatchFunc(options metav1.ListOptions) (watch.Interfa
|
||||
options.Watch = true
|
||||
r, err := c.KubeClient.CRDREST.
|
||||
Get().
|
||||
Namespace(c.opConfig.WatchedNamespace).
|
||||
Namespace("").
|
||||
Resource(constants.CRDResource).
|
||||
VersionedParams(&options, metav1.ParameterCodec).
|
||||
FieldsSelectorParam(nil).
|
||||
|
||||
@@ -14,9 +14,14 @@ import (
|
||||
)
|
||||
|
||||
// ClusterStatus provides status of the cluster
|
||||
func (c *Controller) ClusterStatus(team, cluster string) (*spec.ClusterStatus, error) {
|
||||
func (c *Controller) ClusterStatus(team, namespace, cluster string) (*spec.ClusterStatus, error) {
|
||||
|
||||
if namespace == "" {
|
||||
namespace = c.opConfig.WatchedNamespace
|
||||
}
|
||||
|
||||
clusterName := spec.NamespacedName{
|
||||
Namespace: c.opConfig.WatchedNamespace,
|
||||
Namespace: namespace,
|
||||
Name: team + "-" + cluster,
|
||||
}
|
||||
|
||||
@@ -90,9 +95,14 @@ func (c *Controller) GetStatus() *spec.ControllerStatus {
|
||||
}
|
||||
|
||||
// ClusterLogs dumps cluster ring logs
|
||||
func (c *Controller) ClusterLogs(team, name string) ([]*spec.LogEntry, error) {
|
||||
func (c *Controller) ClusterLogs(team, namespace, name string) ([]*spec.LogEntry, error) {
|
||||
|
||||
if namespace == "" {
|
||||
namespace = c.opConfig.WatchedNamespace
|
||||
}
|
||||
|
||||
clusterName := spec.NamespacedName{
|
||||
Namespace: c.opConfig.WatchedNamespace,
|
||||
Namespace: namespace,
|
||||
Name: team + "-" + name,
|
||||
}
|
||||
|
||||
@@ -212,9 +222,14 @@ func (c *Controller) WorkerStatus(workerID uint32) (*spec.WorkerStatus, error) {
|
||||
}
|
||||
|
||||
// ClusterHistory dumps history of cluster changes
|
||||
func (c *Controller) ClusterHistory(team, name string) ([]*spec.Diff, error) {
|
||||
func (c *Controller) ClusterHistory(team, namespace, name string) ([]*spec.Diff, error) {
|
||||
|
||||
if namespace == "" {
|
||||
namespace = c.opConfig.WatchedNamespace
|
||||
}
|
||||
|
||||
clusterName := spec.NamespacedName{
|
||||
Namespace: c.opConfig.WatchedNamespace,
|
||||
Namespace: namespace,
|
||||
Name: team + "-" + name,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user