Skip to content

Commit

Permalink
Make the watch namespace on OperatorPolicy conditional
Browse files Browse the repository at this point in the history
If OperatorPolicy is not enabled, the watch namespace shouldn't be set.
It seems that setting the watch namespace causes the watch to start
without the OperatorPolicy controller running.

Signed-off-by: mprahl <mprahl@users.noreply.github.com>
  • Loading branch information
mprahl authored and openshift-merge-bot[bot] committed Jun 10, 2024
1 parent 4f7cda6 commit 23e890e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,13 @@ func main() {
"metadata.namespace": watchNamespace,
}),
}
cacheByObject[&policyv1beta1.OperatorPolicy{}] = cache.ByObject{
Field: fields.SelectorFromSet(fields.Set{
"metadata.namespace": watchNamespace,
}),

if opts.enableOperatorPolicy {
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

0 comments on commit 23e890e

Please sign in to comment.