Track kubernetes record status based on available pods #159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #148.
@tsegismont The scope of this PR is admittedly larger than I would like; I found myself re-organizing the existing code to get a better understanding of its function.
This is a first attempt at implementing #148, missing tests coverage, and could no doubt be improved. Let me know your thoughts on the general approach.
Using 3 maps to track service selectors, service's active pods, and the sevices per pod feels sub-optimal, but the intention was to avoid calculating everything on the fly:
vertx-service-discovery/vertx-service-discovery-bridge-kubernetes/src/main/java/io/vertx/servicediscovery/kubernetes/KubernetesServiceImporter.java
Lines 71 to 73 in 048b2e3
The way that service status is updated also feels like it could be better (more reactive). For busier k8s instances, simply checking the size of the lists after modification may not work (concurrent modification). Ideally, we'd hook into the changes in the lists and update the services based on that.
vertx-service-discovery/vertx-service-discovery-bridge-kubernetes/src/main/java/io/vertx/servicediscovery/kubernetes/KubernetesServiceImporter.java
Lines 535 to 542 in 048b2e3
vertx-service-discovery/vertx-service-discovery-bridge-kubernetes/src/main/java/io/vertx/servicediscovery/kubernetes/KubernetesServiceImporter.java
Lines 550 to 556 in 048b2e3
To-do: