Open ezraroi opened 2 years ago
Hi @ezraroi, thank you for this great question. It had me looking back through some of the original design documents for this project. You are right that the catalog sync runs on fullSync
, periodically at 30 second intervals by default. This is by design to avoid overwhelming the cluster with requests.
I'm not sure from the comments you provided where it is suggested otherwise. Please let me know any references which were confusing so that I can clarify them.
@t-eckert you can see from here:
// For both syncs, smaller more frequent and focused syncs may be
// triggered by known drift or changes.
and
// SyncPeriod is the interval between full catalog syncs. These will
// re-register all services to prevent overwrites of data. This should
// happen relatively infrequently and default to 30 seconds.
Also if we do hook and listen for changes in k8s i think we should sync them to consul. 30 seconds interval is very slow in real use cases. I think there 2 different types of sync:
Hey @ezraroi
That is true and is something has been brought up before. There is a draft PR #228 and issues #315 and #319 that I believe are caused by this behavior/current implementation. Unfortunately, to make this work properly, it will likely require a rewrite of the sync catalog controller.
I'll keep this issue as an enhancement request.
I really hope this problem can be solved. Thank you!
Question
I am using the
consul-k8s
to sync services from k8s to consul. From the docs it is not clear when and how this sync is happening. After carefully reading the code, the comments say that changes should happen when changes are detected via the k8s controller but the code itself syncs services to consul only onfullSync
. I would like to make this clear, is this a bug or the desired design?CLI Commands (consul-k8s, consul-k8s-control-plane, helm)
Helm Configuration
Current understanding and Expected behavior
Sounds like the sync should happen on every change the controller detects from k8s. In fact, changes are synced to consul only on
fullSync
.Comments from the code:
Environment details
consul-k8s
version: 0.40.0Kubernetes
version: v1.21 Cloud Provider: AWS