Skip to content

Commit

Permalink
Limit the OperatorPolicy watches to the managed cluster namespace
Browse files Browse the repository at this point in the history
Always having a clusterwide watch is incompatible with hosted mode and
does not match ConfigurationPolicy.

Related:
https://issues.redhat.com/browse/ACM-11952

Signed-off-by: mprahl <mprahl@users.noreply.github.com>
  • Loading branch information
mprahl authored and openshift-merge-bot[bot] committed May 31, 2024
1 parent 3a75ad9 commit 324a374
Show file tree
Hide file tree
Showing 2 changed files with 95 additions and 83 deletions.
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ func main() {
"metadata.namespace": watchNamespace,
}),
}
cacheByObject[&policyv1beta1.OperatorPolicy{}] = cache.ByObject{
Field: fields.SelectorFromSet(fields.Set{
"metadata.namespace": watchNamespace,
}),
}
} else {
log.Info("Skipping restrictions on the ConfigurationPolicy cache because watchNamespace is empty")
}
Expand Down
Loading

0 comments on commit 324a374

Please sign in to comment.