Skip to content

Commit 09c01b7

Browse files
committed
fixup! ASOAPI: add resource mutator framework
1 parent bbc4d0c commit 09c01b7

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

exp/controllers/azureasomanagedcluster_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func (r *AzureASOManagedClusterReconciler) reconcileNormal(ctx context.Context,
227227
return ctrl.Result{Requeue: true}, nil
228228
}
229229

230-
resources, err := mutators.ApplyMutators(ctx, asoManagedCluster.Spec.Resources)
230+
resources, err := mutators.ToUnstructured(ctx, asoManagedCluster.Spec.Resources)
231231
if err != nil {
232232
return ctrl.Result{}, err
233233
}
@@ -279,7 +279,7 @@ func (r *AzureASOManagedClusterReconciler) reconcileDelete(ctx context.Context,
279279
defer done()
280280
log.V(4).Info("reconciling delete")
281281

282-
resources, err := mutators.ApplyMutators(ctx, asoManagedCluster.Spec.Resources)
282+
resources, err := mutators.ToUnstructured(ctx, asoManagedCluster.Spec.Resources)
283283
if err != nil {
284284
return ctrl.Result{}, err
285285
}

exp/controllers/azureasomanagedcontrolplane_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func (r *AzureASOManagedControlPlaneReconciler) reconcileDelete(ctx context.Cont
296296
defer done()
297297
log.V(4).Info("reconciling delete")
298298

299-
resources, err := mutators.ApplyMutators(ctx, asoManagedControlPlane.Spec.Resources)
299+
resources, err := mutators.ToUnstructured(ctx, asoManagedControlPlane.Spec.Resources)
300300
if err != nil {
301301
return ctrl.Result{}, err
302302
}

exp/controllers/azureasomanagedmachinepool_controller.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func (r *AzureASOManagedMachinePoolReconciler) reconcileDelete(ctx context.Conte
312312
// If the entire cluster is being deleted, this ASO ManagedClustersAgentPool will be deleted with the rest
313313
// of the ManagedCluster.
314314
if cluster.DeletionTimestamp.IsZero() {
315-
resources, err := mutators.ApplyMutators(ctx, asoManagedMachinePool.Spec.Resources)
315+
resources, err := mutators.ToUnstructured(ctx, asoManagedMachinePool.Spec.Resources)
316316
if err != nil {
317317
return ctrl.Result{}, err
318318
}

exp/mutators/mutator.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,8 @@ func ApplyMutators(ctx context.Context, resources []runtime.RawExtension, mutato
7474
}
7575
return us, nil
7676
}
77+
78+
// ToUnstructured converts the given resources to Unstructured.
79+
func ToUnstructured(ctx context.Context, resources []runtime.RawExtension) ([]*unstructured.Unstructured, error) {
80+
return ApplyMutators(ctx, resources)
81+
}

0 commit comments

Comments
 (0)