Skip to content
Closed
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
11 changes: 7 additions & 4 deletions src/proxy/outbound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,11 @@ impl OutboundConnection {
.destination_service
.as_ref()
.expect("Workloads with network gateways must be service addressed.");
let hbone_target_destination =
Some(HboneAddress::SvcHostname(svc.hostname.clone(), us.port));
// Use the service port
let hbone_target_destination = Some(HboneAddress::SvcHostname(
svc.hostname.clone(),
target.port(),
));

return Ok(Request {
protocol: OutboundProtocol::DOUBLEHBONE,
Expand Down Expand Up @@ -867,7 +870,7 @@ mod tests {
],
Some(ExpectedRequest {
protocol: OutboundProtocol::DOUBLEHBONE,
hbone_destination: "example.com:8080",
hbone_destination: "example.com:80",
destination: "10.22.1.1:15009",
}),
)
Expand Down Expand Up @@ -944,7 +947,7 @@ mod tests {
],
Some(ExpectedRequest {
protocol: OutboundProtocol::DOUBLEHBONE,
hbone_destination: "example.com:8080",
hbone_destination: "example.com:80",
destination: "127.0.0.5:15008",
}),
)
Expand Down
Empty file added tests/keylog
Empty file.
15 changes: 8 additions & 7 deletions tests/namespaced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ mod namespaced {
Ok(())
}

/// Test having an IP address in the network gateway
#[tokio::test]
async fn double_hbone1() -> anyhow::Result<()> {
async fn double_hbone_ip_addressed_network_gateway() -> anyhow::Result<()> {
let mut manager = setup_netns_test!(Shared);

let zt = manager.deploy_ztunnel(DEFAULT_NODE).await?;
Expand All @@ -214,7 +215,7 @@ mod namespaced {
address: TEST_VIP.parse::<IpAddr>()?,
}])
.subject_alt_names(vec!["spiffe://cluster.local/ns/default/sa/echo".into()])
.ports(HashMap::from([(8080, 8080)]))
.ports(HashMap::from([(80, 8080)]))
.register()
.await?;

Expand All @@ -231,7 +232,7 @@ mod namespaced {
// represents workloads in the remote cluster.
// Its a little weird because we do give it a namespaced/ip,
// but that's because of how the tests infra works.
let _local_remote_workload = manager
let _split_horizon_workload = manager
.workload_builder("local-remote-workload", "remote-node")
.hbone()
.network("remote".into())
Expand All @@ -247,7 +248,7 @@ mod namespaced {
namespace: "default".into(),
service_account: "actual-ew-gtw".into(),
})
.service("default/remote.default.svc.cluster.local", 8080, 8080)
.service("default/remote.default.svc.cluster.local", 80, 8080)
.register()
.await?;
let echo = manager
Expand Down Expand Up @@ -279,7 +280,7 @@ mod namespaced {
run_tcp_to_hbone_client(
client.clone(),
manager.resolver(),
&format!("{TEST_VIP}:8080"),
&format!("{TEST_VIP}:80"),
)?;

let metrics = [
Expand All @@ -297,7 +298,7 @@ mod namespaced {
("scope", "access"),
("src.workload", "client"),
("dst.workload", "actual-ew-gtw"),
("dst.hbone_addr", "remote.default.svc.cluster.local:8080"),
("dst.hbone_addr", "remote.default.svc.cluster.local:80"),
("dst.addr", &dst_addr),
("bytes_sent", &sent),
("bytes_recv", &recv),
Expand All @@ -317,7 +318,7 @@ mod namespaced {
}

#[tokio::test]
async fn double_hbone2() -> anyhow::Result<()> {
async fn double_hbone_hostname_addressed_network_gateway() -> anyhow::Result<()> {
let mut manager = setup_netns_test!(Shared);

let _zt = manager.deploy_ztunnel(DEFAULT_NODE).await?;
Expand Down