提交 34b3a947 编写于 作者: B Boyang Jerry Peng 提交者: Jia Zhai

Fix: Add kubernetes namespace to function instance url (#4701)

### Motivation

Currently, if the kubernetes namespace set to deploy functions in is different than the one in which brokers/workers reside, get status and stats doesn't work because the url for instances does not specify the namespace.
(cherry picked from commit 8c3445ad)
上级 cdd86426
......@@ -250,9 +250,9 @@ public class KubernetesRuntime implements Runtime {
if (channel == null && stub == null) {
channel = new ManagedChannel[instanceConfig.getFunctionDetails().getParallelism()];
stub = new InstanceControlGrpc.InstanceControlFutureStub[instanceConfig.getFunctionDetails().getParallelism()];
String jobName = createJobName(instanceConfig.getFunctionDetails());
for (int i = 0; i < instanceConfig.getFunctionDetails().getParallelism(); ++i) {
String address = createJobName(instanceConfig.getFunctionDetails()) + "-" +
i + "." + createJobName(instanceConfig.getFunctionDetails());
String address = getServiceUrl(jobName, jobNamespace, i);
channel[i] = ManagedChannelBuilder.forAddress(address, GRPC_PORT)
.usePlaintext(true)
.build();
......@@ -993,6 +993,10 @@ public class KubernetesRuntime implements Runtime {
return "pf-" + tenant + "-" + namespace + "-" + functionName;
}
private static String getServiceUrl(String jobName, String jobNamespace, int instanceId) {
return String.format("%s-%d.%s.%s.svc.cluster.local", jobName, instanceId, jobName, jobNamespace);
}
public static void doChecks(Function.FunctionDetails functionDetails) {
final String jobName = createJobName(functionDetails);
if (!jobName.equals(jobName.toLowerCase())) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册