Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove lingering nb/sb ctl calls from the code base #2697

Merged
merged 7 commits into from
Dec 15, 2021

Conversation

astoycos
Copy link
Collaborator

@astoycos astoycos commented Dec 8, 2021

Removes/ converts all (that I'm aware of) nb/sbctl calls and converts them to use libovsdb. (except for #2574) This is mostly completed by adding helper functions to libovsdbops package. Its also moves the libovsdbops package to go-controller/pkg since its used by many packages in that directory, not just the OVN package

TODO:

@astoycos astoycos force-pushed the remove-old-clients branch 2 times, most recently from 0ecbe76 to 40ad9df Compare December 8, 2021 18:31
@coveralls
Copy link

coveralls commented Dec 8, 2021

Coverage Status

Coverage decreased (-0.3%) to 49.824% when pulling cd445c5 on astoycos:remove-old-clients into ae6172e on ovn-org:master.

@astoycos astoycos force-pushed the remove-old-clients branch 2 times, most recently from e9ade69 to ea871b8 Compare December 8, 2021 21:07
Copy link
Contributor

@jcaamano jcaamano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor things.

go-controller/pkg/util/ovs.go Outdated Show resolved Hide resolved
go-controller/pkg/ovn/libovsdbops/encap.go Outdated Show resolved Hide resolved
go-controller/pkg/node/node.go Outdated Show resolved Hide resolved
go-controller/hybrid-overlay/pkg/controller/node_linux.go Outdated Show resolved Hide resolved
go-controller/pkg/node/node.go Outdated Show resolved Hide resolved
go-controller/pkg/node/node.go Outdated Show resolved Hide resolved
go-controller/pkg/ovn/libovsdbops/meter.go Outdated Show resolved Hide resolved
@astoycos astoycos force-pushed the remove-old-clients branch 2 times, most recently from b8b0007 to f16f210 Compare December 9, 2021 18:16
@astoycos
Copy link
Collaborator Author

astoycos commented Dec 9, 2021

NOTE: I had an all green CI run on by local fork here -> https://github.com/astoycos/ovn-kubernetes/actions/runs/1560092606

Copy link
Contributor

@flavio-fernandes flavio-fernandes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff! Just some small-ish comment, Andrew.

},
},
{
Model: meter,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the unlikely scenario that meter already had a meterBand, consider making this a mutateInsert opeartion?
Otherwise maybe we should call this fcn as ... 'CreateMeterAndSetMeterBand' ?!? Maybe not, that is ugly :P

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well we assume if we're in the function the meter didn't exist, and we're also assuming that if the meter didn't exist that the meterBand doesn't exist either (since there's no way to lookup the meterband without looking up the meter)

go-controller/pkg/ovn/libovsdbops/model.go Outdated Show resolved Hide resolved
go-controller/pkg/ovn/libovsdbops/logical_switch_port.go Outdated Show resolved Hide resolved
go-controller/pkg/node/node.go Outdated Show resolved Hide resolved
go-controller/pkg/ovn/libovsdbops/encap.go Outdated Show resolved Hide resolved
go-controller/pkg/ovn/libovsdbops/encap.go Outdated Show resolved Hide resolved
go-controller/pkg/ovn/controller/unidling/ovn_event.go Outdated Show resolved Hide resolved
Copy link
Contributor

@trozet trozet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general worried about making libovsdb clients on the node code. It will for sure break upgrades because node will upgrade first, try to connect to an older schema and fail to validate the client's schema expectation. I think we should figure out if we want libovsdb clients from the nodes and if the answer is yes, then we will need something like ovn-org/libovsdb#257

