Target MeshHTTPRoute
the MeshHTTPRoute
policy route-to-backend-v2
redirects all requests to /v2*
to backend
instances with version: v2
tag. MeshTimeout
backend-v2
configures timeouts only for requests that are going through route-to-backend-v2
route.
Configuration
apiVersion: kuma.io/v1alpha1
kind: MeshHTTPRoute
metadata:
name: route-to-backend-v2
namespace: kuma-demo
labels:
kuma.io/mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: frontend
to:
- targetRef:
kind: MeshService
name: backend_kuma-demo_svc_3001
rules:
- matches:
- path:
type: PathPrefix
value: "/v2"
default:
backendRefs:
- kind: MeshService
name: backend-v2_kuma-demo_svc_3001
apiVersion: kuma.io/v1alpha1
kind: MeshHTTPRoute
metadata:
name: route-to-backend-v2
namespace: kuma-demo
labels:
kuma.io/mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: frontend
to:
- targetRef:
kind: MeshService
name: backend
namespace: kuma-demo
sectionName: http
rules:
- matches:
- path:
type: PathPrefix
value: "/v2"
default:
backendRefs:
- kind: MeshService
name: backend-v2
namespace: kuma-demo
port: 3001
type: MeshHTTPRoute
name: route-to-backend-v2
mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: frontend
to:
- targetRef:
kind: MeshService
name: backend
rules:
- matches:
- path:
type: PathPrefix
value: "/v2"
default:
backendRefs:
- kind: MeshService
name: backend-v2
type: MeshHTTPRoute
name: route-to-backend-v2
mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: frontend
to:
- targetRef:
kind: MeshService
name: backend
sectionName: http
rules:
- matches:
- path:
type: PathPrefix
value: "/v2"
default:
backendRefs:
- kind: MeshService
name: backend-v2
port: 3001
Please adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_http_route" "route_to_backend_v2" {
provider = konnect-beta
type = "MeshHTTPRoute"
name = "route-to-backend-v2"
spec = {
target_ref = {
kind = "Dataplane"
labels = {
app = "frontend"
}
}
to = [
{
target_ref = {
kind = "MeshService"
name = "backend"
section_name = "http"
}
rules = [
{
matches = [
{
path = {
type = "PathPrefix"
value = "/v2"
}
}
]
default = {
backend_refs = [
{
kind = "MeshService"
name = "backend-v2"
port = "3001"
}
]
}
}
]
}
]
}
labels = {
"kuma.io/mesh" = konnect_mesh.my_mesh.name
}
cp_id = konnect_mesh_control_plane.my_meshcontrolplane.id
mesh = konnect_mesh.my_mesh.name
}