Fix kind in policy status index delete (#11471)

When the policy controller's status index detects the deletion of a gateway API HTTPRoute, it attempts to delete that resource out of its own index.  However, we use the wrong kind in the key when deleting.  This results in the resource persisting in the index after it has been deleted from the cluster, which causes an error to be logged every 10 seconds when the policy controller attempts to do reconciliation and ensure that the statuses of all HTTPRoutes in its index are correct:

```
2023-10-09T20:53:17.059098Z ERROR status::Controller: linkerd_policy_controller_k8s_status::index: Failed to patch HTTPRoute namespace=linkerd-policy-test-sev0n7 route=GroupKindName { group: "gateway.networking.k8s.io", kind: "HTTPRoute", name: "test" } error=ApiError: httproutes.gateway.networking.k8s.io "test" not found: NotFound (ErrorResponse { status: "Failure", message: "httproutes.gateway.networking.k8s.io \"test\" not found", reason: "NotFound", code: 404 })
```

To fix this, we use the correct kind when deleting from the index.

Signed-off-by: Alex Leong <alex@buoyant.io>
This commit is contained in:
Alex Leong 2023-10-10 14:58:57 -07:00 committed by GitHub
parent a7f520eb53
commit 1a763569ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -406,8 +406,8 @@ impl kubert::index::IndexNamespacedResource<k8s_gateway_api::HttpRoute> for Inde
let id = NamespaceGroupKindName {
namespace,
gkn: GroupKindName {
group: k8s::policy::HttpRoute::group(&()),
kind: k8s::policy::HttpRoute::kind(&()),
group: k8s_gateway_api::HttpRoute::group(&()),
kind: k8s_gateway_api::HttpRoute::kind(&()),
name: name.into(),
},
};