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

Improvements to OVN interconnect #1142

Merged
merged 7 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmd/incusd/network_integrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,11 +735,13 @@ func networkIntegrationValidate(integrationType string, inUse bool, oldConfig ma

// gendoc:generate(entity=network_integration, group=ovn, key=ovn.transit.pattern)
// Specify a Pongo2 template string that represents the transit switch name.
// This template gets access to the project name (`projectName`), integration name (`integrationName`) and network name (`networkName`).
// This template gets access to the project name (`projectName`),
// integration name (`integrationName`), network name (`networkName`)
// and peer name (`peerName`).
//
// ---
// type: string
// defaultdesc: `ts-incus-{{ integrationName }}-{{ projectName }}-{{ networkname }}`
// defaultdesc: `ts-incus-{{ integrationName }}-{{ projectName }}-{{ networkName }}`
// shortdesc: Template for the transit switch name
"ovn.transit.pattern": validate.IsAny,
}
Expand Down
4 changes: 4 additions & 0 deletions doc/api-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2578,3 +2578,7 @@ The following new configuration options are introduced:
## `oidc_scopes`

This introduces a new `oidc.scopes` server configuration key which can take a comma separate list of OIDC scopes to request from the identity provider.

## `network_integrations_peer_name`

This extends `ovn.transit.pattern` to allow `peerName` as a template variable.
6 changes: 4 additions & 2 deletions doc/config_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1548,11 +1548,13 @@ User keys can be used in search.
```

```{config:option} ovn.transit.pattern network_integration-ovn
:defaultdesc: "`ts-incus-{{ integrationName }}-{{ projectName }}-{{ networkname }}`"
:defaultdesc: "`ts-incus-{{ integrationName }}-{{ projectName }}-{{ networkName }}`"
:shortdesc: "Template for the transit switch name"
:type: "string"
Specify a Pongo2 template string that represents the transit switch name.
This template gets access to the project name (`projectName`), integration name (`integrationName`) and network name (`networkName`).
This template gets access to the project name (`projectName`),
integration name (`integrationName`), network name (`networkName`)
and peer name (`peerName`).

```

Expand Down
4 changes: 2 additions & 2 deletions internal/server/metadata/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -1707,8 +1707,8 @@
},
{
"ovn.transit.pattern": {
"defaultdesc": "`ts-incus-{{ integrationName }}-{{ projectName }}-{{ networkname }}`",
"longdesc": "Specify a Pongo2 template string that represents the transit switch name.\nThis template gets access to the project name (`projectName`), integration name (`integrationName`) and network name (`networkName`).\n",
"defaultdesc": "`ts-incus-{{ integrationName }}-{{ projectName }}-{{ networkName }}`",
"longdesc": "Specify a Pongo2 template string that represents the transit switch name.\nThis template gets access to the project name (`projectName`),\nintegration name (`integrationName`), network name (`networkName`)\nand peer name (`peerName`).\n",
"shortdesc": "Template for the transit switch name",
"type": "string"
}
Expand Down
13 changes: 11 additions & 2 deletions internal/server/network/driver_ovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -5650,6 +5650,7 @@ func (n *ovn) remotePeerCreate(peer api.NetworkPeersPost) error {
"projectName": n.project,
"networkName": n.name,
"integrationName": integration.Name,
"peerName": peer.Name,
})
if err != nil {
return err
Expand All @@ -5668,9 +5669,16 @@ func (n *ovn) remotePeerCreate(peer api.NetworkPeersPost) error {

reverter.Add(func() { _ = n.ovnnb.DeleteChassisGroup(ctx, cgName) })

// Seed the stable random number generator with the transit switch name.
// This should cause a reasonable spread of networks on the available IC gateway chassis.
r, err := localUtil.GetStableRandomGenerator(tsNameRendered)
if err != nil {
return fmt.Errorf("Failed generating stable random chassis group priority: %w", err)
}

// Assign some priorities.
for i, gateway := range gateways {
err = n.ovnnb.SetChassisGroupPriority(ctx, cgName, gateway, 10+i)
for _, gateway := range gateways {
err = n.ovnnb.SetChassisGroupPriority(ctx, cgName, gateway, r.Intn(ovnChassisPriorityMax+1))
if err != nil {
return err
}
Expand Down Expand Up @@ -6115,6 +6123,7 @@ func (n *ovn) remotePeerDelete(peer *api.NetworkPeer) error {
"projectName": n.project,
"networkName": n.name,
"integrationName": integration.Name,
"peerName": peer.Name,
})
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/version/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ var APIExtensions = []string{
"qemu_raw_qmp",
"network_load_balancer_health_check",
"oidc_scopes",
"network_integrations_peer_name",
}

// APIExtensionsCount returns the number of available API extensions.
Expand Down
Loading