-
Notifications
You must be signed in to change notification settings - Fork 40
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
API for no/default/custom NICs on instance create #1003
Comments
Not sure where we came down on no interfaces. Seemed like @rmustacc tried hard to come up with a potential use case but couldn't quite bring himself to say it was important. For me that's a Won't Do unless we get it for free, which could happen depending on how the API is designed.
Could you say more about what this looks like? I like having the clean type NetworkInterfaceCreate = {
description: string
ip?: string | null
name: Name
subnetName: Name
vpcName: Name
}
type InstanceNetworkInterfaceAttachment =
| { type: 'Create', params: NetworkInterfaceCreate[] }
| { type: 'Default' }
| { type: 'None' }
type InstanceCreate = {
...
networkInterfaces?: InstanceNetworkInterfaceAttachment | null
...
} it would look more like type InstanceNetworkInterfaceAttachment =
| { type: 'Custom'; params: NetworkInterfaceCreate }
| { type: 'Default' }
type InstanceCreate = {
...
networkInterfaces?: InstanceNetworkInterfaceAttachment[]
...
} Is that something like what you had in mind? That covers all the cases neatly:
I'm less clear on whether we should allow |
@david-crespo I thought I had at least a couple use cases that made more sense for no nics. Whether it's worth it, harder to say, but that was a lot more plausible to me than the no disks case. I would like to have it if possible, but there's a lot of things I'd like and not sure where the energy makes the most sense. That said, the default stuff still bothers me a little bit because of the rest of the API support here or really more importantly a lack there of. When the idea of the "default" project, VPC, and VPC Subnet was introduced in RFD 21 it was to aid getting started and making that as painless as possible. However, it's also just as likely that customers will end up creating a blank project/vpc without the default VPC set up allowing them to create their own. At which point the choose the thing named "default" doesn't really make sense (to me). I don't think we want to define this in terms of a thing with a specific name, but rather it feels like a top-level project thing of if you don't select an image, VPC/VPC Subnet, instance type information, etc. this is what you get. Throwing out a project as it seems kind of a higher-level thing that you want all in one place rather than a part of the VPC itself. I like the use of a type here a bit, that does seem better. Presumably it's illegal to pass default twice? Is there any value in trying to make this look similar for disks? |
Sorry, I meant you tried and succeeded at coming up with some use cases. Correct about two default NICs, I figured The interface for disks at instance create is already pretty similar to my suggestion. Maybe that's where I got the idea. The type InstanceDiskAttachment =
| {
description: string
diskSource: DiskSource
name: Name
size: ByteCount
type: 'create'
}
| {
name: Name
type: 'attach'
} (We should standardize on casing for GCP does something interesting with the default interface that fits with what you're saying about how it relates to the default VPC. Their default interface explicitly refers to the default VPC, and in order to add any other NICs you have to add another VPC. In our system, if you delete the default VPC and add another one instead (or worse, two), then |
Yeah, in our current system as defined, I think that's right. And the 400s in those different cases are all kind of unfortunate. I think this gets to the heart of my issue with the scheme. We're really conflating two different things:
Ideally our setup time default would set something on them that indicates that they're the thing for the provision time default. This would allow folks to set up their own defaults in a project that make sense. Right now the relationship between the provision time default is just by finding something called "Default", but in some ways, it feels worse to have provision time defaults that you can't set. So that's why I think we want to have something that nominates this, e.g. a /project/defaults endpoint that you can get/set or something. I think centralizing at the project level makes more sense, dunno. Thoughts? |
@rmustacc I agree that having a VPC and VPC Subnet made special just by their name is not great. I think the idea was always to eventually add the database table(s) and CRUD to manipulate those defaults. That's a good bit of work, though. Nothing hard, just takes time. It also brings up a few questions that I've been wrestling with. I'll try to spell those out here, with my attempts at answers for them. What if a user opts to have no default VPC for a Project?We should allow this. The implicit behavior may be undesirable in some cases, and this would require that the VPC and VPC Subnet be specified by name for any NIC that's created, either at instance provision or at a later time. Are users allowed to delete the default VPC?We should allow this, assuming the VPC could normally be deleted (e.g., that it's empty). In that case, the likely result would be to "unset" the default, so that there is no default for the Project. How do we specify the default at Project-creation time?RFD 21 talks about this a bit, but the idea is to have a
How do we make the most common NIC option easy?The most common choice users will likely make when creating a NIC for an instance is to have a single primary interface, with an automatically assigned IP address in the default VPC and VPC Subnet. If possible, the request that achieves this should have basically nothing in it referring to networking. It should still be possible to create an instance with multiple interfaces, and with none at all, though these could be more awkward to specify in the request. One way to achieve this would look like this, in Rust: pub enum InstanceNetworkInterfaceAttachment {
DefaultPrimaryInterface,
CustomInterfaces(Vec<NetworkInterfaceCreate>),
}
pub struct NetworkInterfaceCreate {
pub name: String,
pub description: Option<String>,
pub vpc_name: Option<String>,
pub subnet_name: Option<String>,
pub ip: Option<std::net::IpAddr>,
} As David pointed out, the second enum variant encompasses both zero and multiple NICs. If the user supplies @rmustacc @david-crespo Let me know what y'all think. |
Moved from #960 (comment)
The text was updated successfully, but these errors were encountered: