Skip to content

Commit

Permalink
Fix rollingRestart reconcile for multiple same named clusters (opense…
Browse files Browse the repository at this point in the history
…arch-project#836)

### Description
Fixes a bug where reconcile breaks, if there are multiple same named
OpensearchClusters in different namespaces.
The rollingRestart reconciler selects pods in all namespaces when
evaluating if the Pods are healthy and matches them with the desired
replicas. Only pods in the own namespace should be checked.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and
signing off your commits, please check
[here](https://github.com/opensearch-project/OpenSearch/blob/main/CONTRIBUTING.md#developer-certificate-of-origin).

---------

Signed-off-by: Alex Engel <[email protected]>
Signed-off-by: rkthtrifork <[email protected]>
  • Loading branch information
OlegVanHorst authored and rkthtrifork committed Aug 21, 2024
1 parent fd4be23 commit b2e12b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions opensearch-operator/pkg/helpers/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func CountRunningPodsForNodePool(k8sClient k8s.K8sClient, cr *opsterv1.OpenSearc
selector := labels.NewSelector()
selector = selector.Add(*clusterReq, *componentReq)
// List pods matching selector
list, err := k8sClient.ListPods(&client.ListOptions{LabelSelector: selector})
list, err := k8sClient.ListPods(&client.ListOptions{Namespace: cr.Namespace, LabelSelector: selector})
if err != nil {
return 0, err
}
Expand Down Expand Up @@ -281,7 +281,7 @@ func CountPVCsForNodePool(k8sClient k8s.K8sClient, cr *opsterv1.OpenSearchCluste
}
selector := labels.NewSelector()
selector = selector.Add(*clusterReq, *componentReq)
list, err := k8sClient.ListPVCs(&client.ListOptions{LabelSelector: selector})
list, err := k8sClient.ListPVCs(&client.ListOptions{Namespace: cr.Namespace, LabelSelector: selector})
if err != nil {
return 0, err
}
Expand Down

0 comments on commit b2e12b1

Please sign in to comment.