-
Notifications
You must be signed in to change notification settings - Fork 690
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
Unrelated secret changes trigger contour envoy xds communication and status update on httpproxies #4386
Comments
Yeah, I can see generally why this is happening - these unrelated secrets are being stored in the DAG cache, even though they're not referenced, and updates or deletes trigger the I think you'd probably see the same thing with updates/deletes on unrelated Services too. Right now, we have to cache all Services and Secrets because otherwise they'd be unavailable to the DAG if/when they are eventually referenced by an HTTPProxy or Ingress. This logic is definitely tricky to get exactly right while still being performant, especially given the way the DAG cache currently works. I think now that we're using controller-runtime more broadly, we might have some options for leveraging its Cache to do some refactoring here and make these problems go away, but it would be a pretty big change and we'd have to ensure no functional or performance regressions. There might be a more tactical fix here around checking for usage of the Secret/Service before validating it, and also when processing a delete, that could reduce the amount of churn. We'd have to make sure that we are properly validating things when they do start being referenced by an HTTPProxy or Ingress, though. Do you have a sense of the impact of this issue for you? Urgent to fix, or minor annoyance? |
Looked at this some more and I have a few thoughts on fixes we can make ~now:
I think we can probably also get more efficient with our tracking/checking of whether secrets and services are used -- right now it's fairly inefficient for larger sets of data. One idea would be to do some reference tracking as HTTPProxies/Ingresses/Routes go into the cache, so we keep a running list of which secrets/services are referenced, and then use that as a basis for determining whether a given secret/service event needs to trigger a rebuild or not. This is more of a nice-to-have performance improvement, though, not directly related to the issues you're encountering. |
I see your point on the DAG referencing. I guess the list keeping of important resources could be a great way of not triggering unwanted rebuild/status update and envoy communication. So far the issue itself was not triggering faults, for now I can only foresee CPU and Network usage as a result of this. Any input on the kubernetes-debug=10 vs secret informer verbosity question? That could be a low hanging fruit at first |
informers come from controller-runtime manager caches, so we can maybe look at if the controller-runtime manager needs the logger to be hooked up properly, currently we just use the "default": https://github.com/kubernetes-sigs/controller-runtime/blob/9ee63fc65a9720568f74df9901b16883621636b4/pkg/manager/manager.go#L136-L138 |
See #4391 for an attempt to fix the logging part |
On Secret updates and deletes, only trigger DAG rebuilds if the Secret is referenced by an Ingress, HTTPProxy, Gateway or global config. Closes projectcontour#4386. Signed-off-by: Steve Kriss <krisss@vmware.com>
On Secret updates and deletes, only trigger DAG rebuilds if the Secret is referenced by an Ingress, HTTPProxy, Gateway or global config. Closes projectcontour#4386. Signed-off-by: Steve Kriss <krisss@vmware.com>
On Secret updates and deletes, only trigger DAG rebuilds if the Secret is referenced by an Ingress, HTTPProxy, Gateway or global config. Closes #4386. Signed-off-by: Steve Kriss <krisss@vmware.com>
…ctcontour#4792) On Secret updates and deletes, only trigger DAG rebuilds if the Secret is referenced by an Ingress, HTTPProxy, Gateway or global config. Closes projectcontour#4386. Signed-off-by: Steve Kriss <krisss@vmware.com>
When I run contour with --debug and --kubernetes-debug=10 and have any valid httpproxy in the system (regardless of using any secrets or not), change in unrelated secrets will trigger contour and envoy communication, and also a status update on all httpproxy instances, even if that secret has nothing to do with ingress.
Interestingly does not trigger on generic secrets.
Ways to reproduce it:
have two certificate and key files ready: secret1/secret.key secret1/secret.crt secret2/secret.key secret2/secret.crt
Update the secret by alternating the two lines:
While checking the log of contour. You will see:
This can generate unwanted pressure on the xds communication, and also on kube API
Secret creation is an exception, but secret change and secret deletion does trigger the behavior.
Similar to this issue
#3782
Related issue:
Also I noticed that --kubernetes-debug=10 does not seem to have an affect on the informer on the secrets. At least I don't see secret related API movement in the logs.
Also related issue:
Using the same setup and creating a secret the following way:
then update it with the following command:
I see the following error on contour, on a secret it should not care about.
The problem only seen on unrelated secret Updates.
kubectl version
): 1.21.1/etc/os-release
):The text was updated successfully, but these errors were encountered: