FEAT: Added function callback for kubernetes_node_basename #176
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.
Summary of changes
kubernetes_node_basenameso that it can be supplied with a function called which allows dynamic node basenames based on the given pod informationImagine if you have 2 separate apps
oban-workers& a phoenixapiboth with replicas 2. Now you want to connect them and both have different hostnames, one hasobanthe other one hasapi.As a selector you could choose:
kubernetes_selector: "app in (oban-workers, api)"but the
kubernetes_node_basenameis a static variable so far. If you set it toapiin the phoenix api pod, then it would successful connect to its other replica but fail to connect with theoban-workersas it tries to connect with theapihostname.As a solution with a custom function, this can be dynamically set based on the pod information
Hope this makes sense! :)
Best regards,
Dario