linkerd / linkerd2

Ultralight, security-first service mesh for Kubernetes. Main repo for Linkerd 2.x.
https://linkerd.io
Apache License 2.0
10.48k stars 1.26k forks source link

refactor(policy): generalize route types in inbound index #12677

Closed the-wondersmith closed 1 day ago

the-wondersmith commented 1 month ago

Subject

Prepare to expand the subset of Gateway API route types linkerd supports driving outbound traffic with in linkerd-policy-controller-k8s-index.

Problem

Currently, the policy controller's index component is written with HTTPRoute support (effectively) exclusively, both in its structure/organization as well as its naming (e.g. HttpRoute as a primary type name, convert_http_route as a method name, etc...).

In order to expand the subset of route types defined by the Gateway API that linkerd supports for driving inbound traffic policy, the policy controller's inbound index component needs to be made more generic in both respects.

Solution

NOTE: PR is branched from the policy-refactor-core-grpc-generalize-route-types branch, so the diff will be appear larger than it actually is until after #12662 has been merged.

PR introduces structural and naming changes making the codebase generic with respect to the type of route being handled (e.g. HTTPRoute -> Route). Changes are almost entirely cosmetic but may still appear rather extreme at first glance. Even so, PR should not be introducing any meaningful behavioral changes in refactored functions and methods.

Validation

Screenshot 2024-06-03 at 2 27 01 PM

Fixes Lays Groundwork For Addressing