diff --git a/go.mod b/go.mod index dd6e823c369b39bb302e1c3d2484b2f7509feb06..c9656aee4cb4dfca747abae3411d2eb4818cf7a5 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/mdlayher/ethernet v0.0.0-20220221185849-529eae5b6118 github.com/netobserv/flowlogs-pipeline v1.8.0-crc0 github.com/netobserv/gopipes v0.3.0 - github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20250215040159-dd2a70c928d3 + github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20250227173154-57a2590a1d16 github.com/paulbellamy/ratecounter v0.2.0 github.com/prometheus/client_golang v1.21.0 github.com/segmentio/kafka-go v0.4.47 diff --git a/go.sum b/go.sum index f949bcb50cd0f7956ae8eb32f6e762e53302cd8c..0c57a1f359901e30d33b9273baae0bdadee3a2ae 100644 --- a/go.sum +++ b/go.sum @@ -749,8 +749,8 @@ github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4= github.com/ovn-org/libovsdb v0.7.1-0.20240820095311-ce1951614a20 h1:OoDvzyaK7F/ZANIIFOgb4Haj7mye3Hle0fYZZNdidSs= github.com/ovn-org/libovsdb v0.7.1-0.20240820095311-ce1951614a20/go.mod h1:dJbxEaalQl83nn904K32FaMjlH/qOObZ0bj4ejQ78AI= -github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20250215040159-dd2a70c928d3 h1:tXdBJx1z7CYnjWCQnT6kBbI2LJd5XlDrIymIsxGWPF8= -github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20250215040159-dd2a70c928d3/go.mod h1:MzFM3OEsLM2w/4MBMOCsxGR6ZBUvJfOxvQHB8LIKSv4= +github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20250227173154-57a2590a1d16 h1:t4NphP6IIFRe5/2NGc1MD0e72pLYIzaG9YizrYyk84Y= +github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20250227173154-57a2590a1d16/go.mod h1:MzFM3OEsLM2w/4MBMOCsxGR6ZBUvJfOxvQHB8LIKSv4= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/sampledecoder/db_client.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/sampledecoder/db_client.go index 8b58e3608e1435ad6f16151e72a30f87301f020d..558764635689c626a01ae68f9c41c7777d04767f 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/sampledecoder/db_client.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/sampledecoder/db_client.go @@ -7,11 +7,14 @@ import ( "time" "github.com/cenkalti/backoff/v4" + + "k8s.io/klog/v2/textlogger" + "github.com/ovn-org/libovsdb/client" "github.com/ovn-org/libovsdb/model" + "github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/ovsdb" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" - "k8s.io/klog/v2/textlogger" ) const OVSDBTimeout = 10 * time.Second diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/sampledecoder/sample_decoder.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/sampledecoder/sample_decoder.go index 0beb41f9b5c9c5c4fc10d9476ec6d45cffa165ae..655b6b6bb23e23238febdbe55e427d495029b2ee 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/sampledecoder/sample_decoder.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/sampledecoder/sample_decoder.go @@ -8,6 +8,7 @@ import ( "strings" "github.com/ovn-org/libovsdb/client" + "github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/model" "github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/ovsdb" libovsdbops "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops" diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config/config.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config/config.go index 2759f071f2bca0a4f141fd6f205c36dd6b7411d2..b86af63a2ec6d807a3364faa966c434cf360e8b1 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config/config.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config/config.go @@ -16,6 +16,7 @@ import ( "github.com/urfave/cli/v2" gcfg "gopkg.in/gcfg.v1" lumberjack "gopkg.in/natefinch/lumberjack.v2" + "k8s.io/apimachinery/pkg/api/validation" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/labels" @@ -624,7 +625,7 @@ func init() { savedHybridOverlay = HybridOverlay savedOvnKubeNode = OvnKubeNode savedClusterManager = ClusterManager - cli.VersionPrinter = func(c *cli.Context) { + cli.VersionPrinter = func(_ *cli.Context) { fmt.Printf("Version: %s\n", Version) fmt.Printf("Git commit: %s\n", Commit) fmt.Printf("Git branch: %s\n", Branch) @@ -1953,7 +1954,7 @@ func completeGatewayConfig(allSubnets *ConfigSubnets, masqueradeIPs *MasqueradeI return nil } -func buildOVNKubernetesFeatureConfig(ctx *cli.Context, cli, file *config) error { +func buildOVNKubernetesFeatureConfig(cli, file *config) error { // Copy config file values over default values if err := overrideFields(&OVNKubernetesFeature, &file.OVNKubernetesFeature, &savedOVNKubernetesFeature); err != nil { return err @@ -1965,7 +1966,7 @@ func buildOVNKubernetesFeatureConfig(ctx *cli.Context, cli, file *config) error return nil } -func buildMasterHAConfig(ctx *cli.Context, cli, file *config) error { +func buildMasterHAConfig(cli, file *config) error { // Copy config file values over default values if err := overrideFields(&MasterHA, &file.MasterHA, &savedMasterHA); err != nil { return err @@ -1990,7 +1991,7 @@ func buildMasterHAConfig(ctx *cli.Context, cli, file *config) error { return nil } -func buildClusterMgrHAConfig(ctx *cli.Context, cli, file *config) error { +func buildClusterMgrHAConfig(cli, file *config) error { // Copy config file values over default values if err := overrideFields(&ClusterMgrHA, &file.ClusterMgrHA, &savedClusterMgrHA); err != nil { return err @@ -2015,7 +2016,7 @@ func buildClusterMgrHAConfig(ctx *cli.Context, cli, file *config) error { return nil } -func buildMonitoringConfig(ctx *cli.Context, cli, file *config) error { +func buildMonitoringConfig(cli, file *config) error { var err error if err = overrideFields(&Monitoring, &file.Monitoring, &savedMonitoring); err != nil { return err @@ -2058,7 +2059,7 @@ func buildIPFIXConfig(cli, file *config) error { return overrideFields(&IPFIX, &cli.IPFIX, &savedIPFIX) } -func buildHybridOverlayConfig(ctx *cli.Context, cli, file *config) error { +func buildHybridOverlayConfig(cli, file *config) error { // Copy config file values over default values if err := overrideFields(&HybridOverlay, &file.HybridOverlay, &savedHybridOverlay); err != nil { return err @@ -2095,7 +2096,7 @@ func completeHybridOverlayConfig(allSubnets *ConfigSubnets) error { return nil } -func buildClusterManagerConfig(ctx *cli.Context, cli, file *config) error { +func buildClusterManagerConfig(cli, file *config) error { // Copy config file values over default values if err := overrideFields(&ClusterManager, &file.ClusterManager, &savedClusterManager); err != nil { return err @@ -2341,7 +2342,7 @@ func initConfigWithPath(ctx *cli.Context, exec kexec.Interface, saPath string, d return "", err } - if err = buildOVNKubernetesFeatureConfig(ctx, &cliConfig, &cfg); err != nil { + if err = buildOVNKubernetesFeatureConfig(&cliConfig, &cfg); err != nil { return "", err } @@ -2349,15 +2350,15 @@ func initConfigWithPath(ctx *cli.Context, exec kexec.Interface, saPath string, d return "", err } - if err = buildMasterHAConfig(ctx, &cliConfig, &cfg); err != nil { + if err = buildMasterHAConfig(&cliConfig, &cfg); err != nil { return "", err } - if err = buildClusterMgrHAConfig(ctx, &cliConfig, &cfg); err != nil { + if err = buildClusterMgrHAConfig(&cliConfig, &cfg); err != nil { return "", err } - if err = buildMonitoringConfig(ctx, &cliConfig, &cfg); err != nil { + if err = buildMonitoringConfig(&cliConfig, &cfg); err != nil { return "", err } @@ -2365,15 +2366,15 @@ func initConfigWithPath(ctx *cli.Context, exec kexec.Interface, saPath string, d return "", err } - if err = buildHybridOverlayConfig(ctx, &cliConfig, &cfg); err != nil { + if err = buildHybridOverlayConfig(&cliConfig, &cfg); err != nil { return "", err } - if err = buildOvnKubeNodeConfig(ctx, &cliConfig, &cfg); err != nil { + if err = buildOvnKubeNodeConfig(&cliConfig, &cfg); err != nil { return "", err } - if err = buildClusterManagerConfig(ctx, &cliConfig, &cfg); err != nil { + if err = buildClusterManagerConfig(&cliConfig, &cfg); err != nil { return "", err } @@ -2696,7 +2697,7 @@ func ovnKubeNodeModeSupported(mode string) error { } // buildOvnKubeNodeConfig updates OvnKubeNode config from cli and config file -func buildOvnKubeNodeConfig(ctx *cli.Context, cli, file *config) error { +func buildOvnKubeNodeConfig(cli, file *config) error { // Copy config file values over default values if err := overrideFields(&OvnKubeNode, &file.OvnKubeNode, &savedOvnKubeNode); err != nil { return err diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config/utils.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config/utils.go index b27be4d7cb60b4d45b07d05d0e1d680b6742ae1d..7ff8eff4848268f9ba2909f2c3d7bdf1cc82f9df 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config/utils.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config/utils.go @@ -8,6 +8,7 @@ import ( "strings" iputils "github.com/containernetworking/plugins/pkg/ip" + utilnet "k8s.io/utils/net" ) diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/cryptorand/cryptorand.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/cryptorand/cryptorand.go index 9924c9b1dfc02e0b64e5796420d3c098364aa172..ce334ec3d91de167b8f6eb0735342f35ffc162d7 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/cryptorand/cryptorand.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/cryptorand/cryptorand.go @@ -3,8 +3,9 @@ package cryptorand import ( "crypto/rand" "encoding/binary" - "k8s.io/klog/v2" "math/big" + + "k8s.io/klog/v2" ) func Intn(n int64) uint64 { diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/acl.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/acl.go index 3d6e815145926def971500ae18c91f8e67aa6064..cd671595b36577738ec92a7f96394bf5689c9328 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/acl.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/acl.go @@ -5,7 +5,7 @@ import ( "fmt" libovsdbclient "github.com/ovn-org/libovsdb/client" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/libovsdb/ovsdb" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" @@ -107,7 +107,7 @@ func SetACLLogging(acl *nbdb.ACL, severity nbdb.ACLSeverity, log bool) { // CreateOrUpdateACLsOps creates or updates the provided ACLs returning the // corresponding ops -func CreateOrUpdateACLsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, samplingConfig *SamplingConfig, acls ...*nbdb.ACL) ([]libovsdb.Operation, error) { +func CreateOrUpdateACLsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, samplingConfig *SamplingConfig, acls ...*nbdb.ACL) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(acls)) for i := range acls { // can't use i in the predicate, for loop replaces it in-memory @@ -131,7 +131,7 @@ func CreateOrUpdateACLsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operat return modelClient.CreateOrUpdateOps(ops, opModels...) } -func UpdateACLsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, acls ...*nbdb.ACL) ([]libovsdb.Operation, error) { +func UpdateACLsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, acls ...*nbdb.ACL) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(acls)) for i := range acls { // can't use i in the predicate, for loop replaces it in-memory @@ -162,7 +162,7 @@ func CreateOrUpdateACLs(nbClient libovsdbclient.Client, samplingConfig *Sampling // UpdateACLsLoggingOps updates the log and severity on the provided ACLs and // returns the corresponding ops -func UpdateACLsLoggingOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, acls ...*nbdb.ACL) ([]libovsdb.Operation, error) { +func UpdateACLsLoggingOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, acls ...*nbdb.ACL) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(acls)) for i := range acls { // can't use i in the predicate, for loop replaces it in-memory diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/address_set.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/address_set.go index 920bde95f461b9385dcbb245f987c0f804116dc7..c6a8ce16e7c936eb5595c0847db640a92745886c 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/address_set.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/address_set.go @@ -4,7 +4,7 @@ import ( "context" libovsdbclient "github.com/ovn-org/libovsdb/client" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/libovsdb/ovsdb" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" @@ -60,7 +60,7 @@ func GetAddressSet(nbClient libovsdbclient.Client, as *nbdb.AddressSet) (*nbdb.A } // CreateAddressSetsOps creates the create-ops for the provided address sets -func CreateAddressSetsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, addrSets ...*nbdb.AddressSet) ([]libovsdb.Operation, error) { +func CreateAddressSetsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, addrSets ...*nbdb.AddressSet) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(addrSets)) for i := range addrSets { as := addrSets[i] @@ -88,8 +88,8 @@ func CreateAddressSets(nbClient libovsdbclient.Client, addrSets ...*nbdb.Address return err } -func CreateOrUpdateAddressSetsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, - addrSets ...*nbdb.AddressSet) ([]libovsdb.Operation, error) { +func CreateOrUpdateAddressSetsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, + addrSets ...*nbdb.AddressSet) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(addrSets)) for i := range addrSets { as := addrSets[i] @@ -138,7 +138,7 @@ func UpdateAddressSetsAddresses(nbClient libovsdbclient.Client, addrSets ...*nbd // AddAddressesToAddressSetOps adds the provided addresses to the provided address set and // returns the corresponding ops -func AddAddressesToAddressSetOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, as *nbdb.AddressSet, addresses ...string) ([]libovsdb.Operation, error) { +func AddAddressesToAddressSetOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, as *nbdb.AddressSet, addresses ...string) ([]ovsdb.Operation, error) { originalAddresses := as.Addresses as.Addresses = addresses opModel := operationModel{ @@ -156,7 +156,7 @@ func AddAddressesToAddressSetOps(nbClient libovsdbclient.Client, ops []libovsdb. // DeleteAddressesFromAddressSetOps removes the provided addresses from the provided address // set and returns the corresponding ops -func DeleteAddressesFromAddressSetOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, as *nbdb.AddressSet, addresses ...string) ([]libovsdb.Operation, error) { +func DeleteAddressesFromAddressSetOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, as *nbdb.AddressSet, addresses ...string) ([]ovsdb.Operation, error) { originalAddresses := as.Addresses as.Addresses = addresses opModel := operationModel{ @@ -172,7 +172,7 @@ func DeleteAddressesFromAddressSetOps(nbClient libovsdbclient.Client, ops []libo return ops, err } -func DeleteAddressSetsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, addrSets ...*nbdb.AddressSet) ([]libovsdb.Operation, error) { +func DeleteAddressSetsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, addrSets ...*nbdb.AddressSet) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(addrSets)) for i := range addrSets { as := addrSets[i] @@ -206,7 +206,7 @@ func DeleteAddressSets(nbClient libovsdbclient.Client, addrSets ...*nbdb.Address } // DeleteAddressSetsWithPredicateOps returns the ops to delete address sets based on a given predicate -func DeleteAddressSetsWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, p addressSetPredicate) ([]libovsdb.Operation, error) { +func DeleteAddressSetsWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, p addressSetPredicate) ([]ovsdb.Operation, error) { deleted := []*nbdb.AddressSet{} opModel := operationModel{ ModelPredicate: p, diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/chassis.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/chassis.go index 3cc17b64fe1fd85d935570d95b302a0313a2c5d3..c1d67b614aa76978d0449e819884586c1e83d3d0 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/chassis.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/chassis.go @@ -3,9 +3,10 @@ package ops import ( "context" - libovsdbclient "github.com/ovn-org/libovsdb/client" "k8s.io/apimachinery/pkg/util/sets" + libovsdbclient "github.com/ovn-org/libovsdb/client" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/sbdb" ) diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/dhcp.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/dhcp.go index 8eb17c6df72341d4d80a42cce7f02734892c8e1a..94ab12800aefffe49f1078dc50d03a98e24b6743 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/dhcp.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/dhcp.go @@ -2,7 +2,8 @@ package ops import ( libovsdbclient "github.com/ovn-org/libovsdb/client" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" ) @@ -11,7 +12,7 @@ type DHCPOptionsPredicate func(*nbdb.DHCPOptions) bool // CreateOrUpdateDhcpOptionsOps will configure logical switch port DHCPv4Options and DHCPv6Options fields with // options at dhcpv4Options and dhcpv6Options arguments and create/update DHCPOptions objects that matches the // pv4 and pv6 predicates. The missing DHCP options will default to nil in the LSP attributes. -func CreateOrUpdateDhcpOptionsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, lsp *nbdb.LogicalSwitchPort, dhcpIPv4Options, dhcpIPv6Options *nbdb.DHCPOptions) ([]libovsdb.Operation, error) { +func CreateOrUpdateDhcpOptionsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, lsp *nbdb.LogicalSwitchPort, dhcpIPv4Options, dhcpIPv6Options *nbdb.DHCPOptions) ([]ovsdb.Operation, error) { opModels := []operationModel{} if dhcpIPv4Options != nil { opModel := operationModel{ diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/lbgroup.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/lbgroup.go index 71517cb9c04d3e1487a27e7f8c7d84aa9997cd1a..8ab75c4d15253cd051a687fae9a7a25673b4cca5 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/lbgroup.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/lbgroup.go @@ -2,9 +2,9 @@ package ops import ( "context" + libovsdbclient "github.com/ovn-org/libovsdb/client" "github.com/ovn-org/libovsdb/ovsdb" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" @@ -30,7 +30,7 @@ func CreateOrUpdateLoadBalancerGroupOps(nbClient libovsdbclient.Client, ops []ov } // DeleteLoadBalancerGroupsOps DeleteLoadBalncerGroupOps creates the operations for deleting load balancer groups -func DeleteLoadBalancerGroupsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, groups ...*nbdb.LoadBalancerGroup) ([]ovsdb.Operation, error) { +func DeleteLoadBalancerGroupsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, groups ...*nbdb.LoadBalancerGroup) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(groups)) for i := range groups { // can't use i in the predicate, for loop replaces it in-memory @@ -60,7 +60,7 @@ func DeleteLoadBalancerGroups(nbClient libovsdbclient.Client, groups []*nbdb.Loa // AddLoadBalancersToGroupOps adds the provided load balancers to the provided // group and returns the corresponding ops -func AddLoadBalancersToGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, group *nbdb.LoadBalancerGroup, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error) { +func AddLoadBalancersToGroupOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, group *nbdb.LoadBalancerGroup, lbs ...*nbdb.LoadBalancer) ([]ovsdb.Operation, error) { originalLBs := group.LoadBalancer group.LoadBalancer = make([]string, 0, len(lbs)) for _, lb := range lbs { @@ -82,7 +82,7 @@ func AddLoadBalancersToGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.O // RemoveLoadBalancersFromGroupOps removes the provided load balancers from the // provided group and returns the corresponding ops -func RemoveLoadBalancersFromGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, group *nbdb.LoadBalancerGroup, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error) { +func RemoveLoadBalancersFromGroupOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, group *nbdb.LoadBalancerGroup, lbs ...*nbdb.LoadBalancer) ([]ovsdb.Operation, error) { originalLBs := group.LoadBalancer group.LoadBalancer = make([]string, 0, len(lbs)) for _, lb := range lbs { diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/loadbalancer.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/loadbalancer.go index 097d37b4ca93cfb1182c1a56b83fa51ffa7ca11d..221e980b0bd657b31e6adde3a31bc6e85715a93b 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/loadbalancer.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/loadbalancer.go @@ -4,7 +4,7 @@ import ( "context" libovsdbclient "github.com/ovn-org/libovsdb/client" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/libovsdb/ovsdb" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" @@ -60,7 +60,7 @@ func BuildLoadBalancer(name string, protocol nbdb.LoadBalancerProtocol, selectio // CreateOrUpdateLoadBalancersOps creates or updates the provided load balancers // returning the corresponding ops -func CreateOrUpdateLoadBalancersOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error) { +func CreateOrUpdateLoadBalancersOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, lbs ...*nbdb.LoadBalancer) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(lbs)) for i := range lbs { // can't use i in the predicate, for loop replaces it in-memory @@ -80,7 +80,7 @@ func CreateOrUpdateLoadBalancersOps(nbClient libovsdbclient.Client, ops []libovs // RemoveLoadBalancerVipsOps removes the provided VIPs from the provided load // balancer set and returns the corresponding ops -func RemoveLoadBalancerVipsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, lb *nbdb.LoadBalancer, vips ...string) ([]libovsdb.Operation, error) { +func RemoveLoadBalancerVipsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, lb *nbdb.LoadBalancer, vips ...string) ([]ovsdb.Operation, error) { originalVips := lb.Vips lb.Vips = make(map[string]string, len(vips)) for _, vip := range vips { @@ -101,7 +101,7 @@ func RemoveLoadBalancerVipsOps(nbClient libovsdbclient.Client, ops []libovsdb.Op // DeleteLoadBalancersOps deletes the provided load balancers and returns the // corresponding ops -func DeleteLoadBalancersOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error) { +func DeleteLoadBalancersOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, lbs ...*nbdb.LoadBalancer) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(lbs)) for i := range lbs { // can't use i in the predicate, for loop replaces it in-memory diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/meter.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/meter.go index 8f1814968790c1c501e8824206f925e38feb809d..d08b27ecc12626957220f3b894b52d414434a991 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/meter.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/meter.go @@ -3,9 +3,10 @@ package ops import ( "reflect" + "k8s.io/apimachinery/pkg/util/sets" + libovsdbclient "github.com/ovn-org/libovsdb/client" "github.com/ovn-org/libovsdb/ovsdb" - "k8s.io/apimachinery/pkg/util/sets" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" ) diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/model_client.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/model_client.go index 04f54f0e8c61570fb7813614986a59ed59bfef03..0668c20399f298390f03b556cde028eb30c66b24 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/model_client.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/model_client.go @@ -6,13 +6,14 @@ import ( "fmt" "reflect" - "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" - "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/types" + "k8s.io/klog/v2" "github.com/ovn-org/libovsdb/client" "github.com/ovn-org/libovsdb/model" "github.com/ovn-org/libovsdb/ovsdb" - "k8s.io/klog/v2" + + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/types" ) var errMultipleResults = errors.New("unexpectedly found multiple results for provided predicate") @@ -234,7 +235,7 @@ func (m *modelClient) createOrUpdateOps(ops []ovsdb.Operation, opModels ...opera } return } - doWhenNotFound := func(model interface{}, opModel *operationModel) ([]ovsdb.Operation, error) { + doWhenNotFound := func(_ interface{}, opModel *operationModel) ([]ovsdb.Operation, error) { if !hasGuardOp { // for the first insert of certain models, build a wait operation // that checks for duplicates as a guard op to prevent against @@ -285,7 +286,7 @@ func (m *modelClient) DeleteOps(ops []ovsdb.Operation, opModels ...operationMode if opModel.OnModelMutations != nil { return m.mutate(model, opModel, ovsdb.MutateOperationDelete) } else { - return m.delete(model, opModel) + return m.delete(model) } } _, ops, err := m.buildOps(ops, doWhenFound, nil, opModels...) @@ -399,7 +400,7 @@ func (m *modelClient) mutate(lookUpModel interface{}, opModel *operationModel, m return o, nil } -func (m *modelClient) delete(lookUpModel interface{}, opModel *operationModel) (o []ovsdb.Operation, err error) { +func (m *modelClient) delete(lookUpModel interface{}) (o []ovsdb.Operation, err error) { o, err = m.client.Where(lookUpModel).Delete() if err != nil { return nil, fmt.Errorf("unable to delete model, err: %w", err) diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/nb_global.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/nb_global.go index 2bb46d3a82479bbc56bae16a981f0ef88f73f6af..88d962af0db79a69028e93a0ecf2d4a753d4e1bf 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/nb_global.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/nb_global.go @@ -11,7 +11,7 @@ func GetNBGlobal(nbClient libovsdbclient.Client, nbGlobal *nbdb.NBGlobal) (*nbdb found := []*nbdb.NBGlobal{} opModel := operationModel{ Model: nbGlobal, - ModelPredicate: func(item *nbdb.NBGlobal) bool { return true }, + ModelPredicate: func(_ *nbdb.NBGlobal) bool { return true }, ExistingResult: &found, ErrNotFound: true, BulkOp: false, diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/portgroup.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/portgroup.go index c8045c09e9b2f6bd1841f8fea273f919374c5746..37a6a782afa4e163ee8a10641c40bd623dd92381 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/portgroup.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/portgroup.go @@ -4,7 +4,8 @@ import ( "context" libovsdbclient "github.com/ovn-org/libovsdb/client" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" ) @@ -23,7 +24,7 @@ func FindPortGroupsWithPredicate(nbClient libovsdbclient.Client, p portGroupPred // CreateOrUpdatePortGroupsOps creates or updates the provided port groups // returning the corresponding ops -func CreateOrUpdatePortGroupsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, pgs ...*nbdb.PortGroup) ([]libovsdb.Operation, error) { +func CreateOrUpdatePortGroupsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, pgs ...*nbdb.PortGroup) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(pgs)) for i := range pgs { pg := pgs[i] @@ -84,7 +85,7 @@ func GetPortGroup(nbClient libovsdbclient.Client, pg *nbdb.PortGroup) (*nbdb.Por return found[0], nil } -func AddPortsToPortGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, ports ...string) ([]libovsdb.Operation, error) { +func AddPortsToPortGroupOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, name string, ports ...string) ([]ovsdb.Operation, error) { if len(ports) == 0 { return ops, nil } @@ -118,7 +119,7 @@ func AddPortsToPortGroup(nbClient libovsdbclient.Client, name string, ports ...s // DeletePortsFromPortGroupOps removes the provided ports from the provided port // group and returns the corresponding ops -func DeletePortsFromPortGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, ports ...string) ([]libovsdb.Operation, error) { +func DeletePortsFromPortGroupOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, name string, ports ...string) ([]ovsdb.Operation, error) { if len(ports) == 0 { return ops, nil } @@ -153,7 +154,7 @@ func DeletePortsFromPortGroup(nbClient libovsdbclient.Client, name string, ports // AddACLsToPortGroupOps adds the provided ACLs to the provided port group and // returns the corresponding ops -func AddACLsToPortGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, acls ...*nbdb.ACL) ([]libovsdb.Operation, error) { +func AddACLsToPortGroupOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, name string, acls ...*nbdb.ACL) ([]ovsdb.Operation, error) { if len(acls) == 0 { return ops, nil } @@ -181,7 +182,7 @@ func AddACLsToPortGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operat // UpdatePortGroupSetACLsOps updates the provided ACLs on the provided port group and // returns the corresponding ops. It entirely replaces the existing ACLs on the PG with // the newly provided list -func UpdatePortGroupSetACLsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, acls []*nbdb.ACL) ([]libovsdb.Operation, error) { +func UpdatePortGroupSetACLsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, name string, acls []*nbdb.ACL) ([]ovsdb.Operation, error) { pg := nbdb.PortGroup{ Name: name, ACLs: make([]string, 0, len(acls)), @@ -202,7 +203,7 @@ func UpdatePortGroupSetACLsOps(nbClient libovsdbclient.Client, ops []libovsdb.Op // DeleteACLsFromPortGroupOps removes the provided ACLs from the provided port // group and returns the corresponding ops -func DeleteACLsFromPortGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, acls ...*nbdb.ACL) ([]libovsdb.Operation, error) { +func DeleteACLsFromPortGroupOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, name string, acls ...*nbdb.ACL) ([]ovsdb.Operation, error) { if len(acls) == 0 { return ops, nil } @@ -229,7 +230,7 @@ func DeleteACLsFromPortGroupOps(nbClient libovsdbclient.Client, ops []libovsdb.O func DeleteACLsFromPortGroups(nbClient libovsdbclient.Client, names []string, acls ...*nbdb.ACL) error { var err error - var ops []libovsdb.Operation + var ops []ovsdb.Operation for _, pgName := range names { ops, err = DeleteACLsFromPortGroupOps(nbClient, ops, pgName, acls...) if err != nil { @@ -255,7 +256,7 @@ func DeleteACLsFromAllPortGroups(nbClient libovsdbclient.Client, acls ...*nbdb.A opModel := operationModel{ Model: &pg, - ModelPredicate: func(item *nbdb.PortGroup) bool { return true }, + ModelPredicate: func(_ *nbdb.PortGroup) bool { return true }, OnModelMutations: []interface{}{&pg.ACLs}, ErrNotFound: false, BulkOp: true, @@ -272,7 +273,7 @@ func DeleteACLsFromAllPortGroups(nbClient libovsdbclient.Client, acls ...*nbdb.A // DeletePortGroupsOps deletes the provided port groups and returns the // corresponding ops -func DeletePortGroupsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, names ...string) ([]libovsdb.Operation, error) { +func DeletePortGroupsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, names ...string) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(names)) for _, name := range names { pg := nbdb.PortGroup{ @@ -304,7 +305,7 @@ func DeletePortGroups(nbClient libovsdbclient.Client, names ...string) error { // DeletePortGroupsWithPredicateOps returns the corresponding ops to delete port groups based on // a given predicate -func DeletePortGroupsWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, p portGroupPredicate) ([]libovsdb.Operation, error) { +func DeletePortGroupsWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, p portGroupPredicate) ([]ovsdb.Operation, error) { deleted := []*nbdb.PortGroup{} opModel := operationModel{ ModelPredicate: p, diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/qos.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/qos.go index a83a176dff3192647249eb20b8e6fb1dbc9f9ff9..d78be6b1e23752dc2ccde386fbda13c05c5c2e73 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/qos.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/qos.go @@ -4,7 +4,8 @@ import ( "context" libovsdbclient "github.com/ovn-org/libovsdb/client" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" ) @@ -22,7 +23,7 @@ func FindQoSesWithPredicate(nbClient libovsdbclient.Client, p QoSPredicate) ([]* } // CreateOrUpdateQoSesOps returns the ops to create or update the provided QoSes. -func CreateOrUpdateQoSesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, qoses ...*nbdb.QoS) ([]libovsdb.Operation, error) { +func CreateOrUpdateQoSesOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, qoses ...*nbdb.QoS) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(qoses)) for i := range qoses { // can't use i in the predicate, for loop replaces it in-memory @@ -40,7 +41,7 @@ func CreateOrUpdateQoSesOps(nbClient libovsdbclient.Client, ops []libovsdb.Opera return modelClient.CreateOrUpdateOps(ops, opModels...) } -func UpdateQoSesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, qoses ...*nbdb.QoS) ([]libovsdb.Operation, error) { +func UpdateQoSesOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, qoses ...*nbdb.QoS) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(qoses)) for i := range qoses { // can't use i in the predicate, for loop replaces it in-memory @@ -59,7 +60,7 @@ func UpdateQoSesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, qo } // AddQoSesToLogicalSwitchOps returns the ops to add the provided QoSes to the switch -func AddQoSesToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, qoses ...*nbdb.QoS) ([]libovsdb.Operation, error) { +func AddQoSesToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, name string, qoses ...*nbdb.QoS) ([]ovsdb.Operation, error) { sw := &nbdb.LogicalSwitch{ Name: name, QOSRules: make([]string, 0, len(qoses)), @@ -80,7 +81,7 @@ func AddQoSesToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.O } // DeleteQoSesOps returns the ops to delete the provided QoSes. -func DeleteQoSesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, qoses ...*nbdb.QoS) ([]libovsdb.Operation, error) { +func DeleteQoSesOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, qoses ...*nbdb.QoS) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(qoses)) for i := range qoses { // can't use i in the predicate, for loop replaces it in-memory @@ -98,7 +99,7 @@ func DeleteQoSesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, qo } // RemoveQoSesFromLogicalSwitchOps returns the ops to remove the provided QoSes from the provided switch. -func RemoveQoSesFromLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, qoses ...*nbdb.QoS) ([]libovsdb.Operation, error) { +func RemoveQoSesFromLogicalSwitchOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, name string, qoses ...*nbdb.QoS) ([]ovsdb.Operation, error) { sw := &nbdb.LogicalSwitch{ Name: name, QOSRules: make([]string, 0, len(qoses)), diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/router.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/router.go index 3c95230a74e47471454376773b4ac0b26d976190..17ecc8ac86cf7451c72f5fa065732beb6d06f1d4 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/router.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/router.go @@ -6,10 +6,11 @@ import ( "fmt" "net" - libovsdbclient "github.com/ovn-org/libovsdb/client" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" "k8s.io/apimachinery/pkg/util/sets" + libovsdbclient "github.com/ovn-org/libovsdb/client" + "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" ) @@ -99,8 +100,8 @@ func UpdateLogicalRouterSetExternalIDs(nbClient libovsdbclient.Client, router *n } // DeleteLogicalRoutersWithPredicateOps returns the operations to delete the logical routers matching the provided predicate -func DeleteLogicalRoutersWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, - p logicalRouterPredicate) ([]libovsdb.Operation, error) { +func DeleteLogicalRoutersWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, + p logicalRouterPredicate) ([]ovsdb.Operation, error) { opModel := operationModel{ Model: &nbdb.LogicalRouter{}, ModelPredicate: p, @@ -113,8 +114,8 @@ func DeleteLogicalRoutersWithPredicateOps(nbClient libovsdbclient.Client, ops [] } // DeleteLogicalRouterOps returns the operations to delete the provided logical router -func DeleteLogicalRouterOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, - router *nbdb.LogicalRouter) ([]libovsdb.Operation, error) { +func DeleteLogicalRouterOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, + router *nbdb.LogicalRouter) ([]ovsdb.Operation, error) { opModel := operationModel{ Model: router, ErrNotFound: false, @@ -319,8 +320,8 @@ func CreateOrUpdateLogicalRouterPolicyWithPredicate(nbClient libovsdbclient.Clie // exist, it creates the provided logical router policy. If it does, it // updates it. The logical router policy is added to the provided logical // router. Returns the corresponding ops -func CreateOrUpdateLogicalRouterPolicyWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, - routerName string, lrp *nbdb.LogicalRouterPolicy, p logicalRouterPolicyPredicate, fields ...interface{}) ([]libovsdb.Operation, error) { +func CreateOrUpdateLogicalRouterPolicyWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, + routerName string, lrp *nbdb.LogicalRouterPolicy, p logicalRouterPolicyPredicate, fields ...interface{}) ([]ovsdb.Operation, error) { if len(fields) == 0 { fields = onModelUpdatesAllNonDefault() } @@ -349,8 +350,8 @@ func CreateOrUpdateLogicalRouterPolicyWithPredicateOps(nbClient libovsdbclient.C return m.CreateOrUpdateOps(ops, opModels...) } -func UpdateLogicalRouterPoliciesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, - lrps ...*nbdb.LogicalRouterPolicy) ([]libovsdb.Operation, error) { +func UpdateLogicalRouterPoliciesOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, + lrps ...*nbdb.LogicalRouterPolicy) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(lrps)) for i := range lrps { lrp := lrps[i] @@ -372,7 +373,7 @@ func UpdateLogicalRouterPoliciesOps(nbClient libovsdbclient.Client, ops []libovs // DeleteLogicalRouterPolicyWithPredicateOps looks up a logical // router policy from the cache based on a given predicate and returns the // corresponding ops to delete it and remove it from the provided router. -func DeleteLogicalRouterPolicyWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, p logicalRouterPolicyPredicate) ([]libovsdb.Operation, error) { +func DeleteLogicalRouterPolicyWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, routerName string, p logicalRouterPolicyPredicate) ([]ovsdb.Operation, error) { router := &nbdb.LogicalRouter{ Name: routerName, } @@ -416,7 +417,7 @@ func DeleteLogicalRouterPoliciesWithPredicate(nbClient libovsdbclient.Client, ro // any, it creates the provided logical router policy. If it does, adds any // missing Nexthops to the existing logical router policy. The logical router // policy is added to the provided logical router. Returns the corresponding ops -func CreateOrAddNextHopsToLogicalRouterPolicyWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, lrp *nbdb.LogicalRouterPolicy, p logicalRouterPolicyPredicate) ([]libovsdb.Operation, error) { +func CreateOrAddNextHopsToLogicalRouterPolicyWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, routerName string, lrp *nbdb.LogicalRouterPolicy, p logicalRouterPolicyPredicate) ([]ovsdb.Operation, error) { router := &nbdb.LogicalRouter{ Name: routerName, } @@ -444,7 +445,7 @@ func CreateOrAddNextHopsToLogicalRouterPolicyWithPredicateOps(nbClient libovsdbc // DeleteNextHopsFromLogicalRouterPolicyOps removes the Nexthops from the // provided logical router policies. -func DeleteNextHopsFromLogicalRouterPolicyOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, lrps []*nbdb.LogicalRouterPolicy, nextHops ...string) ([]libovsdb.Operation, error) { +func DeleteNextHopsFromLogicalRouterPolicyOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, routerName string, lrps []*nbdb.LogicalRouterPolicy, nextHops ...string) ([]ovsdb.Operation, error) { nextHopSet := sets.NewString(nextHops...) opModels := []operationModel{} router := &nbdb.LogicalRouter{ @@ -494,7 +495,7 @@ func DeleteNextHopsFromLogicalRouterPolicyOps(nbClient libovsdbclient.Client, op // provided logical router policies. If a logical router policy ends up with no // Nexthops, it is deleted and removed from the provided logical router. func DeleteNextHopsFromLogicalRouterPolicies(nbClient libovsdbclient.Client, routerName string, lrps ...*nbdb.LogicalRouterPolicy) error { - ops := []libovsdb.Operation{} + ops := []ovsdb.Operation{} for _, lrp := range lrps { nextHops := lrp.Nexthops lrp, err := GetLogicalRouterPolicy(nbClient, lrp) @@ -520,7 +521,7 @@ func DeleteNextHopsFromLogicalRouterPolicies(nbClient libovsdbclient.Client, rou // provided Nexthop from it. If the logical router policy ends up with no // Nexthops, it is deleted and removed from the provided logical router. Returns // the corresponding ops -func DeleteNextHopFromLogicalRouterPoliciesWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, p logicalRouterPolicyPredicate, nextHop string) ([]libovsdb.Operation, error) { +func DeleteNextHopFromLogicalRouterPoliciesWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, routerName string, p logicalRouterPolicyPredicate, nextHop string) ([]ovsdb.Operation, error) { lrps, err := FindLogicalRouterPoliciesWithPredicate(nbClient, p) if err != nil { return nil, err @@ -554,7 +555,7 @@ func DeleteLogicalRouterPolicies(nbClient libovsdbclient.Client, routerName stri // DeleteLogicalRouterPoliciesOps builds and returns corresponding delete operations for Logical Router // Policies from the provided logical router. -func DeleteLogicalRouterPoliciesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, lrps ...*nbdb.LogicalRouterPolicy) ([]libovsdb.Operation, error) { +func DeleteLogicalRouterPoliciesOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, routerName string, lrps ...*nbdb.LogicalRouterPolicy) ([]ovsdb.Operation, error) { opModels := getDeleteOpModelsForLogicalRouterPolicies(routerName, lrps...) m := newModelClient(nbClient) @@ -614,11 +615,11 @@ func GetRouterLogicalRouterStaticRoutesWithPredicate(nbClient libovsdbclient.Cli lrsrs := []*nbdb.LogicalRouterStaticRoute{} for _, uuid := range r.StaticRoutes { lrsr := &nbdb.LogicalRouterStaticRoute{UUID: uuid} - err := nbClient.Get(context.Background(), lrsr) + validRoute, err := routeExistsWithPredicate(nbClient, lrsr, p) if err != nil { return nil, err } - if p(lrsr) { + if validRoute { lrsrs = append(lrsrs, lrsr) } } @@ -626,13 +627,26 @@ func GetRouterLogicalRouterStaticRoutesWithPredicate(nbClient libovsdbclient.Cli return lrsrs, nil } +func routeExistsWithPredicate(nbClient libovsdbclient.Client, lrsr *nbdb.LogicalRouterStaticRoute, p logicalRouterStaticRoutePredicate) (bool, error) { + ctx, cancel := context.WithTimeout(context.Background(), config.Default.OVSDBTxnTimeout) + defer cancel() + err := nbClient.Get(ctx, lrsr) + if err != nil { + return false, err + } + if p(lrsr) { + return true, nil + } + return false, nil +} + // CreateOrUpdateLogicalRouterStaticRoutesWithPredicateOps looks up a logical // router static route from the cache based on a given predicate. If it does not // exist, it creates the provided logical router static route. If it does, it // updates it. The logical router static route is added to the provided logical // router. Returns the corresponding ops -func CreateOrUpdateLogicalRouterStaticRoutesWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, - routerName string, lrsr *nbdb.LogicalRouterStaticRoute, p logicalRouterStaticRoutePredicate, fields ...interface{}) ([]libovsdb.Operation, error) { +func CreateOrUpdateLogicalRouterStaticRoutesWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, + routerName string, lrsr *nbdb.LogicalRouterStaticRoute, p logicalRouterStaticRoutePredicate, fields ...interface{}) ([]ovsdb.Operation, error) { if len(fields) == 0 { fields = onModelUpdatesAllNonDefault() } @@ -668,7 +682,7 @@ func CreateOrUpdateLogicalRouterStaticRoutesWithPredicateOps(nbClient libovsdbcl // If policy is nil, OVN considers that as dst-ip func PolicyEqualPredicate(p1, p2 *nbdb.LogicalRouterStaticRoutePolicy) bool { if p1 == nil { - return p2 == nil || (p2 != nil && *p2 == nbdb.LogicalRouterStaticRoutePolicyDstIP) + return p2 == nil || *p2 == nbdb.LogicalRouterStaticRoutePolicyDstIP } if p2 == nil { @@ -693,7 +707,7 @@ func CreateOrReplaceLogicalRouterStaticRouteWithPredicate(nbClient libovsdbclien return fmt.Errorf("unable to get logical router static routes with predicate on router %s: %w", routerName, err) } - var ops []libovsdb.Operation + var ops []ovsdb.Operation if len(routes) > 0 { lrsr.UUID = routes[0].UUID @@ -720,7 +734,7 @@ func CreateOrReplaceLogicalRouterStaticRouteWithPredicate(nbClient libovsdbclien // routes from the cache based on a given predicate, deletes them and removes // them from the provided logical router func DeleteLogicalRouterStaticRoutesWithPredicate(nbClient libovsdbclient.Client, routerName string, p logicalRouterStaticRoutePredicate) error { - var ops []libovsdb.Operation + var ops []ovsdb.Operation var err error ops, err = DeleteLogicalRouterStaticRoutesWithPredicateOps(nbClient, ops, routerName, p) if err != nil { @@ -733,7 +747,7 @@ func DeleteLogicalRouterStaticRoutesWithPredicate(nbClient libovsdbclient.Client // DeleteLogicalRouterStaticRoutesWithPredicateOps looks up logical router static // routes from the cache based on a given predicate, and returns the ops to delete // them and remove them from the provided logical router -func DeleteLogicalRouterStaticRoutesWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, p logicalRouterStaticRoutePredicate) ([]libovsdb.Operation, error) { +func DeleteLogicalRouterStaticRoutesWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, routerName string, p logicalRouterStaticRoutePredicate) ([]ovsdb.Operation, error) { router := &nbdb.LogicalRouter{ Name: routerName, } @@ -761,7 +775,7 @@ func DeleteLogicalRouterStaticRoutesWithPredicateOps(nbClient libovsdbclient.Cli // DeleteLogicalRouterStaticRoutesOps deletes the logical router static routes and // returns the ops to remove them from the provided logical router -func DeleteLogicalRouterStaticRoutesOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, routerName string, lrsrs ...*nbdb.LogicalRouterStaticRoute) ([]libovsdb.Operation, error) { +func DeleteLogicalRouterStaticRoutesOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, routerName string, lrsrs ...*nbdb.LogicalRouterStaticRoute) ([]ovsdb.Operation, error) { router := &nbdb.LogicalRouter{ Name: routerName, StaticRoutes: make([]string, 0, len(lrsrs)), @@ -788,7 +802,7 @@ func DeleteLogicalRouterStaticRoutesOps(nbClient libovsdbclient.Client, ops []li // DeleteLogicalRouterStaticRoutes deletes the logical router static routes and // removes them from the provided logical router func DeleteLogicalRouterStaticRoutes(nbClient libovsdbclient.Client, routerName string, lrsrs ...*nbdb.LogicalRouterStaticRoute) error { - var ops []libovsdb.Operation + var ops []ovsdb.Operation var err error ops, err = DeleteLogicalRouterStaticRoutesOps(nbClient, ops, routerName, lrsrs...) if err != nil { @@ -802,7 +816,7 @@ func DeleteLogicalRouterStaticRoutes(nbClient libovsdbclient.Client, routerName // CreateOrUpdateBFDOps creates or updates the provided BFDs and returns // the corresponding ops -func CreateOrUpdateBFDOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, bfds ...*nbdb.BFD) ([]libovsdb.Operation, error) { +func CreateOrUpdateBFDOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, bfds ...*nbdb.BFD) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(bfds)) for i := range bfds { bfd := bfds[i] @@ -858,7 +872,7 @@ func LookupBFD(nbClient libovsdbclient.Client, bfd *nbdb.BFD) (*nbdb.BFD, error) // AddLoadBalancersToLogicalRouterOps adds the provided load balancers to the // provided logical router and returns the corresponding ops -func AddLoadBalancersToLogicalRouterOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, router *nbdb.LogicalRouter, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error) { +func AddLoadBalancersToLogicalRouterOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, router *nbdb.LogicalRouter, lbs ...*nbdb.LoadBalancer) ([]ovsdb.Operation, error) { originalLBs := router.LoadBalancer router.LoadBalancer = make([]string, 0, len(lbs)) for _, lb := range lbs { @@ -879,7 +893,7 @@ func AddLoadBalancersToLogicalRouterOps(nbClient libovsdbclient.Client, ops []li // RemoveLoadBalancersFromLogicalRouterOps removes the provided load balancers from the // provided logical router and returns the corresponding ops -func RemoveLoadBalancersFromLogicalRouterOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, router *nbdb.LogicalRouter, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error) { +func RemoveLoadBalancersFromLogicalRouterOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, router *nbdb.LogicalRouter, lbs ...*nbdb.LoadBalancer) ([]ovsdb.Operation, error) { originalLBs := router.LoadBalancer router.LoadBalancer = make([]string, 0, len(lbs)) for _, lb := range lbs { @@ -1100,7 +1114,7 @@ func GetRouterNATs(nbClient libovsdbclient.Client, router *nbdb.LogicalRouter) ( // CreateOrUpdateNATsOps creates or updates the provided NATs, adds them to // the provided logical router and returns the corresponding ops -func CreateOrUpdateNATsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, router *nbdb.LogicalRouter, nats ...*nbdb.NAT) ([]libovsdb.Operation, error) { +func CreateOrUpdateNATsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, router *nbdb.LogicalRouter, nats ...*nbdb.NAT) ([]ovsdb.Operation, error) { routerNats, err := GetRouterNATs(nbClient, router) if err != nil { return ops, fmt.Errorf("unable to get NAT entries for router %+v: %w", router, err) @@ -1154,7 +1168,7 @@ func CreateOrUpdateNATs(nbClient libovsdbclient.Client, router *nbdb.LogicalRout // DeleteNATsOps deletes the provided NATs, removes them from the provided // logical router and returns the corresponding ops -func DeleteNATsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, router *nbdb.LogicalRouter, nats ...*nbdb.NAT) ([]libovsdb.Operation, error) { +func DeleteNATsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, router *nbdb.LogicalRouter, nats ...*nbdb.NAT) ([]ovsdb.Operation, error) { routerNats, err := GetRouterNATs(nbClient, router) if errors.Is(err, libovsdbclient.ErrNotFound) { return ops, nil @@ -1212,7 +1226,7 @@ func DeleteNATs(nbClient libovsdbclient.Client, router *nbdb.LogicalRouter, nats // DeleteNATsWithPredicateOps looks up NATs from the cache based on a given // predicate, deletes them, removes them from associated logical routers and // returns the corresponding ops -func DeleteNATsWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, p natPredicate) ([]libovsdb.Operation, error) { +func DeleteNATsWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, p natPredicate) ([]ovsdb.Operation, error) { deleted := []*nbdb.NAT{} router := &nbdb.LogicalRouter{} natUUIDs := sets.Set[string]{} @@ -1240,7 +1254,7 @@ func DeleteNATsWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.O return m.DeleteOps(ops, opModels...) } -func UpdateNATOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, nats ...*nbdb.NAT) ([]libovsdb.Operation, error) { +func UpdateNATOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, nats ...*nbdb.NAT) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(nats)) for i := range nats { nat := nats[i] diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/sample.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/sample.go index 7f4f527d1bd547ffee94697f5bba209479b5933b..cb0ddbc6bf1168ffd6e5f0ad7dcc7fe9facc94b2 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/sample.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/sample.go @@ -1,12 +1,14 @@ package ops import ( - "golang.org/x/net/context" "hash/fnv" + "golang.org/x/net/context" + libovsdbclient "github.com/ovn-org/libovsdb/client" "github.com/ovn-org/libovsdb/model" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" ) @@ -74,7 +76,7 @@ func ListSampleCollectors(nbClient libovsdbclient.Client) ([]*nbdb.SampleCollect return collectors, err } -func CreateOrUpdateSamplingAppsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, samplingApps ...*nbdb.SamplingApp) ([]libovsdb.Operation, error) { +func CreateOrUpdateSamplingAppsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, samplingApps ...*nbdb.SamplingApp) ([]ovsdb.Operation, error) { opModels := make([]operationModel, 0, len(samplingApps)) for i := range samplingApps { // can't use i in the predicate, for loop replaces it in-memory diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/sb_global.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/sb_global.go index 1c5dde339d45e1b0ab94877f39e35f0cff1ccdde..3fe14bf42d1dfb337994e81422268cfc5082a67f 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/sb_global.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/sb_global.go @@ -11,7 +11,7 @@ func GetSBGlobal(sbClient libovsdbclient.Client, sbGlobal *sbdb.SBGlobal) (*sbdb found := []*sbdb.SBGlobal{} opModel := operationModel{ Model: sbGlobal, - ModelPredicate: func(item *sbdb.SBGlobal) bool { return true }, + ModelPredicate: func(_ *sbdb.SBGlobal) bool { return true }, ExistingResult: &found, ErrNotFound: true, BulkOp: false, diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/switch.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/switch.go index 250868667be83896381029fa906f38ddee14af90..01f724b45dd70d6815d951e4c29fdcb8ed41f738 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/switch.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/switch.go @@ -4,12 +4,13 @@ import ( "context" "errors" "fmt" + libovsdbclient "github.com/ovn-org/libovsdb/client" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" - ovntypes "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/types" + "github.com/ovn-org/libovsdb/ovsdb" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" + ovntypes "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/types" ) // LOGICAL_SWITCH OPs @@ -109,8 +110,8 @@ func UpdateLogicalSwitchSetExternalIDs(nbClient libovsdbclient.Client, logicalSw type logicalSwitchPredicate func(*nbdb.LogicalSwitch) bool // DeleteLogicalSwitchesWithPredicateOps returns the operations to delete the logical switches matching the provided predicate -func DeleteLogicalSwitchesWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, - p logicalSwitchPredicate) ([]libovsdb.Operation, error) { +func DeleteLogicalSwitchesWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, + p logicalSwitchPredicate) ([]ovsdb.Operation, error) { opModel := operationModel{ Model: &nbdb.LogicalSwitch{}, ModelPredicate: p, @@ -123,8 +124,8 @@ func DeleteLogicalSwitchesWithPredicateOps(nbClient libovsdbclient.Client, ops [ } // DeleteLogicalSwitchOps returns the operations to delete the provided logical switch -func DeleteLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, - swName string) ([]libovsdb.Operation, error) { +func DeleteLogicalSwitchOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, + swName string) ([]ovsdb.Operation, error) { opModel := operationModel{ Model: &nbdb.LogicalSwitch{Name: swName}, ErrNotFound: false, @@ -149,7 +150,7 @@ func DeleteLogicalSwitch(nbClient libovsdbclient.Client, swName string) error { // AddLoadBalancersToLogicalSwitchOps adds the provided load balancers to the // provided logical switch and returns the corresponding ops -func AddLoadBalancersToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error) { +func AddLoadBalancersToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, sw *nbdb.LogicalSwitch, lbs ...*nbdb.LoadBalancer) ([]ovsdb.Operation, error) { sw.LoadBalancer = make([]string, 0, len(lbs)) for _, lb := range lbs { sw.LoadBalancer = append(sw.LoadBalancer, lb.UUID) @@ -167,7 +168,7 @@ func AddLoadBalancersToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []li // RemoveLoadBalancersFromLogicalSwitchOps removes the provided load balancers from the // provided logical switch and returns the corresponding ops -func RemoveLoadBalancersFromLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, lbs ...*nbdb.LoadBalancer) ([]libovsdb.Operation, error) { +func RemoveLoadBalancersFromLogicalSwitchOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, sw *nbdb.LogicalSwitch, lbs ...*nbdb.LoadBalancer) ([]ovsdb.Operation, error) { sw.LoadBalancer = make([]string, 0, len(lbs)) for _, lb := range lbs { sw.LoadBalancer = append(sw.LoadBalancer, lb.UUID) @@ -188,7 +189,7 @@ func RemoveLoadBalancersFromLogicalSwitchOps(nbClient libovsdbclient.Client, ops // AddACLsToLogicalSwitchOps adds the provided ACLs to the provided logical // switch and returns the corresponding ops -func AddACLsToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, name string, acls ...*nbdb.ACL) ([]libovsdb.Operation, error) { +func AddACLsToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, name string, acls ...*nbdb.ACL) ([]ovsdb.Operation, error) { sw := &nbdb.LogicalSwitch{ Name: name, ACLs: make([]string, 0, len(acls)), @@ -211,8 +212,8 @@ func AddACLsToLogicalSwitchOps(nbClient libovsdbclient.Client, ops []libovsdb.Op // RemoveACLsFromLogicalSwitchesWithPredicateOps looks up logical switches from the cache // based on a given predicate, removes from them the provided ACLs, and returns the // corresponding ops -func RemoveACLsFromLogicalSwitchesWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, - p switchPredicate, acls ...*nbdb.ACL) ([]libovsdb.Operation, error) { +func RemoveACLsFromLogicalSwitchesWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, + p switchPredicate, acls ...*nbdb.ACL) ([]ovsdb.Operation, error) { sw := nbdb.LogicalSwitch{ ACLs: make([]string, 0, len(acls)), } @@ -316,7 +317,7 @@ func createOrUpdateLogicalSwitchPortOpModelWithCustomFields(sw *nbdb.LogicalSwit } } -func createOrUpdateLogicalSwitchPortsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, createSwitch, createLSP bool, customFields []ModelUpdateField, lsps ...*nbdb.LogicalSwitchPort) ([]libovsdb.Operation, error) { +func createOrUpdateLogicalSwitchPortsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, sw *nbdb.LogicalSwitch, createSwitch, createLSP bool, customFields []ModelUpdateField, lsps ...*nbdb.LogicalSwitchPort) ([]ovsdb.Operation, error) { originalPorts := sw.Ports sw.Ports = make([]string, 0, len(lsps)) opModels := make([]operationModel, 0, len(lsps)+1) @@ -356,14 +357,14 @@ func createOrUpdateLogicalSwitchPorts(nbClient libovsdbclient.Client, sw *nbdb.L // CreateOrUpdateLogicalSwitchPortsOnSwitchWithCustomFieldsOps creates or updates the provided // logical switch ports, adds them to the provided logical switch and returns // the corresponding ops -func CreateOrUpdateLogicalSwitchPortsOnSwitchWithCustomFieldsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, customFields []ModelUpdateField, lsps ...*nbdb.LogicalSwitchPort) ([]libovsdb.Operation, error) { +func CreateOrUpdateLogicalSwitchPortsOnSwitchWithCustomFieldsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, sw *nbdb.LogicalSwitch, customFields []ModelUpdateField, lsps ...*nbdb.LogicalSwitchPort) ([]ovsdb.Operation, error) { return createOrUpdateLogicalSwitchPortsOps(nbClient, ops, sw, false, true, customFields, lsps...) } // UpdateLogicalSwitchPortsOnSwitchWithCustomFieldsOps updates the provided // logical switch ports, adds them to the provided logical switch and returns // the corresponding ops -func UpdateLogicalSwitchPortsOnSwitchWithCustomFieldsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, customFields []ModelUpdateField, lsps ...*nbdb.LogicalSwitchPort) ([]libovsdb.Operation, error) { +func UpdateLogicalSwitchPortsOnSwitchWithCustomFieldsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, sw *nbdb.LogicalSwitch, customFields []ModelUpdateField, lsps ...*nbdb.LogicalSwitchPort) ([]ovsdb.Operation, error) { return createOrUpdateLogicalSwitchPortsOps(nbClient, ops, sw, false, false, customFields, lsps...) } @@ -382,7 +383,7 @@ func CreateOrUpdateLogicalSwitchPortsAndSwitch(nbClient libovsdbclient.Client, s // DeleteLogicalSwitchPortsOps deletes the provided logical switch ports, removes // them from the provided logical switch and returns the corresponding ops -func DeleteLogicalSwitchPortsOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, lsps ...*nbdb.LogicalSwitchPort) ([]libovsdb.Operation, error) { +func DeleteLogicalSwitchPortsOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, sw *nbdb.LogicalSwitch, lsps ...*nbdb.LogicalSwitchPort) ([]ovsdb.Operation, error) { originalPorts := sw.Ports sw.Ports = make([]string, 0, len(lsps)) opModels := make([]operationModel, 0, len(lsps)+1) @@ -431,7 +432,7 @@ type logicalSwitchPortPredicate func(*nbdb.LogicalSwitchPort) bool // DeleteLogicalSwitchPortsWithPredicateOps looks up logical switch ports from // the cache based on a given predicate and removes from them the provided // logical switch -func DeleteLogicalSwitchPortsWithPredicateOps(nbClient libovsdbclient.Client, ops []libovsdb.Operation, sw *nbdb.LogicalSwitch, p logicalSwitchPortPredicate) ([]libovsdb.Operation, error) { +func DeleteLogicalSwitchPortsWithPredicateOps(nbClient libovsdbclient.Client, ops []ovsdb.Operation, sw *nbdb.LogicalSwitch, p logicalSwitchPortPredicate) ([]ovsdb.Operation, error) { swName := sw.Name sw, err := GetLogicalSwitch(nbClient, sw) if err != nil { diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/template_var.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/template_var.go index 4672a5c0e4592f88a8bfcc5b5289558c3daed8c5..9c449d5f6bc058c064bb0cec20a80eae67a25db9 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/template_var.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/template_var.go @@ -4,7 +4,8 @@ import ( "context" libovsdbclient "github.com/ovn-org/libovsdb/client" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" ) @@ -24,7 +25,7 @@ func ListTemplateVar(nbClient libovsdbclient.Client) ([]*nbdb.ChassisTemplateVar // CreateOrUpdateChassisTemplateVarOps creates or updates the provided // 'template' variable and returns the corresponding ops. func CreateOrUpdateChassisTemplateVarOps(nbClient libovsdbclient.Client, - ops []libovsdb.Operation, template *nbdb.ChassisTemplateVar) ([]libovsdb.Operation, error) { + ops []ovsdb.Operation, template *nbdb.ChassisTemplateVar) ([]ovsdb.Operation, error) { modelClient := newModelClient(nbClient) return modelClient.CreateOrUpdateOps(ops, operationModel{ @@ -39,8 +40,8 @@ func CreateOrUpdateChassisTemplateVarOps(nbClient libovsdbclient.Client, // keys of 'template.Variables' and returns the corresponding ops. // It applies the mutation to all records that are selected by 'predicate'. func deleteChassisTemplateVarVariablesOps(nbClient libovsdbclient.Client, - ops []libovsdb.Operation, template *nbdb.ChassisTemplateVar, - predicate chassisTemplateVarPredicate) ([]libovsdb.Operation, error) { + ops []ovsdb.Operation, template *nbdb.ChassisTemplateVar, + predicate chassisTemplateVarPredicate) ([]ovsdb.Operation, error) { deleteTemplate := &nbdb.ChassisTemplateVar{ Chassis: template.Chassis, @@ -63,7 +64,7 @@ func deleteChassisTemplateVarVariablesOps(nbClient libovsdbclient.Client, // keys of 'template.Variables' from the record matching the same chassis // as 'template'. It returns the corresponding ops. func DeleteChassisTemplateVarVariablesOps(nbClient libovsdbclient.Client, - ops []libovsdb.Operation, template *nbdb.ChassisTemplateVar) ([]libovsdb.Operation, error) { + ops []ovsdb.Operation, template *nbdb.ChassisTemplateVar) ([]ovsdb.Operation, error) { return deleteChassisTemplateVarVariablesOps(nbClient, ops, template, nil) } diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/transact.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/transact.go index 51fd09ccebeff49690ebada97613c233588787df..312cfdaffa8af794a9f60a5f71c1ac357de4c00a 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/transact.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops/transact.go @@ -12,6 +12,7 @@ import ( "github.com/ovn-org/libovsdb/client" "github.com/ovn-org/libovsdb/model" "github.com/ovn-org/libovsdb/ovsdb" + "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/config" ) @@ -25,7 +26,7 @@ func TransactWithRetry(ctx context.Context, c client.Client, ops []ovsdb.Operati if err == nil { return true, nil } - if err != nil && errors.Is(err, client.ErrNotConnected) { + if errors.Is(err, client.ErrNotConnected) { klog.V(5).Infof("Unable to execute transaction: %+v. Client is disconnected, will retry...", ops) return false, nil } diff --git a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/observability/observability.go b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/observability/observability.go index 6349c15199f4b2a5a0c5365e9eabca0f7a252429..a3ffbb54f342372f5d3ffb352a46e29c9a7e1094 100644 --- a/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/observability/observability.go +++ b/vendor/github.com/ovn-org/ovn-kubernetes/go-controller/pkg/observability/observability.go @@ -7,11 +7,12 @@ import ( "sync" "time" - libovsdbclient "github.com/ovn-org/libovsdb/client" - libovsdb "github.com/ovn-org/libovsdb/ovsdb" "k8s.io/apimachinery/pkg/util/sets" "k8s.io/klog/v2" + libovsdbclient "github.com/ovn-org/libovsdb/client" + "github.com/ovn-org/libovsdb/ovsdb" + libovsdbops "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/libovsdb/ops" "github.com/ovn-org/ovn-kubernetes/go-controller/pkg/nbdb" ) @@ -172,14 +173,14 @@ func (m *Manager) deleteStaleCollectors() error { // This is expected, and Cleanup may be retried on the next restart. func Cleanup(nbClient libovsdbclient.Client) error { // Do the opposite of init - err := libovsdbops.DeleteSamplingAppsWithPredicate(nbClient, func(app *nbdb.SamplingApp) bool { + err := libovsdbops.DeleteSamplingAppsWithPredicate(nbClient, func(_ *nbdb.SamplingApp) bool { return true }) if err != nil { return fmt.Errorf("error deleting sampling apps: %w", err) } - err = libovsdbops.DeleteSampleCollectorWithPredicate(nbClient, func(collector *nbdb.SampleCollector) bool { + err = libovsdbops.DeleteSampleCollectorWithPredicate(nbClient, func(_ *nbdb.SampleCollector) bool { return true }) if err != nil { @@ -189,7 +190,7 @@ func Cleanup(nbClient libovsdbclient.Client) error { } func (m *Manager) setSamplingAppIDs() error { - var ops []libovsdb.Operation + var ops []ovsdb.Operation var err error for _, appConfig := range []struct { id int diff --git a/vendor/modules.txt b/vendor/modules.txt index ea51ec4098f59f48c277db34c44592ba049bc981..9c59aa9f1f1b50f4d478f70757e2d693e5ee6b2d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -357,7 +357,7 @@ github.com/ovn-org/libovsdb/model github.com/ovn-org/libovsdb/ovsdb github.com/ovn-org/libovsdb/ovsdb/serverdb github.com/ovn-org/libovsdb/updates -# github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20250215040159-dd2a70c928d3 +# github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20250227173154-57a2590a1d16 ## explicit; go 1.22.0 github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/model github.com/ovn-org/ovn-kubernetes/go-controller/observability-lib/ovsdb