-
Notifications
You must be signed in to change notification settings - Fork 326
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
catalog/from-k8s: Don't spin loop on watchService #33
Conversation
With the `default:` clause here, the time.After doesn't work and just falls through to `default` causing a spin loop on the consul agent.
c1e6881
to
8cdd856
Compare
So for context, I'm working through some unexplained issues I'm having, and this stood out as something that was hammering our system. But in changing this, it seems I have exaggerated my original issue I was seeing. So I'm not sure yet about merging this until I fully understand the behaviors I am seeing. Basically, consul-k8s seems to flap services regularly when syncing from k8s -> consul. Services come in and out relatively rapidly. Maybe every minute or so, but it's not super predictable. It's also relatively unreliable to do any syncing. Sometimes it just doesn't work and takes a while for it to fix itself. I'm investigating more here on what's actually going on since it could be something weird I'm doing, but I don't think it really is at this point. I'm happy to share more information. |
Hi,
One of my hypothesis is that the NodePort registration is done using the Catalog API. Regards. |
@descrepes You might be right. I looked into how I've done similar things outside of kubernetes in the past, and I always registered services into the local agent, not directly into the catalog. I'm going to investigate this further today and make sure I can reproduce that behavior outside of consul-k8s. |
So according to docs:
|
@descrepes do you happen to be running master of the The problem with this change is it changes the consul client agent to register itself with the name of the host machine. The services themselves also are registered with the |
@mattrobenolt yes i'm running with that. I will try to make some tests on my cluster without registering the agent with the Node IP. |
I removed the |
My guess is the old nodes are still registered under the member list as left, but they haven't actually been removed from the cluster. In my case, I'm just poking around with new stuff, so I just removed the consul cluster, and rebuilt it with |
Well i dropped my actual cluster and bootstrapped a fresh one without the |
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.
This is a great find, thanks! It definitely fixes the performance of the sync process. The other issue about services being de-registered that you mention in the comments should be fixed now that #63 is merged.
Since you created this, HashiCorp has implemented a Contributor License Agreement (more info available here. I'll merge this as soon as you've had a change to sign the agreement!
Thanks!
@adilyse From what I read, it says a bot will comment with information to sign the CLA. Aside from that, I see no way to sign it. :( But it's just a single line change, feel free to just take it without crediting me. |
Try this link. |
Thanks! Done. The check hasn't cleared up, but the CLA is signed on my end. |
With the
default:
clause here, the time.After doesn't work and justfalls through to
default
causing a spin loop on the consul agent.