From 2acc95953b676656254c786bd4ed8a5b308f3b6f Mon Sep 17 00:00:00 2001 From: Andrew Gouin Date: Wed, 18 Oct 2023 00:20:46 -0600 Subject: [PATCH] matching labels --- internal/fullnode/cluster_role_binding_control.go | 6 +++++- internal/fullnode/cluster_role_control.go | 6 +++++- internal/fullnode/service_account_control.go | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/internal/fullnode/cluster_role_binding_control.go b/internal/fullnode/cluster_role_binding_control.go index 12339872..bab8f87a 100644 --- a/internal/fullnode/cluster_role_binding_control.go +++ b/internal/fullnode/cluster_role_binding_control.go @@ -28,7 +28,11 @@ func (sc ClusterRoleBindingControl) Reconcile(ctx context.Context, log kube.Logg var crs rbacv1.ClusterRoleBindingList if err := sc.client.List(ctx, &crs, client.InNamespace(crd.Namespace), - client.MatchingFields{kube.ControllerOwnerField: crd.Name}, + client.MatchingLabels{ + kube.ControllerLabel: "cosmos-operator", + kube.ComponentLabel: cosmosv1.CosmosFullNodeController, + kube.NameLabel: appName(crd), + }, ); err != nil { return kube.TransientError(fmt.Errorf("list existing cluster role bindings: %w", err)) } diff --git a/internal/fullnode/cluster_role_control.go b/internal/fullnode/cluster_role_control.go index 11286398..4fde3618 100644 --- a/internal/fullnode/cluster_role_control.go +++ b/internal/fullnode/cluster_role_control.go @@ -28,7 +28,11 @@ func (sc ClusterRoleControl) Reconcile(ctx context.Context, log kube.Logger, crd var crs rbacv1.ClusterRoleList if err := sc.client.List(ctx, &crs, client.InNamespace(crd.Namespace), - client.MatchingFields{kube.ControllerOwnerField: crd.Name}, + client.MatchingLabels{ + kube.ControllerLabel: "cosmos-operator", + kube.ComponentLabel: cosmosv1.CosmosFullNodeController, + kube.NameLabel: appName(crd), + }, ); err != nil { return kube.TransientError(fmt.Errorf("list existing cluster roles: %w", err)) } diff --git a/internal/fullnode/service_account_control.go b/internal/fullnode/service_account_control.go index 362056d9..bf5af6d5 100644 --- a/internal/fullnode/service_account_control.go +++ b/internal/fullnode/service_account_control.go @@ -28,7 +28,11 @@ func (sc ServiceAccountControl) Reconcile(ctx context.Context, log kube.Logger, var svcs corev1.ServiceAccountList if err := sc.client.List(ctx, &svcs, client.InNamespace(crd.Namespace), - client.MatchingFields{kube.ControllerOwnerField: crd.Name}, + client.MatchingLabels{ + kube.ControllerLabel: "cosmos-operator", + kube.ComponentLabel: cosmosv1.CosmosFullNodeController, + kube.NameLabel: appName(crd), + }, ); err != nil { return kube.TransientError(fmt.Errorf("list existing service accounts: %w", err)) }