go-controller/cmd/ovnkube/ovnkube.go Outdated Show resolved Hide resolved
go-controller/pkg/node/node.go Outdated Show resolved Hide resolved
go-controller/pkg/node/node.go Outdated Show resolved Hide resolved
go-controller/pkg/ovn/controller/unidling/ovn_event.go Outdated Show resolved Hide resolved
@@ -374,7 +375,7 @@ func (m *MasterController) setupHybridLRPolicySharedGw(nodeSubnets []*net.IPNet,

if len(logicalRouterPolicyRes) == 0 {
logicalPort := ovntypes.RouterToSwitchPrefix + nodeName
if err := util.CreateMACBinding(logicalPort, ovntypes.OVNClusterRouter, portMac, drIP); err != nil {
if err := util.CreateMACBinding(m.sbClient, logicalPort, ovntypes.OVNClusterRouter, portMac, drIP); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note to self: Remove final sbctl calls from Hybrid Overlay commit looks good

go-controller/pkg/ovn/ovn.go Outdated Show resolved Hide resolved
go-controller/pkg/ovn/ovn.go Outdated Show resolved Hide resolved
@astoycos
Copy link
Collaborator Author

Waiting a bit for any more comments here before taking out the node process libovsdb commits :(

@dcbw
Copy link
Contributor

dcbw commented Dec 10, 2021

@astoycos so, yeah there are some OVN calls in the HO Linux... I think it's fine to pass an NBClient into NewNode/newNodeController and use that in the Linux code, because we never run standalone HO binary on Linux. Windows wouldn't use it anyway since it doesn't talk to OVN at all, so we can just pass nil in there or something.

@astoycos
Copy link
Collaborator Author

astoycos commented Dec 13, 2021

I've taken out the bits where I started making libovsdbclients per node, specifically in the HO node controller and ovnkube-node code, where we still will use nb/sbctl

however it would be nice if we could run the libovsdb-clients in a no-cache mode so that we could be consistent in it's use across the codebase

@astoycos
Copy link
Collaborator Author

astoycos commented Dec 13, 2021

Here's a quick summary of where we are still using nb/sbctl commands in the code base following this PR

ovn-kube-util binary

hybrid-overlay-node binary

ovnkube-node binary

ovnkube-master binary

The util functions to support the above raw nb/sbctl calls are found in the github.com/ovn-org/ovn-kubernetes/go-controller/util package

@astoycos astoycos force-pushed the remove-old-clients branch 2 times, most recently from 9ca22b5 to a0b1625 Compare December 14, 2021 21:03
go-controller/cmd/ovnkube/ovnkube.go Outdated Show resolved Hide resolved
@@ -286,7 +290,6 @@ func runOvnKube(ctx *cli.Context) error {
// start the prometheus server to serve OVN Metrics (default port: 9476)
// Note: for ovnkube node mode dpu-host no ovn metrics is required as ovn is not running on the node.
if config.OvnKubeNode.Mode != types.NodeModeDPUHost && config.Kubernetes.OVNMetricsBindAddress != "" {
metrics.RegisterOvnMetrics(ovnClientset.KubeClient, node)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@girishmg iirc you put the metrics in the node because in upstream/nvidia you run OVN DB on its own node so running it on master isnt feasible. Is my memory correct? Maybe we should put the ovn metrics into ovn-dbchecker?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trozet that is correct. To enable rolling updates, this is the split we have:

|-------------+-----------------------------+-----------|
| Kind        | Pod                         | Component |
|-------------+-----------------------------+-----------|
| Statefulset | ovn-nbdb                    | OVN       |
| Statefulset | ovn-sbdb                    | OVN       |
| Daemonset   | ovn-host                    | OVN       |
| Deployment  | ovn-northd (replicas=3)     |           |
|-------------+-----------------------------+-----------|
| Deployment  | ovnkube-master (replicas=3) | OVN-K8s   |
| Daemonset   | ovnkube-node                | OVN-K8s   |
|-------------+-----------------------------+-----------|

There was also requirement from both RH and NVDA that we reduce the number of TCP Ports from which we expose prometheus metrics. If we have more TCP Ports, then we need equal instances of rbac-proxy to terminate TLS. So, we moved all the OVN/OVS/Ovnkube-node metric collection to ovnkube-node.

Ovnkube-master still continues to export it's metric

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@girishmg what do you think about putting the metrics on ovndbchecker?

astoycos added 6 commits December 15, 2021 10:07
Convert the creation/ configuration of the OVN
meter and meter_band objects for the acl-logging
feature to libovdb

Signed-off-by: astoycos <[email protected]>
Set the `controller_event` option on the
nb_global table to `true` with libovsdb

Signed-off-by: astoycos <[email protected]>
Convert all remaining nbctl calls from the
hybridOverlay package

Update unit test accordingly

Signed-off-by: astoycos <[email protected]>
Remove the final sbctl calls regarding mac_bindings
from the hybrid overlay code and convert to libovsdb

Ensure we index mac_binding by both possible options,
the `logical_port` OR `ip` columns

Signed-off-by: astoycos <[email protected]>
Remove some erronous fexec calls

Remove the NBtxn struct and associated
helper functions

Signed-off-by: astoycos <[email protected]>
Remove all of the unused nb/sb ctl helper functions
from the util package and add notes on when
the rest can be removed

Signed-off-by: astoycos <[email protected]>
Move the libovsdbops package out of the
`go-controller/pkg/ovn` directory and into
`go-controller/pkg` since its used by many packages
in the directory.

Signed-off-by: astoycos <[email protected]>
@astoycos
Copy link
Collaborator Author

For now until we decide what to do with the ovn_db metrics I removed the commit from this PR and made an issue to track that work item

@flavio-fernandes
Copy link
Contributor

@astoycos if possible, please paste a link to the tracking issue created here, so we can located from this pr.

@astoycos
Copy link
Collaborator Author

#2713

Copy link
Contributor

@trozet trozet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@trozet trozet merged commit 8b849a3 into ovn-org:master Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants