[improve][functions] Allow customizing Kubernetes service domain suffix in Function Worker - #25872
Conversation
|
@iantowey Please don't commit "force ci re-run" commits. CI needs to be approved to run. If you want to work on early changes and run CI, please setup "Personal CI". |
|
@lhotari apologies for this, i thought job would run in my forked repo CI https://github.com/iantowey/pulsar/actions. I'll
|
@iantowey Sure that's fine, the commits don't cause problems itself. I got the impression that you weren't aware of "Personal CI". When using "Personal CI", you can trigger a rerun in the UI or with the |
|
@iantowey Thanks for the contribution. This has been merged. Some questions about the context of this PR: What higher level goal are you planning to achieve with this PR? Regarding the use case "This change solves the problem by allowing users to customize the domain suffix, enabling external Function Workers to route traffic to function instances via an external Gateway or Ingress.". One notable detail of the GRPC connection from the Function Worker to the Function Instances is that it doesn't use authentication or TLS (it uses plaintext GRPC). The same applies to the exposed Prometheus metrics. Regarding security of Pulsar Functions, the provided solution in Apache Pulsar and Apache Pulsar Helm chart assume that the deployed solution is used by trusted users running trusted code, isolated with network perimeter security. Some notes of this were recently added to SECURITY.md. There are hooks to harden the security, but this is not covered currently. |
|
Happy to share our context. We are still in the testing phase for this architecture, so some specifics might evolve, but this is the general direction we are heading. Higher Level Goal By default, the worker attempts to reach function instances using internal Kubernetes DNS (e.g., Automating Gateway Routing with Kyverno Kubernetes Authentication Configuration Security Context Thanks again for the review and merge! Let me know if you need any more details. |
|
@iantowey Thanks for sharing the context of this PR and explaining how you have addressed the different concerns. |
…ix in Function Worker (apache#25872) Co-authored-by: Ian <itowey@beyond.com> (cherry picked from commit cc9fddc) (cherry picked from commit 73a0258)
…ix in Function Worker (apache#25872) Co-authored-by: Ian <itowey@beyond.com> (cherry picked from commit cc9fddc) (cherry picked from commit 73a0258)
…ix in Function Worker (apache#25872) Co-authored-by: Ian <itowey@beyond.com> (cherry picked from commit cc9fddc)
Motivation
Currently, the
KubernetesRuntimehardcodes the Kubernetes service domain suffix to.svc.cluster.localwhen constructing the gRPC address used by the Function Worker to connect to functioninstances. If a Function Worker is deployed outside of the Kubernetes cluster, it cannot communicate with the function pods because it cannot resolve the internal cluster DNS.
This change solves the problem by allowing users to customize the domain suffix, enabling external Function Workers to route traffic to function instances via an external Gateway or Ingress.
Modifications
kubernetesServiceDomainSuffixconfiguration parameter tofunctions_worker.ymlandKubernetesRuntimeFactoryConfig.KubernetesRuntimeFactorydown intoKubernetesRuntime.KubernetesRuntime.getServiceUrl()to use the configured suffix if provided, safely falling back to.svc.cluster.localif left blank to preserve backwards compatibility.testGetServiceUrlinKubernetesRuntimeTestto verify both the default behavior and the customized suffix behavior.Verifying this change
This change added tests and can be verified as follows:
testGetServiceUrlinKubernetesRuntimeTestto ensure thatgetServiceUrlconstructs the correct FQDN using either the default suffix or the customkubernetesServiceDomainSuffix.Does this pull request potentially affect one of the following parts: