Skip to content

Commit 8669fe1

Browse files
committed
add transit_ips to NIC create params
1 parent 6fb91c6 commit 8669fe1

File tree

8 files changed

+30
-2
lines changed

8 files changed

+30
-2
lines changed

nexus/src/app/sagas/instance_create.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ async fn create_default_primary_network_interface(
599599
vpc_name: default_name.clone(),
600600
subnet_name: default_name.clone(),
601601
ip: None, // Request an IP address allocation
602+
transit_ips: vec![],
602603
};
603604

604605
// Lookup authz objects, used in the call to actually create the NIC.

nexus/tests/integration_tests/endpoints.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ pub static DEMO_INSTANCE_NIC_CREATE: Lazy<
533533
vpc_name: DEMO_VPC_NAME.clone(),
534534
subnet_name: DEMO_VPC_SUBNET_NAME.clone(),
535535
ip: None,
536+
transit_ips: vec![],
536537
});
537538
pub static DEMO_INSTANCE_NIC_PUT: Lazy<params::InstanceNetworkInterfaceUpdate> =
538539
Lazy::new(|| params::InstanceNetworkInterfaceUpdate {

nexus/tests/integration_tests/instances.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,6 +2178,7 @@ async fn test_instance_create_saga_removes_instance_database_record(
21782178
vpc_name: default_name.clone(),
21792179
subnet_name: default_name.clone(),
21802180
ip: Some(requested_address),
2181+
transit_ips: vec![],
21812182
};
21822183
let interface_params =
21832184
params::InstanceNetworkInterfaceAttachment::Create(vec![
@@ -2257,6 +2258,7 @@ async fn test_instance_create_saga_removes_instance_database_record(
22572258
vpc_name: default_name.clone(),
22582259
subnet_name: default_name.clone(),
22592260
ip: Some(requested_address),
2261+
transit_ips: vec![],
22602262
};
22612263
let interface_params =
22622264
params::InstanceNetworkInterfaceAttachment::Create(vec![
@@ -2299,6 +2301,7 @@ async fn test_instance_with_single_explicit_ip_address(
22992301
vpc_name: default_name.clone(),
23002302
subnet_name: default_name.clone(),
23012303
ip: Some(requested_address),
2304+
transit_ips: vec![],
23022305
};
23032306
let interface_params =
23042307
params::InstanceNetworkInterfaceAttachment::Create(vec![
@@ -2407,6 +2410,7 @@ async fn test_instance_with_new_custom_network_interfaces(
24072410
vpc_name: default_name.clone(),
24082411
subnet_name: default_name.clone(),
24092412
ip: None,
2413+
transit_ips: vec![],
24102414
};
24112415
let if1_params = params::InstanceNetworkInterfaceCreate {
24122416
identity: IdentityMetadataCreateParams {
@@ -2416,6 +2420,7 @@ async fn test_instance_with_new_custom_network_interfaces(
24162420
vpc_name: default_name.clone(),
24172421
subnet_name: non_default_subnet_name.clone(),
24182422
ip: None,
2423+
transit_ips: vec![],
24192424
};
24202425
let interface_params =
24212426
params::InstanceNetworkInterfaceAttachment::Create(vec![
@@ -2594,6 +2599,7 @@ async fn test_instance_create_delete_network_interface(
25942599
vpc_name: "default".parse().unwrap(),
25952600
subnet_name: "default".parse().unwrap(),
25962601
ip: Some("172.30.0.10".parse().unwrap()),
2602+
transit_ips: vec![],
25972603
},
25982604
params::InstanceNetworkInterfaceCreate {
25992605
identity: IdentityMetadataCreateParams {
@@ -2603,6 +2609,7 @@ async fn test_instance_create_delete_network_interface(
26032609
vpc_name: "default".parse().unwrap(),
26042610
subnet_name: secondary_subnet.identity.name.clone(),
26052611
ip: Some("172.31.0.11".parse().unwrap()),
2612+
transit_ips: vec![],
26062613
},
26072614
];
26082615

@@ -2829,6 +2836,7 @@ async fn test_instance_update_network_interfaces(
28292836
vpc_name: "default".parse().unwrap(),
28302837
subnet_name: "default".parse().unwrap(),
28312838
ip: Some("172.30.0.10".parse().unwrap()),
2839+
transit_ips: vec![],
28322840
},
28332841
params::InstanceNetworkInterfaceCreate {
28342842
identity: IdentityMetadataCreateParams {
@@ -2838,6 +2846,7 @@ async fn test_instance_update_network_interfaces(
28382846
vpc_name: "default".parse().unwrap(),
28392847
subnet_name: secondary_subnet.identity.name.clone(),
28402848
ip: Some("172.31.0.11".parse().unwrap()),
2849+
transit_ips: vec![],
28412850
},
28422851
];
28432852

@@ -3171,6 +3180,7 @@ async fn test_instance_with_multiple_nics_unwinds_completely(
31713180
vpc_name: default_name.clone(),
31723181
subnet_name: default_name.clone(),
31733182
ip: Some("172.30.0.6".parse().unwrap()),
3183+
transit_ips: vec![],
31743184
};
31753185
let if1_params = params::InstanceNetworkInterfaceCreate {
31763186
identity: IdentityMetadataCreateParams {
@@ -3180,6 +3190,7 @@ async fn test_instance_with_multiple_nics_unwinds_completely(
31803190
vpc_name: default_name.clone(),
31813191
subnet_name: default_name.clone(),
31823192
ip: Some("172.30.0.7".parse().unwrap()),
3193+
transit_ips: vec![],
31833194
};
31843195
let interface_params =
31853196
params::InstanceNetworkInterfaceAttachment::Create(vec![

nexus/tests/integration_tests/internet_gateway.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ async fn test_setup(c: &ClientTestContext) {
372372
ip: None,
373373
subnet_name: "default".parse().unwrap(),
374374
vpc_name: VPC_NAME.parse().unwrap(),
375+
transit_ips: vec![],
375376
},
376377
]);
377378
let _inst = create_instance_with(

nexus/tests/integration_tests/subnet_allocation.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ async fn create_instance_expect_failure(
4747
vpc_name: "default".parse().unwrap(),
4848
subnet_name: subnet_name.parse().unwrap(),
4949
ip: None,
50+
transit_ips: vec![],
5051
},
5152
]);
5253
let new_instance = params::InstanceCreate {
@@ -132,6 +133,7 @@ async fn test_subnet_allocation(cptestctx: &ControlPlaneTestContext) {
132133
vpc_name: "default".parse().unwrap(),
133134
subnet_name: "small".parse().unwrap(),
134135
ip: None,
136+
transit_ips: vec![],
135137
},
136138
]);
137139

nexus/tests/integration_tests/vpc_routers.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,7 @@ async fn test_vpc_routers_custom_delivered_to_instance(
507507
vpc_name: vpc.name().clone(),
508508
subnet_name: subnet_name.parse().unwrap(),
509509
ip: Some(format!("192.168.{i}.10").parse().unwrap()),
510+
transit_ips: vec![],
510511
},
511512
]),
512513
vec![],

nexus/types/src/external_api/params.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,9 @@ pub struct InstanceNetworkInterfaceCreate {
825825
pub subnet_name: Name,
826826
/// The IP address for the interface. One will be auto-assigned if not provided.
827827
pub ip: Option<IpAddr>,
828+
/// A set of additional networks that this interface may send and
829+
/// receive traffic on
830+
pub transit_ips: Vec<IpNet>,
828831
}
829832

830833
/// Parameters for updating an `InstanceNetworkInterface`
@@ -853,7 +856,7 @@ pub struct InstanceNetworkInterfaceUpdate {
853856
pub primary: bool,
854857

855858
/// A set of additional networks that this interface may send and
856-
/// receive traffic on.
859+
/// receive traffic on
857860
#[serde(default)]
858861
pub transit_ips: Vec<IpNet>,
859862
}

openapi/nexus.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16281,6 +16281,13 @@
1628116281
}
1628216282
]
1628316283
},
16284+
"transit_ips": {
16285+
"description": "A set of additional networks that this interface may send and receive traffic on",
16286+
"type": "array",
16287+
"items": {
16288+
"$ref": "#/components/schemas/IpNet"
16289+
}
16290+
},
1628416291
"vpc_name": {
1628516292
"description": "The VPC in which to create the interface.",
1628616293
"allOf": [
@@ -16294,6 +16301,7 @@
1629416301
"description",
1629516302
"name",
1629616303
"subnet_name",
16304+
"transit_ips",
1629716305
"vpc_name"
1629816306
]
1629916307
},
@@ -16340,7 +16348,7 @@
1634016348
"type": "boolean"
1634116349
},
1634216350
"transit_ips": {
16343-
"description": "A set of additional networks that this interface may send and receive traffic on.",
16351+
"description": "A set of additional networks that this interface may send and receive traffic on",
1634416352
"default": [],
1634516353
"type": "array",
1634616354
"items": {

0 commit comments

Comments
 (0)