Skip to content

Commit

Permalink
matching labels
Browse files Browse the repository at this point in the history
  • Loading branch information
agouin committed Oct 18, 2023
1 parent a881273 commit 2acc959
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
6 changes: 5 additions & 1 deletion internal/fullnode/cluster_role_binding_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
6 changes: 5 additions & 1 deletion internal/fullnode/cluster_role_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
6 changes: 5 additions & 1 deletion internal/fullnode/service_account_control.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down

0 comments on commit 2acc959

Please sign in to comment.