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

Added support for discovery by enumerating pods via Kubernetes API #29

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

JessieWadman
Copy link

You can specify namespace and a label selector to use to find pods, as well as annotate pods with akka tcp port (optional).

@Horusiath
Copy link
Owner

Wow! Thanks for your contribution @JessieWadman . Sorry for late reply. I'll try to review your PR over the weekend.

Copy link
Owner

@Horusiath Horusiath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left few remarks, otherwise it looks good. The only issue I see here, is how well tested edge cases are (like node processes joining/leaving the cluster dynamically, gracefully or not).

private readonly ILoggingAdapter logger = Context.GetLogger();

private readonly string actorSystemName;
private readonly string labelSelector;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This field is private and it's not used anywhere.

private Address DeterminePodAddress(V1Pod pod)
{
if (!int.TryParse(pod.GetAnnotation("akka.remote.dot-netty.tcp.port"), out var port))
port = Cluster.SelfAddress.Port ?? 0;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think, this is a good approach. This method is used for setup the initial list of nodes to contact with. The problem here is that port 0 is a valid port only for local node, but not for any remote connection. Depending on the case this should either result in a:

  1. Info saying that pod X was not annotated, so we assume current node port. In case when port is not specified throw an exception. This could however end up in weird behavior when current node was configured to use dynamic port (0), as it will be different for every OS process.
  2. Warning (saying that pod X was not properly annotated with akka.remote.dot-netty.tcp.port) and filtering out that pod's address. I think this sounds as the best option.
  3. Exception and shutdown the entire actor system.

Another issue is annotation itself: it will work only with akka.remote.dot-netty.tcp.port, which is the most common but not necessarily the only valid transport option. In general this should take into account the current configured transport - it can we taken from configuration using akka.remote.enabled-transports path (see: here).

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.

2 participants