From 96b3f9e8e7e751c685e026bd169d54f2aa4620bb Mon Sep 17 00:00:00 2001 From: zhangzujian Date: Wed, 4 Sep 2024 06:36:35 +0000 Subject: [PATCH] Enable inactivity check on ovndb connection (#4006) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fanriming Co-authored-by: 张祖建 Signed-off-by: zhangzujian --- go.mod | 2 +- go.sum | 4 +- pkg/controller/config.go | 32 ++++++---- pkg/controller/controller.go | 13 +++- pkg/ovn_ic_controller/config.go | 28 +++++---- pkg/ovn_ic_controller/controller.go | 14 ++++- pkg/ovs/ovn-nb-suite_test.go | 4 +- pkg/ovs/ovn.go | 8 +-- pkg/ovsdb/client/client.go | 21 +++++-- pkg/ovsdb/ovnnb/model.go | 48 ++++++++++----- pkg/ovsdb/ovnsb/bfd.go | 1 + pkg/ovsdb/ovnsb/igmp_group.go | 11 ++-- pkg/ovsdb/ovnsb/model.go | 92 ++++++++++++++++++++--------- pkg/ovsdb/ovnsb/service_monitor.go | 1 + 14 files changed, 189 insertions(+), 90 deletions(-) diff --git a/go.mod b/go.mod index b112eac6f9a5..174abaa6299d 100644 --- a/go.mod +++ b/go.mod @@ -186,7 +186,7 @@ require ( replace ( github.com/mdlayher/arp => github.com/kubeovn/arp v0.0.0-20240218024213-d9612a263f68 github.com/openshift/client-go => github.com/openshift/client-go v0.0.1 - github.com/ovn-org/libovsdb => github.com/kubeovn/libovsdb v0.0.0-20230517064328-9d5a1383643f + github.com/ovn-org/libovsdb => github.com/kubeovn/libovsdb v0.0.0-20240814054845-978196448fb2 k8s.io/api => k8s.io/api v0.30.4 k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.30.4 k8s.io/apimachinery => k8s.io/apimachinery v0.30.4 diff --git a/go.sum b/go.sum index 0c1bdde134d7..bc4f03c1e878 100644 --- a/go.sum +++ b/go.sum @@ -1015,8 +1015,8 @@ github.com/kubeovn/go-iptables v0.0.0-20230322103850-8619a8ab3dca h1:fTMjoho2et9 github.com/kubeovn/go-iptables v0.0.0-20230322103850-8619a8ab3dca/go.mod h1:jY1XeGzkx8ASNJ+SqQSxTESNXARkjvt+I6IJOTnzIjw= github.com/kubeovn/gonetworkmanager/v2 v2.0.0-20230905082151-e28c4d73a589 h1:y9exo1hjCsq7jsGUzt11kxhTiEGrGSQ0ZqibAiZk2PQ= github.com/kubeovn/gonetworkmanager/v2 v2.0.0-20230905082151-e28c4d73a589/go.mod h1:49upX+/hUyppWIqu58cumojyIwXdkA8k6reA/mQlKuI= -github.com/kubeovn/libovsdb v0.0.0-20230517064328-9d5a1383643f h1:HDjnbJZN+2T3XH7usjtO2+PYDA2fyrLGYjypEA/87pM= -github.com/kubeovn/libovsdb v0.0.0-20230517064328-9d5a1383643f/go.mod h1:NHoQwGSKygdpFb8y7HBS6b1HP4EtJ14zzLrnd/A1fmY= +github.com/kubeovn/libovsdb v0.0.0-20240814054845-978196448fb2 h1:jH4yKIJLu2ZBy6fLMrlVa27ccgjzc53rsGDzNvddh0E= +github.com/kubeovn/libovsdb v0.0.0-20240814054845-978196448fb2/go.mod h1:od3agzU0e50RPBxap7mMvBWZ+u37kqX0W849BYufdHI= github.com/kubeovn/ovsdb v0.0.0-20240410091831-5dd26006c475 h1:KZba2Kj9TXCUdUSqOR3eiy4VvkkIyhDVImYmYs6GQWU= github.com/kubeovn/ovsdb v0.0.0-20240410091831-5dd26006c475/go.mod h1:LAd0qoeAAm/QyZcpxN2BnpndM2/dhZt+/kokPvcxKcE= github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0 h1:nHHjmvjitIiyPlUHk/ofpgvBcNcawJLtf4PYHORLjAA= diff --git a/pkg/controller/config.go b/pkg/controller/config.go index 2e42770c33f8..833ba5d089ba 100644 --- a/pkg/controller/config.go +++ b/pkg/controller/config.go @@ -20,13 +20,15 @@ import ( // Configuration is the controller conf type Configuration struct { - OvnNbAddr string - OvnSbAddr string - OvnTimeout int - CustCrdRetryMaxDelay int - CustCrdRetryMinDelay int - KubeConfigFile string - KubeRestConfig *rest.Config + OvnNbAddr string + OvnSbAddr string + OvnTimeout int + OvsDbConnectTimeout int + OvsDbInactivityTimeout int + CustCrdRetryMaxDelay int + CustCrdRetryMinDelay int + KubeConfigFile string + KubeRestConfig *rest.Config KubeClient kubernetes.Interface KubeOvnClient clientset.Interface @@ -106,12 +108,14 @@ type Configuration struct { // TODO: validate configuration func ParseFlags() (*Configuration, error) { var ( - argOvnNbAddr = pflag.String("ovn-nb-addr", "", "ovn-nb address") - argOvnSbAddr = pflag.String("ovn-sb-addr", "", "ovn-sb address") - argOvnTimeout = pflag.Int("ovn-timeout", 60, "") - argCustCrdRetryMinDelay = pflag.Int("cust-crd-retry-min-delay", 1, "The min delay seconds between custom crd two retries") - argCustCrdRetryMaxDelay = pflag.Int("cust-crd-retry-max-delay", 20, "The max delay seconds between custom crd two retries") - argKubeConfigFile = pflag.String("kubeconfig", "", "Path to kubeconfig file with authorization and master location information. If not set use the inCluster token.") + argOvnNbAddr = pflag.String("ovn-nb-addr", "", "ovn-nb address") + argOvnSbAddr = pflag.String("ovn-sb-addr", "", "ovn-sb address") + argOvnTimeout = pflag.Int("ovn-timeout", 60, "") + argOvsDbConTimeout = pflag.Int("ovsdb-con-timeout", 3, "The seconds to wait ovsdb connect timeout") + argOvsDbInactivityTimeout = pflag.Int("ovsdb-inactivity-timeout", 10, "The seconds to wait ovsdb inactivity check timeout") + argCustCrdRetryMinDelay = pflag.Int("cust-crd-retry-min-delay", 1, "The min delay seconds between custom crd two retries") + argCustCrdRetryMaxDelay = pflag.Int("cust-crd-retry-max-delay", 20, "The max delay seconds between custom crd two retries") + argKubeConfigFile = pflag.String("kubeconfig", "", "Path to kubeconfig file with authorization and master location information. If not set use the inCluster token.") argDefaultLogicalSwitch = pflag.String("default-ls", util.DefaultSubnet, "The default logical switch name") argDefaultCIDR = pflag.String("default-cidr", "10.16.0.0/16", "Default CIDR for namespace with no logical switch annotation") @@ -196,6 +200,8 @@ func ParseFlags() (*Configuration, error) { OvnNbAddr: *argOvnNbAddr, OvnSbAddr: *argOvnSbAddr, OvnTimeout: *argOvnTimeout, + OvsDbConnectTimeout: *argOvsDbConTimeout, + OvsDbInactivityTimeout: *argOvsDbInactivityTimeout, CustCrdRetryMinDelay: *argCustCrdRetryMinDelay, CustCrdRetryMaxDelay: *argCustCrdRetryMaxDelay, KubeConfigFile: *argKubeConfigFile, diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go index 03ee4cbc42f7..5da3ce3f71ce 100644 --- a/pkg/controller/controller.go +++ b/pkg/controller/controller.go @@ -466,10 +466,19 @@ func Run(ctx context.Context, config *Configuration) { } var err error - if controller.OVNNbClient, err = ovs.NewOvnNbClient(config.OvnNbAddr, config.OvnTimeout); err != nil { + if controller.OVNNbClient, err = ovs.NewOvnNbClient( + config.OvnNbAddr, + config.OvnTimeout, + config.OvsDbConnectTimeout, + config.OvsDbInactivityTimeout); err != nil { util.LogFatalAndExit(err, "failed to create ovn nb client") } - if controller.OVNSbClient, err = ovs.NewOvnSbClient(config.OvnSbAddr, config.OvnTimeout); err != nil { + if controller.OVNSbClient, err = ovs.NewOvnSbClient( + config.OvnSbAddr, + config.OvnTimeout, + config.OvsDbConnectTimeout, + config.OvsDbInactivityTimeout, + ); err != nil { util.LogFatalAndExit(err, "failed to create ovn sb client") } if config.EnableLb { diff --git a/pkg/ovn_ic_controller/config.go b/pkg/ovn_ic_controller/config.go index a02d7c1d97c6..0346fe8b5f02 100644 --- a/pkg/ovn_ic_controller/config.go +++ b/pkg/ovn_ic_controller/config.go @@ -21,10 +21,12 @@ type Configuration struct { KubeClient kubernetes.Interface KubeOvnClient clientset.Interface - PodNamespace string - OvnNbAddr string - OvnSbAddr string - OvnTimeout int + PodNamespace string + OvnNbAddr string + OvnSbAddr string + OvnTimeout int + OvsDbConnectTimeout int + OvsDbInactivityTimeout int NodeSwitch string ClusterRouter string @@ -35,9 +37,11 @@ func ParseFlags() (*Configuration, error) { var ( argKubeConfigFile = pflag.String("kubeconfig", "", "Path to kubeconfig file with authorization and master location information. If not set use the inCluster token.") - argOvnNbAddr = pflag.String("ovn-nb-addr", "", "ovn-nb address") - argOvnSbAddr = pflag.String("ovn-sb-addr", "", "ovn-sb address") - argOvnTimeout = pflag.Int("ovn-timeout", 60, "") + argOvnNbAddr = pflag.String("ovn-nb-addr", "", "ovn-nb address") + argOvnSbAddr = pflag.String("ovn-sb-addr", "", "ovn-sb address") + argOvnTimeout = pflag.Int("ovn-timeout", 60, "") + argOvsDbConTimeout = pflag.Int("ovsdb-con-timeout", 3, "") + argOvsDbInactivityTimeout = pflag.Int("ovsdb-inactivity-timeout", 10, "") argClusterRouter = pflag.String("cluster-router", util.DefaultVpc, "The router name for cluster router") argNodeSwitch = pflag.String("node-switch", "join", "The name of node gateway switch which help node to access pod network") @@ -71,10 +75,12 @@ func ParseFlags() (*Configuration, error) { config := &Configuration{ KubeConfigFile: *argKubeConfigFile, - PodNamespace: os.Getenv("POD_NAMESPACE"), - OvnNbAddr: *argOvnNbAddr, - OvnSbAddr: *argOvnSbAddr, - OvnTimeout: *argOvnTimeout, + PodNamespace: os.Getenv("POD_NAMESPACE"), + OvnNbAddr: *argOvnNbAddr, + OvnSbAddr: *argOvnSbAddr, + OvnTimeout: *argOvnTimeout, + OvsDbConnectTimeout: *argOvsDbConTimeout, + OvsDbInactivityTimeout: *argOvsDbInactivityTimeout, ClusterRouter: *argClusterRouter, NodeSwitch: *argNodeSwitch, diff --git a/pkg/ovn_ic_controller/controller.go b/pkg/ovn_ic_controller/controller.go index 95067a7e817c..19104814ee25 100644 --- a/pkg/ovn_ic_controller/controller.go +++ b/pkg/ovn_ic_controller/controller.go @@ -87,10 +87,20 @@ func NewController(config *Configuration) *Controller { } var err error - if controller.OVNNbClient, err = ovs.NewOvnNbClient(config.OvnNbAddr, config.OvnTimeout); err != nil { + if controller.OVNNbClient, err = ovs.NewOvnNbClient( + config.OvnNbAddr, + config.OvnTimeout, + config.OvsDbConnectTimeout, + config.OvsDbInactivityTimeout, + ); err != nil { util.LogFatalAndExit(err, "failed to create ovn nb client") } - if controller.OVNSbClient, err = ovs.NewOvnSbClient(config.OvnSbAddr, config.OvnTimeout); err != nil { + if controller.OVNSbClient, err = ovs.NewOvnSbClient( + config.OvnSbAddr, + config.OvnTimeout, + config.OvsDbConnectTimeout, + config.OvsDbInactivityTimeout, + ); err != nil { util.LogFatalAndExit(err, "failed to create ovn sb client") } diff --git a/pkg/ovs/ovn-nb-suite_test.go b/pkg/ovs/ovn-nb-suite_test.go index d4d99e89dca9..d950346b40d8 100644 --- a/pkg/ovs/ovn-nb-suite_test.go +++ b/pkg/ovs/ovn-nb-suite_test.go @@ -13,7 +13,7 @@ import ( "github.com/cenkalti/backoff/v4" "github.com/go-logr/stdr" "github.com/ovn-org/libovsdb/client" - "github.com/ovn-org/libovsdb/database" + "github.com/ovn-org/libovsdb/database/inmemory" "github.com/ovn-org/libovsdb/model" "github.com/ovn-org/libovsdb/ovsdb" "github.com/ovn-org/libovsdb/ovsdb/serverdb" @@ -702,7 +702,7 @@ func newOVSDBServer(t *testing.T, dbModel model.ClientDBModel, schema ovsdb.Data require.NoError(t, err) serverSchema := serverdb.Schema() - db := database.NewInMemoryDatabase(map[string]model.ClientDBModel{ + db := inmemory.NewDatabase(map[string]model.ClientDBModel{ schema.Name: dbModel, serverSchema.Name: serverDBModel, }) diff --git a/pkg/ovs/ovn.go b/pkg/ovs/ovn.go index 0f7e826adfa9..3b2c41f76932 100644 --- a/pkg/ovs/ovn.go +++ b/pkg/ovs/ovn.go @@ -53,7 +53,7 @@ func NewLegacyClient(timeout int) *LegacyClient { } } -func NewOvnNbClient(ovnNbAddr string, ovnNbTimeout int) (*OVNNbClient, error) { +func NewOvnNbClient(ovnNbAddr string, ovnNbTimeout, ovsDbConTimeout, ovsDbInactivityTimeout int) (*OVNNbClient, error) { dbModel, err := ovnnb.FullDatabaseModel() if err != nil { klog.Error(err) @@ -78,7 +78,7 @@ func NewOvnNbClient(ovnNbAddr string, ovnNbTimeout int) (*OVNNbClient, error) { client.WithTable(&ovnnb.NBGlobal{}), client.WithTable(&ovnnb.PortGroup{}), } - nbClient, err := ovsclient.NewOvsDbClient(ovsclient.NBDB, ovnNbAddr, dbModel, monitors) + nbClient, err := ovsclient.NewOvsDbClient(ovsclient.NBDB, ovnNbAddr, dbModel, monitors, ovsDbConTimeout, ovsDbInactivityTimeout) if err != nil { klog.Errorf("failed to create OVN NB client: %v", err) return nil, err @@ -93,7 +93,7 @@ func NewOvnNbClient(ovnNbAddr string, ovnNbTimeout int) (*OVNNbClient, error) { return c, nil } -func NewOvnSbClient(ovnSbAddr string, ovnSbTimeout int) (*OVNSbClient, error) { +func NewOvnSbClient(ovnSbAddr string, ovnSbTimeout, ovsDbConTimeout, ovsDbInactivityTimeout int) (*OVNSbClient, error) { dbModel, err := ovnsb.FullDatabaseModel() if err != nil { klog.Error(err) @@ -104,7 +104,7 @@ func NewOvnSbClient(ovnSbAddr string, ovnSbTimeout int) (*OVNSbClient, error) { client.WithTable(&ovnsb.Chassis{}), // TODO:// monitor other necessary tables in ovsdb/ovnsb/model.go } - sbClient, err := ovsclient.NewOvsDbClient(ovsclient.SBDB, ovnSbAddr, dbModel, monitors) + sbClient, err := ovsclient.NewOvsDbClient(ovsclient.SBDB, ovnSbAddr, dbModel, monitors, ovsDbConTimeout, ovsDbInactivityTimeout) if err != nil { klog.Errorf("failed to create OVN SB client: %v", err) return nil, err diff --git a/pkg/ovsdb/client/client.go b/pkg/ovsdb/client/client.go index 38371fa204c1..f0baf859a030 100644 --- a/pkg/ovsdb/client/client.go +++ b/pkg/ovsdb/client/client.go @@ -25,7 +25,6 @@ const ( ICNBDB = "icnbdb" ICSBDB = "icsbdb" ) -const timeout = 3 * time.Second var namedUUIDCounter uint32 @@ -42,10 +41,24 @@ func NamedUUID() string { } // NewOvsDbClient creates a new ovsdb client -func NewOvsDbClient(db, addr string, dbModel model.ClientDBModel, monitors []client.MonitorOption) (client.Client, error) { +func NewOvsDbClient( + db string, + addr string, + dbModel model.ClientDBModel, + monitors []client.MonitorOption, + ovsDbConTimeout int, + ovsDbInactivityTimeout int, +) (client.Client, error) { logger := klog.NewKlogr().WithName("libovsdb").WithValues("db", db) + connectTimeout := time.Duration(ovsDbConTimeout) * time.Second + inactivityTimeout := time.Duration(ovsDbInactivityTimeout) * time.Second options := []client.Option{ - client.WithReconnect(timeout, &backoff.ConstantBackOff{Interval: time.Second}), + // Reading and parsing the DB after reconnect at scale can (unsurprisingly) + // take longer than a normal ovsdb operation. Give it a bit more time so + // we don't time out and enter a reconnect loop. In addition it also enables + // inactivity check on the ovsdb connection. + client.WithInactivityCheck(inactivityTimeout, connectTimeout, &backoff.ZeroBackOff{}), + client.WithLeaderOnly(true), client.WithLogger(&logger), } @@ -84,7 +97,7 @@ func NewOvsDbClient(db, addr string, dbModel model.ClientDBModel, monitors []cli klog.Error(err) return nil, err } - ctx, cancel := context.WithTimeout(context.Background(), time.Duration(len(endpoints)+1)*timeout) + ctx, cancel := context.WithTimeout(context.Background(), connectTimeout) defer cancel() if err = c.Connect(ctx); err != nil { klog.Errorf("failed to connect to OVN NB server %s: %v", addr, err) diff --git a/pkg/ovsdb/ovnnb/model.go b/pkg/ovsdb/ovnnb/model.go index f06a0697d11b..87a79fdab5d9 100644 --- a/pkg/ovsdb/ovnnb/model.go +++ b/pkg/ovsdb/ovnnb/model.go @@ -203,7 +203,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "BFD": { "columns": { @@ -290,7 +291,8 @@ var schema = `{ "logical_port", "dst_ip" ] - ] + ], + "isRoot": true }, "Chassis_Template_Var": { "columns": { @@ -326,7 +328,8 @@ var schema = `{ [ "chassis" ] - ] + ], + "isRoot": true }, "Connection": { "columns": { @@ -434,7 +437,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "DHCP_Options": { "columns": { @@ -465,7 +469,8 @@ var schema = `{ "max": "unlimited" } } - } + }, + "isRoot": true }, "DNS": { "columns": { @@ -493,7 +498,8 @@ var schema = `{ "max": "unlimited" } } - } + }, + "isRoot": true }, "Forwarding_Group": { "columns": { @@ -641,7 +647,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "Load_Balancer": { "columns": { @@ -744,7 +751,8 @@ var schema = `{ "max": "unlimited" } } - } + }, + "isRoot": true }, "Load_Balancer_Group": { "columns": { @@ -767,7 +775,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "Load_Balancer_Health_Check": { "columns": { @@ -914,7 +923,8 @@ var schema = `{ "max": "unlimited" } } - } + }, + "isRoot": true }, "Logical_Router_Policy": { "columns": { @@ -1287,7 +1297,8 @@ var schema = `{ "max": "unlimited" } } - } + }, + "isRoot": true }, "Logical_Switch_Port": { "columns": { @@ -1504,7 +1515,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "Meter_Band": { "columns": { @@ -1604,7 +1616,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "NAT": { "columns": { @@ -1779,7 +1792,8 @@ var schema = `{ "max": 1 } } - } + }, + "isRoot": true }, "Port_Group": { "columns": { @@ -1825,7 +1839,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "QoS": { "columns": { @@ -1959,7 +1974,8 @@ var schema = `{ "logical_port", "ip" ] - ] + ], + "isRoot": true } } }` diff --git a/pkg/ovsdb/ovnsb/bfd.go b/pkg/ovsdb/ovnsb/bfd.go index ab4aae34b588..ccfebbcf26ab 100644 --- a/pkg/ovsdb/ovnsb/bfd.go +++ b/pkg/ovsdb/ovnsb/bfd.go @@ -19,6 +19,7 @@ var ( // BFD defines an object in BFD table type BFD struct { UUID string `ovsdb:"_uuid"` + ChassisName string `ovsdb:"chassis_name"` DetectMult int `ovsdb:"detect_mult"` Disc int `ovsdb:"disc"` DstIP string `ovsdb:"dst_ip"` diff --git a/pkg/ovsdb/ovnsb/igmp_group.go b/pkg/ovsdb/ovnsb/igmp_group.go index bb91fbacc3ae..508649e71d95 100644 --- a/pkg/ovsdb/ovnsb/igmp_group.go +++ b/pkg/ovsdb/ovnsb/igmp_group.go @@ -7,9 +7,10 @@ const IGMPGroupTable = "IGMP_Group" // IGMPGroup defines an object in IGMP_Group table type IGMPGroup struct { - UUID string `ovsdb:"_uuid"` - Address string `ovsdb:"address"` - Chassis *string `ovsdb:"chassis"` - Datapath *string `ovsdb:"datapath"` - Ports []string `ovsdb:"ports"` + UUID string `ovsdb:"_uuid"` + Address string `ovsdb:"address"` + Chassis *string `ovsdb:"chassis"` + ChassisName string `ovsdb:"chassis_name"` + Datapath *string `ovsdb:"datapath"` + Ports []string `ovsdb:"ports"` } diff --git a/pkg/ovsdb/ovnsb/model.go b/pkg/ovsdb/ovnsb/model.go index da9f6aea7c76..474f83cb86a4 100644 --- a/pkg/ovsdb/ovnsb/model.go +++ b/pkg/ovsdb/ovnsb/model.go @@ -52,7 +52,7 @@ func FullDatabaseModel() (model.ClientDBModel, error) { var schema = `{ "name": "OVN_Southbound", - "version": "20.27.0", + "version": "20.30.0", "tables": { "Address_Set": { "columns": { @@ -73,10 +73,14 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "BFD": { "columns": { + "chassis_name": { + "type": "string" + }, "detect_mult": { "type": "integer" }, @@ -152,7 +156,8 @@ var schema = `{ "src_port", "disc" ] - ] + ], + "isRoot": true }, "Chassis": { "columns": { @@ -222,7 +227,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "Chassis_Private": { "columns": { @@ -263,7 +269,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "Chassis_Template_Var": { "columns": { @@ -287,7 +294,8 @@ var schema = `{ [ "chassis" ] - ] + ], + "isRoot": true }, "Connection": { "columns": { @@ -403,7 +411,8 @@ var schema = `{ "seq_num": { "type": "integer" } - } + }, + "isRoot": true }, "DHCP_Options": { "columns": { @@ -440,7 +449,8 @@ var schema = `{ } } } - } + }, + "isRoot": true }, "DHCPv6_Options": { "columns": { @@ -471,7 +481,8 @@ var schema = `{ } } } - } + }, + "isRoot": true }, "DNS": { "columns": { @@ -509,7 +520,8 @@ var schema = `{ "max": "unlimited" } } - } + }, + "isRoot": true }, "Datapath_Binding": { "columns": { @@ -548,7 +560,8 @@ var schema = `{ [ "tunnel_key" ] - ] + ], + "isRoot": true }, "Encap": { "columns": { @@ -622,7 +635,8 @@ var schema = `{ "mac", "dp_key" ] - ] + ], + "isRoot": true }, "Gateway_Chassis": { "columns": { @@ -760,7 +774,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "IGMP_Group": { "columns": { @@ -778,6 +793,9 @@ var schema = `{ "max": 1 } }, + "chassis_name": { + "type": "string" + }, "datapath": { "type": { "key": { @@ -807,7 +825,8 @@ var schema = `{ "datapath", "chassis" ] - ] + ], + "isRoot": true }, "IP_Multicast": { "columns": { @@ -891,7 +910,8 @@ var schema = `{ [ "datapath" ] - ] + ], + "isRoot": true }, "Load_Balancer": { "columns": { @@ -971,7 +991,8 @@ var schema = `{ "max": "unlimited" } } - } + }, + "isRoot": true }, "Logical_DP_Group": { "columns": { @@ -1081,7 +1102,8 @@ var schema = `{ "max": "unlimited" } } - } + }, + "isRoot": true }, "MAC_Binding": { "columns": { @@ -1111,7 +1133,8 @@ var schema = `{ "logical_port", "ip" ] - ] + ], + "isRoot": true }, "Meter": { "columns": { @@ -1148,7 +1171,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "Meter_Band": { "columns": { @@ -1236,7 +1260,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "Multicast_Group": { "columns": { @@ -1281,7 +1306,8 @@ var schema = `{ "datapath", "name" ] - ] + ], + "isRoot": true }, "Port_Binding": { "columns": { @@ -1505,7 +1531,8 @@ var schema = `{ [ "logical_port" ] - ] + ], + "isRoot": true }, "Port_Group": { "columns": { @@ -1526,7 +1553,8 @@ var schema = `{ [ "name" ] - ] + ], + "isRoot": true }, "RBAC_Permission": { "columns": { @@ -1554,7 +1582,8 @@ var schema = `{ "max": "unlimited" } } - } + }, + "isRoot": true }, "RBAC_Role": { "columns": { @@ -1575,7 +1604,8 @@ var schema = `{ "max": "unlimited" } } - } + }, + "isRoot": true }, "SB_Global": { "columns": { @@ -1629,7 +1659,8 @@ var schema = `{ "max": 1 } } - } + }, + "isRoot": true }, "SSL": { "columns": { @@ -1667,6 +1698,9 @@ var schema = `{ }, "Service_Monitor": { "columns": { + "chassis_name": { + "type": "string" + }, "external_ids": { "type": { "key": { @@ -1753,7 +1787,8 @@ var schema = `{ "port", "protocol" ] - ] + ], + "isRoot": true }, "Static_MAC_Binding": { "columns": { @@ -1783,7 +1818,8 @@ var schema = `{ "logical_port", "ip" ] - ] + ], + "isRoot": true } } }` diff --git a/pkg/ovsdb/ovnsb/service_monitor.go b/pkg/ovsdb/ovnsb/service_monitor.go index 1c46c7a1448d..6314a513aa7f 100644 --- a/pkg/ovsdb/ovnsb/service_monitor.go +++ b/pkg/ovsdb/ovnsb/service_monitor.go @@ -21,6 +21,7 @@ var ( // ServiceMonitor defines an object in Service_Monitor table type ServiceMonitor struct { UUID string `ovsdb:"_uuid"` + ChassisName string `ovsdb:"chassis_name"` ExternalIDs map[string]string `ovsdb:"external_ids"` IP string `ovsdb:"ip"` LogicalPort string `ovsdb:"logical_port"`