Skip to content

Commit

Permalink
Fix kind in policy status index delete (#11471)
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
adleong committed Oct 10, 2023
1 parent a7f520e commit 1a76356
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions policy-controller/k8s/status/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
},
};
Expand Down

0 comments on commit 1a76356

Please sign in to comment.