Uploaded image for project: 'Kogito'
  1. Kogito
  2. KOGITO-8634

Kogito is messed with symlink in src/main/resources directory when resources are mounted with ConfigMap

XMLWordPrintable

    • 2023 Week 06-08 (from Feb 6)

      When codegen is reading resources in src/main/resources and they are mapped with symlinks like this:

      [kogito@greeting-965f59978-qmkjp ~]$ ls -la serverless-workflow-project/src/main/resources/workflows/
      total 12
      drwxrwxrwx 3 root   root 4096 Feb  9 12:47 .
      drwxrwxr-x 1 kogito root 4096 Feb  9 12:47 ..
      drwxr-xr-x 2 root   root 4096 Feb  9 12:47 ..2023_02_09_12_47_10.3428971884
      lrwxrwxrwx 1 root   root   32 Feb  9 12:47 ..data -> ..2023_02_09_12_47_10.3428971884
      lrwxrwxrwx 1 root   root   23 Feb  9 12:47 greeting.sw.json -> ..data/greeting.sw.json
      

      In the console you can see:

      Resulted in: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
      	[error]: Build step org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor#generateSources threw an exception: org.kie.kogito.codegen.process.ProcessCodegenException: Duplicated item found with id greeting. Please review the .sw files
      	at org.kie.kogito.codegen.process.ProcessCodegen.<init>(ProcessCodegen.java:267)
      	at org.kie.kogito.codegen.process.ProcessCodegen.ofProcesses(ProcessCodegen.java:236)
      	at org.kie.kogito.codegen.process.ProcessCodegen.ofCollectedResources(ProcessCodegen.java:157)
      	at org.kie.kogito.codegen.process.ProcessCodegenFactory.create(ProcessCodegenFactory.java:29)
      	at org.kie.kogito.codegen.core.utils.ApplicationGeneratorDiscovery.lambda$loadGenerators$0(ApplicationGeneratorDiscovery.java:60)
      	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
      	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
      	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
      	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
      	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
      	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
      	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
      	at org.kie.kogito.codegen.core.utils.ApplicationGeneratorDiscovery.loadGenerators(ApplicationGeneratorDiscovery.java:62)
      	at org.kie.kogito.codegen.core.utils.ApplicationGeneratorDiscovery.discover(ApplicationGeneratorDiscovery.java:48)
      	at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateFiles(KogitoAssetsProcessor.java:263)
      	at org.kie.kogito.quarkus.common.deployment.KogitoAssetsProcessor.generateSources(KogitoAssetsProcessor.java:141)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:909)
      	at io.quarkus.builder.BuildContext.run(BuildContext.java:281)
      	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
      	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
      	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
      	at java.base/java.lang.Thread.run(Thread.java:829)
      	at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      
      	at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:335)
      

      Although there's only one workflow file, the runtime tries to expand the data directory and find the original mount point, hence the duplication.

      What happens is that on Kubernetes, configMaps are mounted with aliases by default.

      This is critical since, without this approach, we have to restart the pod each time a change is made to the workflow since now we need to use subPath to workaround this problem: https://kubernetes.io/docs/concepts/configuration/configmap/#mounted-configmaps-are-updated-automatically

      For more information: https://stackoverflow.com/questions/62776362/k8s-configmap-mounted-inside-symbolic-link-to-data-directory

              rhn-support-zanini Ricardo Zanini
              rhn-support-zanini Ricardo Zanini
              Marian Macik Marian Macik
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: