Speed up CheckIngress in admission hook by eliminating the deep copy #7297
Labels
kind/cleanup
Categorizes issue or PR as related to cleaning up code, process, or technical debt.
priority/important-longterm
Important over the long term, but may not be staffed and/or may need multiple releases to complete.
triage/accepted
Indicates an issue or PR is ready to be actively worked on.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
In the company where I working we have several k8s clusters and one dedicated to developers personal stands.
k8s is working in aws ec2 nodes.
Developer's cluster's nginx ingress controller config contains 120
server
sections, 5271location
sections and have 19MB size as text config.On such big config amission hook for each ingress update becomes too slow, it lasts about 7 seconds now. And it was even slower before I speed it up by rewriting bash scripts (!) which were used inside
CheckIngress
(#7076).But it's still very slow. So we disabled admission hooks, because when somebody creates new developer stand admission hooks must be evaluated many times and sometimes we got error from master that admission hook finished with time out (of 30s).
I found next place which take now about 3s on my config:
ingress-nginx/internal/ingress/controller/location.go
Lines 76 to 80 in 8328b53
As far as I understand deep copy is redundant in this case. Shallow copy will be enough.
e2e test: https://gist.github.com/cgorbit/431086b0e78f1a8b75cd497235ae8d51
The text was updated successfully, but these errors were encountered: