Skip to content
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

FEAT: Added function callback for kubernetes_node_basename #176

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Zarathustra2
Copy link

Summary of changes

  • Updated kubernetes_node_basename so that it can be supplied with a function called which allows dynamic node basenames based on the given pod information

Imagine if you have 2 separate apps oban-workers & a phoenix api both with replicas 2. Now you want to connect them and both have different hostnames, one has oban the other one has api.
As a selector you could choose: kubernetes_selector: "app in (oban-workers, api)"
but the kubernetes_node_basename is a static variable so far. If you set it to api in the phoenix api pod, then it would successful connect to its other replica but fail to connect with the oban-workers as it tries to connect with the api hostname.

As a solution with a custom function, this can be dynamically set based on the pod information

kubernetes_node_basename: fn %{labels: %{"app" => app}} ->
        case app do
          "oban-workers" -> "oban"
          "api" -> "api"
        end
      end

Hope this makes sense! :)

Best regards,
Dario

@Zarathustra2
Copy link
Author

@bitwalker Gentle ping! :) Hope that is fine and thanks again for this awesome library!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant