linkerd2/policy-controller/k8s/index
Mark S 2b1d09fa0d
refactor(status): make route types generic (#12661)
## Subject

Prepare to expand `linkerd`'s repertoire of supported [`Gateway API`](https://gateway-api.sigs.k8s.io/api-types/grpcroute/) route types in [`linkerd-policy-controller-k8s-status`](https://github.com/linkerd/linkerd2/tree/main/policy-controller/k8s/status).


## Problem

Currently, the policy controller's `status` 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, `update_http_route` as a method name, etc...).

In order to expand `linkerd`'s support for the route types defined by the Gateway API, the policy controller's `status` component needs to be made more generic in both respects.


## Solution

> **NOTE:** PR was opened out of order and should only be merged _after_ #12662

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 introducing only a couple of minor functional changes, most notably:

- making the `status` argument to [`make_patch`](8d6cd57b70/policy-controller/k8s/status/src/index.rs (L734)) generic
- adding a type-aware `api_version` helper method to [`NamespaceGroupKindName`](8d6cd57b70/policy-controller/k8s/status/src/resource_id.rs (L27))
    - **note:** *required for proper handling of different route types in the future*


## Validation

- [X] maintainer review
- [X] tests pass

![Screenshot 2024-05-30 at 11 50 28 AM](https://github.com/linkerd/linkerd2/assets/61921871/bf90c474-5af7-43c6-bffd-017042dc495d)


## ~~Fixes~~ *Lays Groundwork For Addressing*

- #12404

Signed-off-by: Mark S <the@wondersmith.dev>
2024-06-03 14:55:03 -07:00
..
src refactor(status): make route types generic (#12661) 2024-06-03 14:55:03 -07:00
Cargo.toml Add inbound policy index metrics (#12356) 2024-05-08 11:02:58 -07:00