diff --git a/end-to-end-tests/src/instance_launch.rs b/end-to-end-tests/src/instance_launch.rs index 306d697f5d4..648d49e4d6f 100644 --- a/end-to-end-tests/src/instance_launch.rs +++ b/end-to-end-tests/src/instance_launch.rs @@ -95,7 +95,7 @@ async fn instance_launch() -> Result<()> { .context("no external IPs")? .clone(); - let ExternalIp::Ephemeral { ip: ip_addr } = ip_addr else { + let ExternalIp::Ephemeral { ip: ip_addr, .. } = ip_addr else { anyhow::bail!("IP bound to instance was not ephemeral as required.") }; eprintln!("instance external IP: {}", ip_addr); diff --git a/nexus/db-model/src/external_ip.rs b/nexus/db-model/src/external_ip.rs index fce8d21a3c3..7e4ef9f7f5b 100644 --- a/nexus/db-model/src/external_ip.rs +++ b/nexus/db-model/src/external_ip.rs @@ -529,9 +529,10 @@ impl TryFrom for views::ExternalIp { } match ip.kind { IpKind::Floating => Ok(views::ExternalIp::Floating(ip.try_into()?)), - IpKind::Ephemeral => { - Ok(views::ExternalIp::Ephemeral { ip: ip.ip.ip() }) - } + IpKind::Ephemeral => Ok(views::ExternalIp::Ephemeral { + ip: ip.ip.ip(), + ip_pool_id: ip.ip_pool_id, + }), IpKind::SNat => Err(Error::internal_error( "SNAT IP addresses should not be exposed in the API", )), diff --git a/nexus/types/src/external_api/views.rs b/nexus/types/src/external_api/views.rs index 88c1d177ddb..16bb37b24af 100644 --- a/nexus/types/src/external_api/views.rs +++ b/nexus/types/src/external_api/views.rs @@ -501,14 +501,14 @@ pub struct IpPoolRange { #[derive(Debug, Clone, Deserialize, PartialEq, Serialize, JsonSchema)] #[serde(tag = "kind", rename_all = "snake_case")] pub enum ExternalIp { - Ephemeral { ip: IpAddr }, + Ephemeral { ip: IpAddr, ip_pool_id: Uuid }, Floating(FloatingIp), } impl ExternalIp { pub fn ip(&self) -> IpAddr { match self { - Self::Ephemeral { ip } => *ip, + Self::Ephemeral { ip, .. } => *ip, Self::Floating(float) => float.ip, } } diff --git a/openapi/nexus.json b/openapi/nexus.json index 216744207d5..0edec31234b 100644 --- a/openapi/nexus.json +++ b/openapi/nexus.json @@ -17507,6 +17507,10 @@ "type": "string", "format": "ip" }, + "ip_pool_id": { + "type": "string", + "format": "uuid" + }, "kind": { "type": "string", "enum": [ @@ -17516,6 +17520,7 @@ }, "required": [ "ip", + "ip_pool_id", "kind" ] },