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

Update Floating IP field name from address to ip #5144

Merged
merged 2 commits into from
Feb 26, 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
2 changes: 1 addition & 1 deletion nexus/db-queries/src/db/datastore/external_ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ impl DataStore {

let pool_id = pool.id();

let data = if let Some(ip) = params.address {
let data = if let Some(ip) = params.ip {
IncompleteExternalIp::for_floating_explicit(
ip_id,
&Name(params.identity.name),
Expand Down
4 changes: 2 additions & 2 deletions nexus/test-utils/src/resource_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ pub async fn create_floating_ip(
client: &ClientTestContext,
fip_name: &str,
project: &str,
address: Option<IpAddr>,
ip: Option<IpAddr>,
parent_pool_name: Option<&str>,
) -> FloatingIp {
object_create(
Expand All @@ -278,7 +278,7 @@ pub async fn create_floating_ip(
name: fip_name.parse().unwrap(),
description: String::from("a floating ip"),
},
address,
ip,
pool: parent_pool_name.map(|v| NameOrId::Name(v.parse().unwrap())),
},
)
Expand Down
2 changes: 1 addition & 1 deletion nexus/tests/integration_tests/endpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ pub static DEMO_FLOAT_IP_CREATE: Lazy<params::FloatingIpCreate> =
name: DEMO_FLOAT_IP_NAME.clone(),
description: String::from("a new IP pool"),
},
address: Some(std::net::Ipv4Addr::new(10, 0, 0, 141).into()),
ip: Some(std::net::Ipv4Addr::new(10, 0, 0, 141).into()),
pool: None,
});

Expand Down
8 changes: 4 additions & 4 deletions nexus/tests/integration_tests/external_ips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ async fn test_floating_ip_create(cptestctx: &ControlPlaneTestContext) {
name: fip_name.parse().unwrap(),
description: String::from("a floating ip"),
},
address: None,
ip: None,
pool: Some(NameOrId::Name("other-pool".parse().unwrap())),
};
let url = format!("/v1/floating-ips?project={}", project.identity.name);
Expand Down Expand Up @@ -259,7 +259,7 @@ async fn test_floating_ip_create_fails_in_other_silo_pool(
name: fip_name.parse().unwrap(),
description: String::from("a floating ip"),
},
address: None,
ip: None,
pool: Some(NameOrId::Name("external-silo-pool".parse().unwrap())),
};

Expand Down Expand Up @@ -316,7 +316,7 @@ async fn test_floating_ip_create_ip_in_use(
name: FIP_NAMES[1].parse().unwrap(),
description: "another fip".into(),
},
address: Some(contested_ip),
ip: Some(contested_ip),
pool: None,
}))
.expect_status(Some(StatusCode::BAD_REQUEST)),
Expand Down Expand Up @@ -364,7 +364,7 @@ async fn test_floating_ip_create_name_in_use(
name: contested_name.parse().unwrap(),
description: "another fip".into(),
},
address: None,
ip: None,
pool: None,
}))
.expect_status(Some(StatusCode::BAD_REQUEST)),
Expand Down
2 changes: 1 addition & 1 deletion nexus/types/src/external_api/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ pub struct FloatingIpCreate {
/// An IP address to reserve for use as a floating IP. This field is
/// optional: when not set, an address will be automatically chosen from
/// `pool`. If set, then the IP must be available in the resolved `pool`.
pub address: Option<IpAddr>,
pub ip: Option<IpAddr>,

/// The parent IP pool that a floating IP is pulled from. If unset, the
/// default pool is selected.
Expand Down
8 changes: 4 additions & 4 deletions openapi/nexus.json
Original file line number Diff line number Diff line change
Expand Up @@ -11864,15 +11864,15 @@
"description": "Parameters for creating a new floating IP address for instances.",
"type": "object",
"properties": {
"address": {
"description": {
"type": "string"
},
"ip": {
"nullable": true,
"description": "An IP address to reserve for use as a floating IP. This field is optional: when not set, an address will be automatically chosen from `pool`. If set, then the IP must be available in the resolved `pool`.",
"type": "string",
"format": "ip"
},
"description": {
"type": "string"
},
"name": {
"$ref": "#/components/schemas/Name"
},
Expand Down
Loading