Skip to content

Commit a5c46b7

Browse files
committed
fix: add Namespace to ListOptions in List calls
1 parent c68ceea commit a5c46b7

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
1616
- Refactor project structure, all helm charts are collected in one place
1717
- Update crds api version from `apiextensions.k8s.io/v1beta1` to `apiextensions.k8s.io/v1`
1818

19+
### Fixed
20+
21+
- Operator was not able to manage multiple cartridge clusters in multiple namespaces
22+
1923
## [0.0.9] - 2021-03-30
2024

2125
### Added

controllers/cluster_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
138138
}
139139

140140
roleList := &tarantooliov1alpha1.RoleList{}
141-
if err := r.List(context.TODO(), roleList, &client.ListOptions{LabelSelector: clusterSelector}); err != nil {
141+
if err := r.List(context.TODO(), roleList, &client.ListOptions{LabelSelector: clusterSelector, Namespace: req.NamespacedName.Namespace}); err != nil {
142142
if errors.IsNotFound(err) {
143143
return ctrl.Result{RequeueAfter: time.Duration(5 * time.Second)}, nil
144144
}
@@ -221,7 +221,7 @@ func (r *ClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
221221
}
222222

223223
stsList := &appsv1.StatefulSetList{}
224-
if err := r.List(context.TODO(), stsList, &client.ListOptions{LabelSelector: clusterSelector}); err != nil {
224+
if err := r.List(context.TODO(), stsList, &client.ListOptions{LabelSelector: clusterSelector, Namespace: req.NamespacedName.Namespace}); err != nil {
225225
if errors.IsNotFound(err) {
226226
return ctrl.Result{RequeueAfter: time.Duration(5 * time.Second)}, nil
227227
}

controllers/role_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (r *RoleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
102102
}
103103

104104
stsList := &appsv1.StatefulSetList{}
105-
if err := r.List(context.TODO(), stsList, &client.ListOptions{LabelSelector: s}); err != nil {
105+
if err := r.List(context.TODO(), stsList, &client.ListOptions{LabelSelector: s, Namespace: req.NamespacedName.Namespace}); err != nil {
106106
return ctrl.Result{}, err
107107
}
108108

@@ -134,7 +134,7 @@ func (r *RoleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.
134134
}
135135

136136
templateList := &tarantooliov1alpha1.ReplicasetTemplateList{}
137-
if err := r.List(context.TODO(), templateList, &client.ListOptions{LabelSelector: templateSelector}); err != nil {
137+
if err := r.List(context.TODO(), templateList, &client.ListOptions{LabelSelector: templateSelector, Namespace: req.NamespacedName.Namespace}); err != nil {
138138
return ctrl.Result{}, err
139139
}
140140

0 commit comments

Comments
 (0)