Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-21388

Camel Kubernetes plugin Auto Reload with '--dev' option is not working properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Duplicate
    • 4.8.1, 4.9.0
    • None
    • camel-jbang
    • None
    • Developer Sandbox for Red Hat OpenShift

    • Unknown

    Description

      Following docs at https://camel.apache.org/manual/camel-jbang-kubernetes.html#_auto_reload_with_dev_option

      Consider this command as reproducer

       

      jbang '-Dcamel.jbang.version=4.8.1' camel@apache/camel kubernetes run my-route.yaml --cluster-type=openshift --dev 

       

      The '--dev' parameter was working as expected for Camel version 4.8.0 in combination with OpenShift cluster (but it was not working for a deployment into eg local Minikube cluster)

      Camel 4.8.1, the '--dev' stopped to work and it is failing with same error as when you try with local Minikube (see error below)

       

      [INFO] ------------------------------------------------------------------------
      [INFO] BUILD SUCCESS
      [INFO] ------------------------------------------------------------------------
      [INFO] Total time:  01:35 min
      [INFO] Finished at: 2024-10-25T12:36:10+02:00
      [INFO] ------------------------------------------------------------------------
      Run: kubectl get pod -l app.kubernetes.io/name=my-route
      Exception in thread "main" java.util.ServiceConfigurationError: io.fabric8.kubernetes.api.model.KubernetesResource: io.fabric8.kubernetes.api.model.LimitRange not a subtype
              at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
              at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1244)
              at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
              at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
              at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
              at java.base/java.util.Iterator.forEachRemaining(Iterator.java:132)
              at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939)
              at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
              at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
              at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
              at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
              at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
              at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
              at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
              at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
              at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
              at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
              at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
              at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
              at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
              at io.fabric8.kubernetes.internal.KubernetesDeserializer$Mapping.registerClassesFromClassLoaders(KubernetesDeserializer.java:215)
              at io.fabric8.kubernetes.internal.KubernetesDeserializer.<init>(KubernetesDeserializer.java:90)
              at io.fabric8.kubernetes.client.utils.KubernetesSerialization.getKubernetesDeserializer(KubernetesSerialization.java:153)
              at io.fabric8.kubernetes.client.utils.KubernetesSerialization.access$000(KubernetesSerialization.java:66)
              at io.fabric8.kubernetes.client.utils.KubernetesSerialization$1.deserializerInstance(KubernetesSerialization.java:105)
              at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.deserializerInstance(DefaultDeserializationContext.java:245)
              at com.fasterxml.jackson.databind.deser.DeserializerCache.findDeserializerFromAnnotation(DeserializerCache.java:466)
              at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:361)
              at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:295)
              at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:273)
              at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:173)
              at com.fasterxml.jackson.databind.DeserializationContext.findNonContextualValueDeserializer(DeserializationContext.java:659)
              at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:550)
              at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:326)
              at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:273)
              at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:173)
              at com.fasterxml.jackson.databind.DeserializationContext.findContextualValueDeserializer(DeserializationContext.java:636)
              at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.createContextual(CollectionDeserializer.java:190)
              at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.createContextual(CollectionDeserializer.java:30)
              at com.fasterxml.jackson.databind.DeserializationContext.handlePrimaryContextualization(DeserializationContext.java:851)
              at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:561)
              at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:326)
              at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:273)
              at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:173)
              at com.fasterxml.jackson.databind.DeserializationContext.findNonContextualValueDeserializer(DeserializationContext.java:659)
              at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.resolve(BeanDeserializerBase.java:550)
              at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:326)
              at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:273)
              at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:173)
              at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:669)
              at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:5036)
              at com.fasterxml.jackson.databind.ObjectMapper._convert(ObjectMapper.java:4617)
              at com.fasterxml.jackson.databind.ObjectMapper.convertValue(ObjectMapper.java:4565)
              at io.fabric8.kubernetes.client.utils.KubernetesSerialization.parseYaml(KubernetesSerialization.java:277)
              at io.fabric8.kubernetes.client.utils.KubernetesSerialization.unmarshal(KubernetesSerialization.java:255)
              at io.fabric8.kubernetes.client.utils.KubernetesSerialization.unmarshal(KubernetesSerialization.java:345)
              at io.fabric8.kubernetes.client.utils.KubernetesSerialization.unmarshal(KubernetesSerialization.java:330)
              at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:186)
              at io.fabric8.kubernetes.client.internal.KubeConfigUtils.parseConfigFromString(KubeConfigUtils.java:47)
              at io.fabric8.kubernetes.client.Config.loadFromKubeconfig(Config.java:906)
              at io.fabric8.kubernetes.client.Config.tryKubeConfig(Config.java:869)
              at io.fabric8.kubernetes.client.Config.autoConfigure(Config.java:305)
              at io.fabric8.kubernetes.client.Config.<init>(Config.java:456)
              at io.fabric8.kubernetes.client.ConfigBuilder.build(ConfigBuilder.java:60)
              at io.fabric8.kubernetes.client.KubernetesClientBuilder.build(KubernetesClientBuilder.java:72)
              at org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesHelper.getKubernetesClient(KubernetesHelper.java:78)
              at org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesBaseCommand.client(KubernetesBaseCommand.java:94)
              at org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesBaseCommand.client(KubernetesBaseCommand.java:67)
              at org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesRun.waitForRunningPod(KubernetesRun.java:458)
              at org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesRun.doCall(KubernetesRun.java:299)
              at org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:71)
              at org.apache.camel.dsl.jbang.core.commands.CamelCommand.call(CamelCommand.java:37)
              at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
              at picocli.CommandLine.access$1500(CommandLine.java:148)
              at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
              at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
              at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
              at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
              at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
              at picocli.CommandLine.execute(CommandLine.java:2174)
              at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:173)
              at org.apache.camel.dsl.jbang.core.commands.CamelJBangMain.run(CamelJBangMain.java:62)
              at main.CamelJBang.main(CamelJBang.java:36) 

       

      interesting is that if I copy failed command from stack-trace above and execute manually, it is working just fine

       

      > kubectl get pod -l app.kubernetes.io/name=my-route
      
      
      NAME                        READY   STATUS    RESTARTS   AGE my-route-7ddf9cc898-snq5h   1/1     Running   0          31m 

       

       

      Camel 4.9.0 (4.9.0-SNAPSHOT), the '--dev' is "working", it will automatically spawn logs of running integration, BUT after termination of the process it should also remove deployment automatically, which unfortunately fails with another error (see below)

      .. again, that was working fine in Camel 4.8.0

      ^CException in thread "Camel Thread #7 - CamelShutdownInterceptor" java.lang.RuntimeException: java.io.FileNotFoundException: Unable to resolve Kubernetes manifest file type `yml` in folder: .camel-jbang-run/my-route/target/kubernetes
              at org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesRun.lambda$installShutdownInterceptor$4(KubernetesRun.java:467)
              at java.base/java.lang.Thread.run(Thread.java:1583)
      Caused by: java.io.FileNotFoundException: Unable to resolve Kubernetes manifest file type `yml` in folder: .camel-jbang-run/my-route/target/kubernetes
              at org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesHelper.resolveKubernetesManifest(KubernetesHelper.java:178)
              at org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesHelper.resolveKubernetesManifest(KubernetesHelper.java:158)
              at org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesDelete.doCall(KubernetesDelete.java:74)
              at org.apache.camel.dsl.jbang.core.commands.kubernetes.KubernetesRun.lambda$installShutdownInterceptor$4(KubernetesRun.java:465)
              ... 1 more 

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              djelinek Dominik Jelinek
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: