mh013370 commented on code in PR #8240:
URL: https://github.com/apache/nifi/pull/8240#discussion_r1453248459


##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-kubernetes-bundle/nifi-framework-kubernetes-state-provider/src/main/java/org/apache/nifi/kubernetes/state/provider/KubernetesConfigMapStateProvider.java:
##########
@@ -99,6 +118,12 @@ public void initialize(final 
StateProviderInitializationContext context) {
         this.logger = context.getLogger();
         this.kubernetesClient = getKubernetesClient();
         this.namespace = new ServiceAccountNamespaceProvider().getNamespace();
+
+        String configMapNamePrefix = 
context.getProperty(CONFIG_MAP_NAME_PREFIX).isSet() ? 
context.getProperty(CONFIG_MAP_NAME_PREFIX).getValue() : null;
+        CONFIG_MAP_NAME_FORMAT = configMapNamePrefix != null
+            ? String.format("%s-%s-%%s", configMapNamePrefix, 
CONFIG_MAP_CORE_NAME) : String.format("%s-%%s", CONFIG_MAP_CORE_NAME);
+        CONFIG_MAP_NAME_PATTERN = Pattern.compile(configMapNamePrefix != null
+            ? String.format("^%s-%s-(.+)$", configMapNamePrefix, 
CONFIG_MAP_CORE_NAME) : String.format("^%s-(.+)$", CONFIG_MAP_CORE_NAME));

Review Comment:
   ahh, okay. You're right. Maybe validation isn't possible. 
   
   If we end up computing an invalid name, an exception will be thrown in the 
Kubernetes client and eventually the provider will give up trying to create the 
ConfigMap: 
https://github.com/apache/nifi/blob/main/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-kubernetes-bundle/nifi-framework-kubernetes-state-provider/src/main/java/org/apache/nifi/kubernetes/state/provider/KubernetesConfigMapStateProvider.java#L140-L159
   
   Perhaps that's an okay end state. I was just hoping to avoid it. IMO, it 
doesn't seem like there's a nice way to do validation here so we can resolve 
this thread.



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to