apache / pekko-management

Apache Pekko Management is a suite of tools for operating Pekko Clusters.
https://pekko.apache.org/
Apache License 2.0
22 stars 14 forks source link

Kubernetes Namespace Service Discovery #311

Closed shakeeb-upstart closed 1 month ago

shakeeb-upstart commented 1 month ago

Hi, can we add a new helper method in the "KubernetesApiServiceDiscovery" class, to lookup services in a different namespace than the default provided in the configurations. I am trying to lookup a service that's in a different Kubernetes namespace.

raboof commented 1 month ago

That makes sense to me. Perhaps we could add a constructor to KubernetesApiServiceDiscovery that you can provide your own org.apache.pekko.discovery.kubernetes.Settings-like object to instead of relying on the one from the system - would that work in your case?

shakeeb-upstart commented 1 month ago

Yeah that would work, I was only thinking of podNamespace and overloading it to a separate method, but having Settingswill give us ability to configure the other options as well

raboof commented 1 month ago

Nice! Would you be up for the challenge of contributing this improvement?

shakeeb-upstart commented 1 month ago

Yes sure

shakeeb-upstart commented 1 month ago

I cannot make changes to the constructor, It has to abide by the ServiceDiscoveryconstructor for 'DynamicAccess'.

raboof commented 1 month ago

would it be possible to have two constructors, one like the original for 'DynamicAccess' and one that takes a custom Settings?

shakeeb-upstart commented 1 month ago

I tried with defining 'apply' method in the companion object but it doesn't work.

shakeeb-upstart commented 1 month ago

I think this will do, given the lookup is in the same Kubernetes cluster

raboof commented 1 month ago

I tried with defining 'apply' method in the companion object but it doesn't work.

Perhaps if you add this to the class instead of creating an apply method?

  def this(system: ActorSystem) = {
    this(Settings(system))(system)
  }
shakeeb-upstart commented 1 month ago

Yup that worked