Skip to content

Commit

Permalink
cluster: limit CSV list for operator namespace for GetPlatform
Browse files Browse the repository at this point in the history
Depending of the way operators installed CSVs can be seen in all
namespace so listing of them causes producing N * M results (where N
is number of namespaces and M is number of CSVs) which is not
scalable in general and in practice causes timeouts on such large
clusters.

Since the operator's CSV is seen in all the namespaces limit the
request to own namespace. In case of error of determining it, it
looks up all namespace so falls back to the old behaviour.

Signed-off-by: Yauheni Kaliuta <[email protected]>
  • Loading branch information
ykaliuta committed Jun 11, 2024
1 parent 244ca13 commit bd2548a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/cluster/cluster_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ type Platform string
// otherwise return "",err.
func isSelfManaged(cli client.Client) (Platform, error) {
clusterCsvs := &ofapi.ClusterServiceVersionList{}
err := cli.List(context.TODO(), clusterCsvs)
// limit request to own namespace or since the operator is seen in all it can be too big
// ignore error, "" in this case is acceptable for functionality
ns, _ := GetOperatorNamespace()
err := cli.List(context.TODO(), clusterCsvs, client.InNamespace(ns))
if err != nil {
return "", err
} else { //nolint:golint,revive // Readability on else
Expand Down

0 comments on commit bd2548a

Please sign in to comment.