WIP: support multiple namespaces.

This particular commit makes the operator listen on all namespaces
and introduces an optional namespace to the clusters RESET API
endpoints.
This commit is contained in:
Oleksii Kliukin
2018-01-09 18:36:42 +01:00
parent 23011bdf9a
commit aa517d13b4
7 changed files with 35 additions and 21 deletions
+4
View File
@@ -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
+1 -1
View File
@@ -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.Namespace).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)
}