Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
Signed-off-by: Mattia Lavacca <[email protected]>
  • Loading branch information
mlavacca committed Oct 9, 2024
1 parent a891221 commit 1843dc6
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions controller/dataplane/dataplanekonnectextension_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,22 @@ func (r *DataPlaneKonnectExtensionReconciler) listDataPlaneExtensionsReferenced(
}

recs := []reconcile.Request{}
for _, extension := range dataPlane.Spec.Extensions {

for _, ext := range dataPlane.Spec.Extensions {
namespace := dataPlane.Namespace
if extension.Group == operatorv1alpha1.SchemeGroupVersion.Group &&
extension.Kind == operatorv1alpha1.DataPlaneKonnectExtensionKind {
if extension.Namespace != nil {
namespace = *extension.Namespace
}
recs = append(recs, reconcile.Request{
NamespacedName: client.ObjectKey{
Namespace: namespace,
Name: extension.Name,
},
})
if ext.Group != operatorv1alpha1.SchemeGroupVersion.Group ||
ext.Kind != operatorv1alpha1.DataPlaneKonnectExtensionKind {
continue
}
if ext.Namespace != nil && *ext.Namespace != namespace {
continue
}
recs = append(recs, reconcile.Request{
NamespacedName: client.ObjectKey{
Namespace: namespace,
Name: ext.Name,
},
})
}
return recs
}
Expand Down

0 comments on commit 1843dc6

Please sign in to comment.