Skip to content

Commit

Permalink
fix: remove invalid owner ref on cluster role (#460)
Browse files Browse the repository at this point in the history
Cluster roles aren't namespace-scoped and can't have namespace-scoped
owner references.

Closes COO-117

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
  • Loading branch information
simonpasquier committed Apr 17, 2024
1 parent 65ea6bd commit fc12c57
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions pkg/controllers/monitoring/monitoring-stack/alertmanager.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ func newAlertManagerClusterRole(ms *stack.MonitoringStack, rbacResourceName stri
Kind: "ClusterRole",
},
ObjectMeta: metav1.ObjectMeta{
Name: rbacResourceName,
Namespace: ms.Namespace,
Name: rbacResourceName,
},
Rules: []rbacv1.PolicyRule{{
APIGroups: []string{"security.openshift.io"},
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type Updater struct {
}

func (r Updater) Reconcile(ctx context.Context, c client.Client, scheme *runtime.Scheme) error {

if r.resourceOwner.GetNamespace() == r.resource.GetNamespace() {
if err := controllerutil.SetControllerReference(r.resourceOwner, r.resource, scheme); err != nil {
return fmt.Errorf("%s/%s (%s): updater failed to set owner reference: %w",
Expand All @@ -39,6 +38,7 @@ func (r Updater) Reconcile(ctx context.Context, c client.Client, scheme *runtime
r.resource.GetNamespace(), r.resource.GetName(),
r.resource.GetObjectKind().GroupVersionKind().String(), err)
}

return nil
}

Expand Down

0 comments on commit fc12c57

Please sign in to comment.