You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by sa...@apache.org on 2019/01/29 22:48:54 UTC
[pulsar] branch master updated: Add a component tag for every
pulsar function (#3468)
This is an automated email from the ASF dual-hosted git repository.
sanjeevrk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new bdd6019 Add a component tag for every pulsar function (#3468)
bdd6019 is described below
commit bdd601969fdb16a4936a6cb4cf5e5f8a781ed616
Author: Sanjeev Kulkarni <sa...@gmail.com>
AuthorDate: Tue Jan 29 14:48:49 2019 -0800
Add a component tag for every pulsar function (#3468)
* Add a component tag for every pulsar function
* Took feedback into account
---
.../pulsar/functions/runtime/KubernetesRuntime.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java
index aba473b..9ba500e 100644
--- a/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java
+++ b/pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/KubernetesRuntime.java
@@ -60,11 +60,13 @@ import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.pulsar.functions.instance.AuthenticationConfig;
import org.apache.pulsar.functions.instance.InstanceConfig;
+import org.apache.pulsar.functions.instance.InstanceUtils;
import org.apache.pulsar.functions.proto.Function;
import org.apache.pulsar.functions.proto.InstanceCommunication;
import org.apache.pulsar.functions.proto.InstanceCommunication.FunctionStatus;
import org.apache.pulsar.functions.proto.InstanceControlGrpc;
import org.apache.pulsar.functions.secretsproviderconfigurator.SecretsProviderConfigurator;
+import org.apache.pulsar.functions.utils.Utils;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeUnit;
@@ -546,6 +548,23 @@ class KubernetesRuntime implements Runtime {
private Map<String, String> getLabels(Function.FunctionDetails functionDetails) {
final Map<String, String> labels = new HashMap<>();
+ Utils.ComponentType componentType = InstanceUtils.calculateSubjectType(functionDetails);
+ String component;
+ switch (componentType) {
+ case FUNCTION:
+ component = "function";
+ break;
+ case SOURCE:
+ component = "source";
+ break;
+ case SINK:
+ component = "sink";
+ break;
+ default:
+ component = "function";
+ break;
+ }
+ labels.put("component", component);
labels.put("namespace", functionDetails.getNamespace());
labels.put("tenant", functionDetails.getTenant());
labels.put("name", functionDetails.getName());