66 "errors"
77 "fmt"
88 "os"
9- "reflect"
109 "sort"
1110 "strings"
1211 "time"
@@ -15,6 +14,7 @@ import (
1514 "github.com/ovn-org/libovsdb/client"
1615 "github.com/ovn-org/libovsdb/model"
1716 "github.com/ovn-org/libovsdb/ovsdb"
17+ "k8s.io/apimachinery/pkg/api/equality"
1818 "sigs.k8s.io/controller-runtime/pkg/log"
1919
2020 sriovnetworkv1 "github.com/k8snetworkplumbingwg/sriov-network-operator/api/v1"
@@ -83,7 +83,7 @@ func (o *ovs) CreateOVSBridge(ctx context.Context, conf *sriovnetworkv1.OVSConfi
8383 funcLog .Error (err , "CreateOVSBridge(): failed to read data from store" )
8484 return fmt .Errorf ("failed to read data from store: %v" , err )
8585 }
86- if knownConfig == nil || ! reflect .DeepEqual (conf , knownConfig ) {
86+ if knownConfig == nil || ! equality . Semantic .DeepEqual (conf , knownConfig ) {
8787 funcLog .V (2 ).Info ("CreateOVSBridge(): save current configuration to the store" )
8888 // config in store manager is not found or it is not the same config as passed with conf arg,
8989 // update config in the store manager
@@ -102,13 +102,13 @@ func (o *ovs) CreateOVSBridge(ctx context.Context, conf *sriovnetworkv1.OVSConfi
102102 return err
103103 }
104104 if currentState != nil {
105- if reflect .DeepEqual (conf , currentState ) {
105+ if equality . Semantic .DeepEqual (conf , currentState ) {
106106 // bridge already exist with the right config
107107 funcLog .V (2 ).Info ("CreateOVSBridge(): bridge state already match current configuration, no actions required" )
108108 return nil
109109 }
110110 funcLog .V (2 ).Info ("CreateOVSBridge(): bridge state differs from the current configuration, reconfiguration required" )
111- keepBridge = reflect .DeepEqual (conf .Bridge , currentState .Bridge )
111+ keepBridge = equality . Semantic .DeepEqual (conf .Bridge , currentState .Bridge )
112112 }
113113 } else {
114114 funcLog .V (2 ).Info ("CreateOVSBridge(): configuration for the bridge not found in the store, create the bridge" )
0 commit comments