addisonj commented on a change in pull request #5400: [functions] Allow 
functions to pass runtime specific options
URL: https://github.com/apache/pulsar/pull/5400#discussion_r344416501
 
 

 ##########
 File path: 
pulsar-functions/runtime/src/main/java/org/apache/pulsar/functions/runtime/kubernetes/KubernetesRuntimeFactory.java
 ##########
 @@ -361,8 +376,26 @@ void 
validateMinResourcesRequired(Function.FunctionDetails functionDetails) {
         }
     }
 
+    KubernetesManifestCustomizer 
buildManifestCustomizer(Function.FunctionDetails funcDetails) {
+
+        KubernetesManifestCustomizer manifestCustomizer;
+        if (!isEmpty(manifestCustomizerClassName)) {
+            manifestCustomizer = (KubernetesManifestCustomizer) 
Reflections.createInstance(manifestCustomizerClassName, 
ClassLoader.getSystemClassLoader());
+        } else {
+            manifestCustomizer = new NoOpKubernetesManifestCustomizer();
+        }
+        manifestCustomizer.init(funcDetails, manifestCustomizerStaticConfig);
+        return manifestCustomizer;
+    }
+
     @Override
-    public Optional<FunctionAuthProvider> getAuthProvider() {
-        return Optional.ofNullable(authProvider.orElse(null));
+    public Optional<FunctionAuthProvider> 
getAuthProvider(Function.FunctionDetails funcDetails) {
 
 Review comment:
   Yeah, so the problem is (or come up with an alternative) the issues is that 
we either:
   
   1. The `KubernetesFunctionAuthProvider` won't know the right namespace to 
create the secret in. Since secrets are per namespace, that will break for any 
functions that override the namespace they want to run in. Or
   2. We could call change the `KubernetesFunctionAuthProvider` such that it 
gets the namespace via some other means (instead of the initialize method, 
obviously, we don't want to have the initialize method called multiple times as 
that would be very strange for custom implementations). Looking at the API, I 
don't see any clean way to add the namespace into the `cacheAuthData` call of 
the FunctionAuthProvider. I spent a fair amount of time considering 
alternatives, but this seemed like the cleanest approach to simple delay the 
invocation of the AuthProvider and have it be scoped per function.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to