Skip to content
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
888 changes: 888 additions & 0 deletions charts/linkerd-crds/templates/policy/httproute.yaml

Large diffs are not rendered by default.

888 changes: 888 additions & 0 deletions cli/cmd/testdata/install_crds.golden

Large diffs are not rendered by default.

888 changes: 888 additions & 0 deletions cli/cmd/testdata/install_helm_crds_output.golden

Large diffs are not rendered by default.

888 changes: 888 additions & 0 deletions cli/cmd/testdata/install_helm_crds_output_ha.golden

Large diffs are not rendered by default.

38 changes: 37 additions & 1 deletion policy-controller/k8s/api/src/policy/httproute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub use k8s_gateway_api::{
HttpRequestHeaderFilter, HttpRequestRedirectFilter, HttpRouteMatch, LocalObjectReference,
ParentReference, RouteStatus,
};
use std::time::Duration;

/// HTTPRoute provides a way to route HTTP requests. This includes the
/// capability to match requests by hostname, path, header, or query param.
Expand All @@ -20,7 +21,7 @@ pub use k8s_gateway_api::{
)]
#[kube(
group = "policy.linkerd.io",
version = "v1beta2",
version = "v1beta3",
kind = "HTTPRoute",
struct = "HttpRoute",
status = "HttpRouteStatus",
Expand Down Expand Up @@ -155,6 +156,11 @@ pub struct HttpRouteRule {
///
/// Support for weight: Core
pub backend_refs: Option<Vec<HttpBackendRef>>,

/// Timeouts defines the timeouts that can be configured for an HTTP request.
///
/// Support: Core
pub timeouts: Option<HttpRouteTimeouts>,
}

/// HTTPRouteFilter defines processing steps that must be completed during the
Expand Down Expand Up @@ -195,6 +201,36 @@ pub struct HttpRouteStatus {
pub inner: RouteStatus,
}

/// HTTPRouteTimeouts defines timeouts that can be configured for an HTTPRoute.
/// Timeout values are formatted like 1h/1m/1s/1ms as parsed by Golang time.ParseDuration
/// and MUST BE >= 1ms.
#[derive(
Clone, Debug, PartialEq, Eq, serde::Deserialize, serde::Serialize, schemars::JsonSchema,
)]
pub struct HttpRouteTimeouts {
/// Request specifies a timeout for the Gateway to send a response to a client HTTP request.
/// Whether the gateway starts the timeout before or after the entire client request stream
/// has been received, is implementation dependent.
///
/// For example, setting the `rules.timeouts.request` field to the value `10s` in an
/// `HTTPRoute` will cause a timeout if a client request is taking longer than 10 seconds
/// to complete.
///
/// Request timeouts are disabled by default.
///
/// Support: Core
pub request: Option<Duration>,

/// BackendRequest specifies a timeout for an individual request from the gateway
/// to a backend service. Typically used in conjuction with retry configuration,
/// if supported by an implementation.
///
/// The value of BackendRequest defaults to and must be <= the value of Request timeout.
///
/// Support: Extended
pub backend_request: Option<Duration>,
}

pub fn parent_ref_targets_kind<T>(parent_ref: &ParentReference) -> bool
where
T: kube::Resource,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ fn mk_route(
}]),
filters: None,
backend_refs: None,
timeouts: None,
}]),
},
status: Some(k8s::policy::httproute::HttpRouteStatus {
Expand Down
4 changes: 4 additions & 0 deletions policy-controller/k8s/status/src/http_route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ mod test {
port: None,
},
]),
timeouts: None,
},
policy::httproute::HttpRouteRule {
matches: None,
Expand All @@ -170,11 +171,13 @@ mod test {
port: None,
},
]),
timeouts: None,
},
policy::httproute::HttpRouteRule {
matches: None,
filters: None,
backend_refs: None,
timeouts: None,
},
]),
},
Expand Down Expand Up @@ -222,6 +225,7 @@ mod test {
port: None,
},
]),
timeouts: None,
}]),
},
status: None,
Expand Down
1 change: 1 addition & 0 deletions policy-controller/k8s/status/src/tests/http_routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ fn make_route(
}]),
filters: None,
backend_refs: None,
timeouts: None,
}]),
},
status: None,
Expand Down
3 changes: 3 additions & 0 deletions policy-test/tests/admit_http_route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async fn rejects_relative_path_match() {
}]),
filters: None,
backend_refs: None,
timeouts: None,
}]),
},
status: None,
Expand Down Expand Up @@ -74,6 +75,7 @@ async fn rejects_relative_redirect_path() {
},
}]),
backend_refs: None,
timeouts: None,
}]),
},
status: None,
Expand Down Expand Up @@ -110,5 +112,6 @@ fn rules() -> Vec<HttpRouteRule> {
}]),
filters: None,
backend_refs: None,
timeouts: None,
}]
}
1 change: 1 addition & 0 deletions policy-test/tests/e2e_authorization_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ fn http_route(name: &str, ns: &str, server_name: &str, path: &str) -> k8s::polic
}]),
filters: None,
backend_refs: None,
timeouts: None,
}]),
},
status: None,
Expand Down
1 change: 1 addition & 0 deletions policy-test/tests/e2e_http_routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,6 @@ fn rule(path: String, backend: String) -> k8s::policy::httproute::HttpRouteRule
filters: None,
}]),
filters: None,
timeouts: None,
}
}
2 changes: 2 additions & 0 deletions policy-test/tests/inbound_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ fn mk_admin_route(ns: &str, name: &str) -> k8s::policy::HttpRoute {
}]),
filters: None,
backend_refs: None,
timeouts: None,
}]),
},
status: None,
Expand Down Expand Up @@ -592,6 +593,7 @@ fn mk_admin_route_with_path(ns: &str, name: &str, path: &str) -> k8s::policy::Ht
}]),
filters: None,
backend_refs: None,
timeouts: None,
}]),
},
status: None,
Expand Down
1 change: 1 addition & 0 deletions policy-test/tests/outbound_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ fn mk_http_route(
}]),
filters: None,
backend_refs,
timeouts: None,
}]),
},
status: None,
Expand Down