Return 500 for half the requests a destination receives
Make backend answer 50% of incoming requests with a 500, without changing the application.
Configuration
apiVersion: kuma.io/v1alpha1
kind: MeshFaultInjection
metadata:
name: backend-abort-500
namespace: kong-mesh-demo
labels:
kuma.io/mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: backend
rules:
- default:
http:
- abort:
httpStatus: 500
percentage: 50Copied!
type: MeshFaultInjection
name: backend-abort-500
mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: backend
rules:
- default:
http:
- abort:
httpStatus: 500
percentage: 50Copied!
Adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_fault_injection" "backend_abort_500" {
provider = konnect-beta
type = "MeshFaultInjection"
name = "backend-abort-500"
spec = {
target_ref = {
kind = "Dataplane"
labels = {
app = "backend"
}
}
rules = [
{
default = {
http = [
{
abort = {
http_status = 500
percentage = { integer = 50 }
}
}
]
}
}
]
}
labels = {
"kuma.io/mesh" = konnect_mesh.my_mesh.name
}
cp_id = konnect_mesh_control_plane.my_meshcontrolplane.id
mesh = konnect_mesh.my_mesh.name
}
Copied!