-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update outbound policy watches when routes change parents #13315
Conversation
Signed-off-by: Alex Leong <[email protected]>
Signed-off-by: Alex Leong <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! makes sense.
} | ||
|
||
// We must send the route update to all namespace indexes in case this | ||
// route's parent_refs have changed and this route must be removed be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// route's parent_refs have changed and this route must be removed be | |
// route's parent_refs have changed and this route must be removed by |
} | ||
|
||
// We must send the route update to all namespace indexes in case this | ||
// route's parent_refs have changed and this route must be removed be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// route's parent_refs have changed and this route must be removed be | |
// route's parent_refs have changed and this route must be removed by |
} | ||
|
||
// We must send the route update to all namespace indexes in case this | ||
// route's parent_refs have changed and this route must be removed be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// route's parent_refs have changed and this route must be removed be | |
// route's parent_refs have changed and this route must be removed by |
} | ||
|
||
// We must send the route update to all namespace indexes in case this | ||
// route's parent_refs have changed and this route must be removed be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// route's parent_refs have changed and this route must be removed be | |
// route's parent_refs have changed and this route must be removed by |
let (kind, group) = match resource_port.kind { | ||
ResourceKind::Service => ("Service", "core"), | ||
ResourceKind::EgressNetwork => ("EgressNetwork", "policy.linkerd.io"), | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be ideal to use the type-oriented helpers
let (kind, group) = match resource_port.kind { | |
ResourceKind::Service => ("Service", "core"), | |
ResourceKind::EgressNetwork => ("EgressNetwork", "policy.linkerd.io"), | |
}; | |
let (kind, group) = match resource_port.kind { | |
ResourceKind::Service => (Service::kind(&()), Service::group(&())), | |
ResourceKind::EgressNetwork => (linkerd_k8s_api::EgressNetwork::kind(&()), linkerd_k8s_api::EgressNetwork::group(&())), | |
}; |
So that we have more typo-proof static checking.
Signed-off-by: Alex Leong <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -217,6 +217,49 @@ pub async fn await_route_status( | |||
route_status | |||
} | |||
|
|||
// Waits until an HttpRoute with the given namespace and name has a status set | |||
// on it, then returns the generic route status representation. | |||
pub async fn await_gateway_route_status( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: Is this change directly related or have you introduced this method in order to minimize flakiness that you have observed. I am asking because I myself am experiencing some flakiness because of delay in status setting, especially when the status controller has some more work to do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To resolve flakiness that was causing tests to fail. I don't think it's directly related to this change.
Fixes #13280
When an xRoute resource is updated to change its parent_refs, the route may attach to new parents or become unattached to parents it was previously attached to. However, in the policy-controller, the xRoute update will only be sent to the parents on the new version of the route resource and any existing watches on parents that the route was unattached from will not be updated.
Unfortunately, the kube-rs watch interface only provides the new version of a resource when it is updated, and not the previous state. This means that we cannot know which parents the route might have been unattached to when it was updated. Therefore, we send the route update to all NamespaceIndexes and each one removes that route from each parent if that parent is not currently an accepted parent of the route.
We also add integration tests for this behavior.
This issue applies to all xRoutes: policy HttpRoute, gateway HttpRoute, GrpcRoute, TlsRoute, and TcpRoute.