diff --git a/policy-test/Cargo.toml b/policy-test/Cargo.toml index 50afeff3a..088e10f64 100644 --- a/policy-test/Cargo.toml +++ b/policy-test/Cargo.toml @@ -5,6 +5,10 @@ edition = "2021" license = "Apache-2.0" publish = false +[features] +default = ["gateway-api-experimental"] +gateway-api-experimental = [] + [dependencies] anyhow = "1" bytes = "1" diff --git a/policy-test/src/lib.rs b/policy-test/src/lib.rs index 7b0291eea..b67b33fe5 100644 --- a/policy-test/src/lib.rs +++ b/policy-test/src/lib.rs @@ -293,6 +293,7 @@ pub async fn await_grpc_route_status( route_status } +#[cfg(feature = "gateway-api-experimental")] // Waits until an TlsRoute with the given namespace and name has a status set // on it, then returns the generic route status representation. pub async fn await_tls_route_status( @@ -316,6 +317,7 @@ pub async fn await_tls_route_status( route_status } +#[cfg(feature = "gateway-api-experimental")] // Waits until an TcpRoute with the given namespace and name has a status set // on it, then returns the generic route status representation. pub async fn await_tcp_route_status( diff --git a/policy-test/src/outbound_api.rs b/policy-test/src/outbound_api.rs index 29fec055e..e4db46bb9 100644 --- a/policy-test/src/outbound_api.rs +++ b/policy-test/src/outbound_api.rs @@ -118,6 +118,7 @@ pub fn grpc_routes(config: &grpc::outbound::OutboundPolicy) -> &[grpc::outbound: } } +#[cfg(feature = "gateway-api-experimental")] #[track_caller] pub fn tls_routes(config: &grpc::outbound::OutboundPolicy) -> &[grpc::outbound::TlsRoute] { let kind = config @@ -137,6 +138,7 @@ pub fn tls_routes(config: &grpc::outbound::OutboundPolicy) -> &[grpc::outbound:: } } +#[cfg(feature = "gateway-api-experimental")] #[track_caller] pub fn tcp_routes(config: &grpc::outbound::OutboundPolicy) -> &[grpc::outbound::OpaqueRoute] { let kind = config diff --git a/policy-test/src/test_route.rs b/policy-test/src/test_route.rs index 1747cf9e2..a3d30a12f 100644 --- a/policy-test/src/test_route.rs +++ b/policy-test/src/test_route.rs @@ -4,7 +4,9 @@ use linkerd_policy_controller_k8s_api::{ self as k8s, gateway, policy, Condition, Resource as _, ResourceExt, }; -use crate::outbound_api::{detect_http_routes, grpc_routes, tcp_routes, tls_routes}; +use crate::outbound_api::{detect_http_routes, grpc_routes}; +#[cfg(feature = "gateway-api-experimental")] +use crate::outbound_api::{tcp_routes, tls_routes}; pub trait TestRoute: kube::Resource @@ -482,6 +484,7 @@ impl TestRoute for gateway::GRPCRoute { } } +#[cfg(feature = "gateway-api-experimental")] impl TestRoute for gateway::TLSRoute { type Route = outbound::TlsRoute; type Backend = outbound::tls_route::RouteBackend; @@ -626,6 +629,7 @@ impl TestRoute for gateway::TLSRoute { } } +#[cfg(feature = "gateway-api-experimental")] impl TestRoute for gateway::TCPRoute { type Route = outbound::OpaqueRoute; type Backend = outbound::opaque_route::RouteBackend; diff --git a/policy-test/tests/admit_tcp_route.rs b/policy-test/tests/admit_tcp_route.rs index bc9d5558a..69cd73ef7 100644 --- a/policy-test/tests/admit_tcp_route.rs +++ b/policy-test/tests/admit_tcp_route.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "gateway-api-experimental")] + use linkerd_policy_controller_k8s_api::{self as api, gateway}; use linkerd_policy_test::admission; diff --git a/policy-test/tests/admit_tls_route.rs b/policy-test/tests/admit_tls_route.rs index 3f3d063b9..235b4c407 100644 --- a/policy-test/tests/admit_tls_route.rs +++ b/policy-test/tests/admit_tls_route.rs @@ -1,3 +1,5 @@ +#![cfg(feature = "gateway-api-experimental")] + use linkerd_policy_controller_k8s_api::{self as api, gateway}; use linkerd_policy_test::admission;