Skip to content

Commit

Permalink
Merge pull request #246 from mtomaska/n_threads
Browse files Browse the repository at this point in the history
Add --n-threads option to ovn-northd
  • Loading branch information
openshift-merge-bot[bot] committed Mar 18, 2024
2 parents f132fab + d2fc1db commit cfd21c1
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 1 deletion.
6 changes: 6 additions & 0 deletions api/bases/ovn.openstack.org_ovnnorthds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ spec:
default: info
description: LogLevel - Set log level info, dbg, emer etc
type: string
nThreads:
default: 1
description: NThreads sets number of threads used for building logical
flows
format: int32
type: integer
networkAttachment:
description: NetworkAttachment is a NetworkAttachment resource name
to expose the service to the given network. If specified the IP
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/ovnnorthd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ type OVNNorthdSpecCore struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec
// TLS - Parameters related to TLS
TLS tls.SimpleService `json:"tls,omitempty"`

// +kubebuilder:validation:Optional
// +kubebuilder:default=1
// NThreads sets number of threads used for building logical flows
NThreads *int32 `json:"nThreads"`
}

// OVNNorthdStatus defines the observed state of OVNNorthd
Expand Down
5 changes: 5 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions config/crd/bases/ovn.openstack.org_ovnnorthds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@ spec:
default: info
description: LogLevel - Set log level info, dbg, emer etc
type: string
nThreads:
default: 1
description: NThreads sets number of threads used for building logical
flows
format: int32
type: integer
networkAttachment:
description: NetworkAttachment is a NetworkAttachment resource name
to expose the service to the given network. If specified the IP
Expand Down
1 change: 1 addition & 0 deletions pkg/ovnnorthd/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func Deployment(
args := []string{
"-vfile:off",
fmt.Sprintf("-vconsole:%s", instance.Spec.LogLevel),
fmt.Sprintf("--n-threads=%d", *instance.Spec.NThreads),
fmt.Sprintf("--ovnnb-db=%s", nbEndpoint),
fmt.Sprintf("--ovnsb-db=%s", sbEndpoint),
}
Expand Down
5 changes: 4 additions & 1 deletion tests/functional/ovnnorthd_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ var _ = Describe("OVNNorthd controller", func() {

When("OVNDBCluster instances are available", func() {
It("should create a Deployment with the ovn connection CLI args set based on the OVNDBCluster", func() {
OVNNorthd := ovn.GetOVNNorthd(ovnNorthdName)
dbs := CreateOVNDBClusters(namespace, map[string][]string{}, 1)
DeferCleanup(DeleteOVNDBClusters, dbs)

Expand All @@ -78,7 +79,9 @@ var _ = Describe("OVNNorthd controller", func() {

depl := th.GetDeployment(deplName)
Expect(depl.Spec.Template.Spec.Containers[0].Args).To(Equal([]string{
"-vfile:off", "-vconsole:info",
"-vfile:off",
"-vconsole:info",
fmt.Sprintf("--n-threads=%d", *OVNNorthd.Spec.NThreads),
"--ovnnb-db=tcp:ovsdbserver-nb-0." + namespace + ".svc.cluster.local:6641",
"--ovnsb-db=tcp:ovsdbserver-sb-0." + namespace + ".svc.cluster.local:6642",
}))
Expand Down

0 comments on commit cfd21c1

Please sign in to comment.