Skip to content

want API crate #107

Closed
Closed

Description

@rzezeski

It's time to finally get some better separation between opte-core and its API. We want to have a clearly defined set of types and methods for interacting with opte-core without depending on opte-core itself. This is best achieved by giving the API its own crate which can be referenced by clients and opte-core itself. This gives us a firewall (in the automotive sense, not the network sense) between the private, unstable interfaces in opte-core and the public, stable interfaces in the API. It gives opte-core the freedom to make implementation decisions mostly independent of the consumer, so long as it continues to hold up the semantics of the API exposed.

Having a seprate crate also has advantages from a Rust building perspective. It allows a consumer to still be built/tested on a non-illumos platform without literring opte-core with a bunch of conditional compilation. We still need features/conditional compilation in the API crate, but the problem becomes simpler because we are focused only on shared types (and the illumos userspace side of the communication can be hidden via conditional compilation).

I can see two phases to splitting out the API from opte-core.

  1. Split out only the commands required by sled-agent. This is a subset of the commands and has a much smaller blast radius than moving them all at once. These commands include CreateXde, DeleteXde, SetVirt2Phys, and AddRouterEntryIpv4. These commands aren't actually opte-core commands, but rather specific to the Oxide VPC implementation, which leads me to the 2nd phase.

  2. Split out the rest of the commands, which includes the "generic" commands (the real API to opte-core). Something that is probably not obvious to others is that the commands used by Omicron are not actually opte-core commands at all. They use opte-core commands under the hood, but they exist at a higher semantic level that only exists in the Oxide VPC world. The real opte-core commands are actions like creating Ports, adding Layers, and adding/removing Rules -- they are the means by which policy is created. However, to keep things simple for now, these Oxide-specific vs. generic commands have been conflated for now. That will probabyl continue for a little while longer until this spearation of concerns is teased out of a bit more. In the meantime, this phase 2 is a good step towards a more precise usage of OPTE. That's a lot of words, and probably feels vague: my main point is that phase 2 is a bit more involved because it will mean defining the generic API commands which up to this point haven't really existed on their own.

Activity

  1. self-assigned this
    on Apr 7, 2022
  2. rzezeski commented on Apr 9, 2022

    @rzezeski
    ContributorAuthor

    Superseded by #108.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions