From 3d29255dc9e7979c8ad8da1a02ff955f2e08237f Mon Sep 17 00:00:00 2001 From: wangyd1988 Date: Tue, 5 Dec 2023 16:26:15 +0800 Subject: [PATCH] Render SriovNetworkNodeState before Device Plugin ConfigMap --- controllers/sriovnetworknodepolicy_controller.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/controllers/sriovnetworknodepolicy_controller.go b/controllers/sriovnetworknodepolicy_controller.go index 9b9154b8..32126ad4 100644 --- a/controllers/sriovnetworknodepolicy_controller.go +++ b/controllers/sriovnetworknodepolicy_controller.go @@ -144,6 +144,11 @@ func (r *SriovNetworkNodePolicyReconciler) Reconcile(ctx context.Context, req ct // Sort the policies with priority, higher priority ones is applied later sort.Sort(sriovnetworkv1.ByPriority(policyList.Items)) + // Sync SriovNetworkNodeState objects + if err = r.syncAllSriovNetworkNodeStates(defaultPolicy, policyList, nodeList); err != nil { + return reconcile.Result{}, err + } + if os.Getenv("SRIOV_DEVICE_PLUGIN_IMAGE") != "" { // Sync Sriov device plugin ConfigMap object if err = r.syncDevicePluginConfigMap(policyList, nodeList); err != nil { @@ -154,10 +159,7 @@ func (r *SriovNetworkNodePolicyReconciler) Reconcile(ctx context.Context, req ct return reconcile.Result{}, err } } - // Sync SriovNetworkNodeState objects - if err = r.syncAllSriovNetworkNodeStates(defaultPolicy, policyList, nodeList); err != nil { - return reconcile.Result{}, err - } + // All was successful. Request that this be re-triggered after ResyncPeriod, // so we can reconcile state again.