Skip to content

Commit e4b4420

Browse files
authored
Add IP pool ID to ephemeral IP view (#8564)
Fixes #6825
1 parent ae3ca81 commit e4b4420

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

end-to-end-tests/src/instance_launch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ async fn instance_launch() -> Result<()> {
9595
.context("no external IPs")?
9696
.clone();
9797

98-
let ExternalIp::Ephemeral { ip: ip_addr } = ip_addr else {
98+
let ExternalIp::Ephemeral { ip: ip_addr, .. } = ip_addr else {
9999
anyhow::bail!("IP bound to instance was not ephemeral as required.")
100100
};
101101
eprintln!("instance external IP: {}", ip_addr);

nexus/db-model/src/external_ip.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,10 @@ impl TryFrom<ExternalIp> for views::ExternalIp {
529529
}
530530
match ip.kind {
531531
IpKind::Floating => Ok(views::ExternalIp::Floating(ip.try_into()?)),
532-
IpKind::Ephemeral => {
533-
Ok(views::ExternalIp::Ephemeral { ip: ip.ip.ip() })
534-
}
532+
IpKind::Ephemeral => Ok(views::ExternalIp::Ephemeral {
533+
ip: ip.ip.ip(),
534+
ip_pool_id: ip.ip_pool_id,
535+
}),
535536
IpKind::SNat => Err(Error::internal_error(
536537
"SNAT IP addresses should not be exposed in the API",
537538
)),

nexus/types/src/external_api/views.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,14 +502,14 @@ pub struct IpPoolRange {
502502
#[derive(Debug, Clone, Deserialize, PartialEq, Serialize, JsonSchema)]
503503
#[serde(tag = "kind", rename_all = "snake_case")]
504504
pub enum ExternalIp {
505-
Ephemeral { ip: IpAddr },
505+
Ephemeral { ip: IpAddr, ip_pool_id: Uuid },
506506
Floating(FloatingIp),
507507
}
508508

509509
impl ExternalIp {
510510
pub fn ip(&self) -> IpAddr {
511511
match self {
512-
Self::Ephemeral { ip } => *ip,
512+
Self::Ephemeral { ip, .. } => *ip,
513513
Self::Floating(float) => float.ip,
514514
}
515515
}

openapi/nexus.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17580,6 +17580,10 @@
1758017580
"type": "string",
1758117581
"format": "ip"
1758217582
},
17583+
"ip_pool_id": {
17584+
"type": "string",
17585+
"format": "uuid"
17586+
},
1758317587
"kind": {
1758417588
"type": "string",
1758517589
"enum": [
@@ -17589,6 +17593,7 @@
1758917593
},
1759017594
"required": [
1759117595
"ip",
17596+
"ip_pool_id",
1759217597
"kind"
1759317598
]
1759417599
},

0 commit comments

Comments
 (0)