Skip to content

Commit

Permalink
add sort for the policy on the sriovOperatorConfig controller
Browse files Browse the repository at this point in the history
we need to be consistent with the policy order

Signed-off-by: Sebastian Sch <[email protected]>
  • Loading branch information
SchSeba committed Jun 23, 2024
1 parent ddb57f3 commit c9a54ac
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controllers/sriovoperatorconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"context"
"fmt"
"os"
"sort"
"strings"

appsv1 "k8s.io/api/apps/v1"
Expand Down Expand Up @@ -107,6 +108,8 @@ func (r *SriovOperatorConfigReconciler) Reconcile(ctx context.Context, req ctrl.
// Error reading the object - requeue the request.
return reconcile.Result{}, err
}
// Sort the policies with priority, higher priority ones is applied later
sort.Sort(sriovnetworkv1.ByPriority(policyList.Items))

// Render and sync webhook objects
if err = r.syncWebhookObjs(ctx, defaultConfig); err != nil {
Expand Down

0 comments on commit c9a54ac

Please sign in to comment.