From 1a763569ce12f5af7156d4d050feaae438ba4840 Mon Sep 17 00:00:00 2001 From: Alex Leong Date: Tue, 10 Oct 2023 14:58:57 -0700 Subject: [PATCH] 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 --- policy-controller/k8s/status/src/index.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/policy-controller/k8s/status/src/index.rs b/policy-controller/k8s/status/src/index.rs index a51e2059b..8382a26a1 100644 --- a/policy-controller/k8s/status/src/index.rs +++ b/policy-controller/k8s/status/src/index.rs @@ -406,8 +406,8 @@ impl kubert::index::IndexNamespacedResource 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(), }, };