Allow parallel processing of ops with the same name in diff namespaces#1617
Allow parallel processing of ops with the same name in diff namespaces#1617kodiak-appscode[bot] merged 4 commits intomasterfrom
Conversation
…spaces Signed-off-by: Neaj Morshad <neaj@appscode.com>
There was a problem hiding this comment.
Pull request overview
Updates OpsRequest progressing-phase gating so OpsRequests targeting databases with the same name in different namespaces can proceed in parallel, avoiding cross-namespace blocking.
Changes:
- Add namespace scoping to the “another ops is already progressing” detection logic.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pkg/controller/opsrequest.go
Outdated
| if ops.GetName() == req.GetName() || ops.GetDBRefName() != req.GetDBRefName() || ops.GetNamespace() != req.GetNamespace() { | ||
| continue |
There was a problem hiding this comment.
This loop lists all OpsRequests cluster-wide and then filters by namespace/DBRef in-code. Now that namespace scoping is required for correctness, consider calling kbClient.List with client.InNamespace(req.GetNamespace()) (and, if feasible, an index/field selector for DBRefName) to avoid O(total OpsRequests) API responses and reduce apiserver/controller load; then the ops.GetNamespace() != req.GetNamespace() filter can be removed/simplified.
There was a problem hiding this comment.
I think this is a good suggestion.
@Neaj-Morshad-101 Use namespace in the client.ListOptions, then this change is not needed. Less iteration needed.
pkg/controller/opsrequest.go
Outdated
| if ops.GetName() == req.GetName() || ops.GetDBRefName() != req.GetDBRefName() || ops.GetNamespace() != req.GetNamespace() { | ||
| continue |
There was a problem hiding this comment.
I think this is a good suggestion.
@Neaj-Morshad-101 Use namespace in the client.ListOptions, then this change is not needed. Less iteration needed.
…spaces