Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
CecileRobertMichon committed Oct 4, 2023
1 parent 12f29a9 commit a5e3709
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions azure/services/groups/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,13 @@ func New(scope GroupScope) *Service {
}
}

// isGroupManaged returns true if the ASO ResourceGroup was created by CAPZ,
// meaning that the resource group's lifecycle is managed.
func (s *Service) isGroupManaged(ctx context.Context, spec azure.ASOResourceSpecGetter[*asoresourcesv1.ResourceGroup]) (bool, error) {
return aso.IsManaged(ctx, s.Scope.GetClient(), spec, s.Scope.ClusterName())
}

// IsManaged returns false if the resource group is
// true and reconciled by ASO, meaning that we can rely on a single resource
// managed and reconciled by ASO, meaning that we can rely on a single resource
// group delete operation as opposed to deleting every individual resource.
func (s *Service) IsManaged(ctx context.Context) (bool, error) {
// Unless all resource groups are managed by CAPZ and reconciled by ASO, resources need to be deleted individually.
for _, spec := range s.Specs {
managed, err := s.isGroupManaged(ctx, spec)
managed, err := aso.IsManaged(ctx, s.Scope.GetClient(), spec, s.Scope.ClusterName())
if err != nil || !managed {
return managed, err
}
Expand Down

0 comments on commit a5e3709

Please sign in to comment.