You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/04/12 11:23:05 UTC

[GitHub] [camel-k] oscerd opened a new issue #2203: Kamelet yaml will be stored with wrong order of fields

oscerd opened a new issue #2203:
URL: https://github.com/apache/camel-k/issues/2203


   If you create a simple kamelet like this.
   
   ```
   apiVersion: camel.apache.org/v1alpha1
   kind: Kamelet
   metadata:
     name: azure-storage-blob-sink
     annotations:
       camel.apache.org/kamelet.icon: ""
       camel.apache.org/provider: "Apache Software Foundation"
     labels:
       camel.apache.org/kamelet.type: "sink"
   spec:
     definition:
       title: "Azure Storage Blob Sink"
       description: |-
         Upload data to Azure Storage Blob.
   
         The Kamelet expects the following headers to be set:
   
         - `file` / `ce-file`: as the file name to upload
   
         If the header won't be set the exchange ID will be used as file name.
       required:
         - accountName
         - containerName
         - accessKey
       properties:
         accountName:
           title: Account Name
           description: The Azure Storage Blob account name.
           type: string
         containerName:
           title: Container Name
           description: The Azure Storage Blob container name.
           type: string
         accessKey:
           title: Access Key
           description: The Azure Storage Blob access Key.
           type: string
           x-descriptors:
           - urn:alm:descriptor:com.tectonic.ui:password
         operation:
           title: Operation name
           description: The operation to perform.
           type: string
           default: uploadBlockBlob
     flow:
       from:
         uri: "kamelet:source"
         steps:
         - choice:
             when:
             - simple: "${header[file]}"
               steps:
               - set-header:
                   name: CamelAzureStorageBlobBlobName
                   simple: "${header[file]}"
             - simple: "${header[ce-file]}"
               steps:
               - set-header:
                   name: CamelAzureStorageBlobBlobName
                   simple: "${header[ce-file]}"
             otherwise:
               steps:
               - set-header:
                   name: CamelAzureStorageBlobBlobName
                   simple: "${exchangeId}"
         - to:
             uri: "azure-storage-blob://{{accountName}}/{{containerName}}"
             parameters:
               accessKey: "{{accessKey}}"
               operation: "{{operation}}"
   ```
   
   With camel-k master.
   
   After apply the file through kubectl, by running the following command:
   
   ```
   kubectl describe kamelet azure-storage-blob-sink
   ....
     Flow:
       From:
         Steps:
           Choice:
             Otherwise:
               Steps:
                 Set - Header:
                   Name:    CamelAwsS3Key
                   Simple:  ${exchangeId}
             When:
               Simple:  ${header[file]}
               Steps:
                 Set - Header:
                   Name:    CamelAwsS3Key
                   Simple:  ${header[file]}
               Simple:      ${header[ce-file]}
               Steps:
                 Set - Header:
                   Name:    CamelAwsS3Key
                   Simple:  ${header[ce-file]}
           To:
             Parameters:
               Access Key:             {{accessKey}}
               Auto Create Bucket:     {{autoCreateBucket}}
               Override Endpoint:      {{overrideEndpoint}}
               Region:                 {{region}}
               Secret Key:             {{secretKey}}
               Uri Endpoint Override:  {{uriEndpointOverride}}
             Uri:                      aws2-s3:{{bucketNameOrArn}}
         Uri:                          kamelet:source 
   ...
   ```
   
   The wrong order will lead to the following error while running a binding including the kamelet
   
   ```
   [1] 2021-04-12 09:47:42,212 INFO  [org.apa.cam.k.Runtime] (main) Apache Camel K Runtime 1.7.0-SNAPSHOT
   [1] 2021-04-12 09:47:42,214 INFO  [org.apa.cam.qua.cor.CamelBootstrapRecorder] (main) bootstrap runtime: org.apache.camel.quarkus.main.CamelMainRuntime
   [1] 2021-04-12 09:47:42,252 INFO  [org.apa.cam.k.lis.SourcesConfigurer] (main) Loading routes from: SourceDefinition{name='camel-k-embedded-flow', language='yaml', location='file:/etc/camel/sources/camel-k-embedded-flow.yaml', }
   [1] 2021-04-12 09:47:42,305 INFO  [org.apa.cam.k.lis.SourcesConfigurer] (main) Loading routes from: SourceDefinition{name='azure-storage-blob-sink', language='yaml', type='template', propertyNames='[accessKey, accountName, containerName, operation]', location='file:/etc/camel/sources/azure-storage-blob-sink.yaml', }
   [1] 2021-04-12 09:47:42,307 INFO  [org.apa.cam.k.lis.SourcesConfigurer] (main) Loading routes from: SourceDefinition{name='simulation-source', language='yaml', type='template', propertyNames='[contentType, message, period]', location='file:/etc/camel/sources/simulation-source.yaml', }
   [1] 2021-04-12 09:47:42,485 ERROR [org.apa.cam.qua.mai.CamelMainRuntime] (main) Failed to start application: org.snakeyaml.engine.v2.exceptions.YamlEngineException: java.lang.IllegalStateException: url must be set before setting properties
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.construct(BaseConstructor.java:93)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructSingleDocument(BaseConstructor.java:74)
   [1] 	at org.snakeyaml.engine.v2.api.Load.loadOne(Load.java:84)
   [1] 	at org.snakeyaml.engine.v2.api.Load.loadFromInputStream(Load.java:96)
   [1] 	at org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader$1.configure(YamlRoutesBuilderLoader.java:113)
   [1] 	at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:540)
   [1] 	at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:487)
   [1] 	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:462)
   [1] 	at org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1161)
   [1] 	at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:200)
   [1] 	at org.apache.camel.quarkus.main.CamelMain.configureRoutes(CamelMain.java:70)
   [1] 	at org.apache.camel.main.BaseMainSupport.postProcessCamelContext(BaseMainSupport.java:546)
   [1] 	at org.apache.camel.quarkus.main.CamelMain.initCamelContext(CamelMain.java:116)
   [1] 	at org.apache.camel.quarkus.main.CamelMain.doInit(CamelMain.java:86)
   [1] 	at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
   [1] 	at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:137)
   [1] 	at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
   [1] 	at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
   [1] 	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy_0(CamelBootstrapProcessor$boot-173480958.zig:101)
   [1] 	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy(CamelBootstrapProcessor$boot-173480958.zig:40)
   [1] 	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:719)
   [1] 	at io.quarkus.runtime.Application.start(Application.java:90)
   [1] 	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:100)
   [1] 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
   [1] 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
   [1] 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
   [1] 	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
   [1] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   [1] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   [1] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   [1] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
   [1] 	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:48)
   [1] 	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:25)
   [1] Caused by: java.lang.IllegalStateException: url must be set before setting properties
   [1] 	at org.apache.camel.dsl.yaml.deserializers.ModelDeserializers$ToDefinitionDeserializer.setProperty(ModelDeserializers.java:14189)
   [1] 	at org.apache.camel.dsl.yaml.deserializers.ModelDeserializers$ToDefinitionDeserializer.setProperty(ModelDeserializers.java:14141)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerBase.setProperties(YamlDeserializerBase.java:103)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:51)
   [1] 	at org.apache.camel.k.loader.yaml.YamlSourceLoaderDeserializerResolver$ToDeserializer.construct(YamlSourceLoaderDeserializerResolver.java:65)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializationContext$2.construct(YamlDeserializationContext.java:194)
   [1] 	at org.apache.camel.dsl.yaml.deserializers.ProcessorDefinitionDeserializer.construct(ProcessorDefinitionDeserializer.java:36)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializationContext$1.construct(YamlDeserializationContext.java:152)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asType(YamlDeserializerSupport.java:290)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asCollection(YamlDeserializerSupport.java:268)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asFlatCollection(YamlDeserializerSupport.java:249)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asFlatList(YamlDeserializerSupport.java:223)
   [1] 	at org.apache.camel.dsl.yaml.deserializers.RouteFromDefinitionDeserializer.setProperties(RouteFromDefinitionDeserializer.java:76)
   [1] 	at org.apache.camel.dsl.yaml.deserializers.RouteFromDefinitionDeserializer.setProperties(RouteFromDefinitionDeserializer.java:36)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:51)
   [1] 	at org.apache.camel.k.loader.yaml.YamlSourceLoaderDeserializerResolver$RouteFromDeserializer.construct(YamlSourceLoaderDeserializerResolver.java:57)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializationContext$2.construct(YamlDeserializationContext.java:194)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:140)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructObject(BaseConstructor.java:128)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructSequenceStep2(BaseConstructor.java:206)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructSequence(BaseConstructor.java:199)
   [1] 	at org.snakeyaml.engine.v2.constructor.StandardConstructor$ConstructYamlSeq.construct(StandardConstructor.java:340)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:140)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructObject(BaseConstructor.java:128)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.construct(BaseConstructor.java:87)
   [1] 	... 32 more
   [1] 
   [1] 2021-04-12 09:47:42,517 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): java.lang.IllegalStateException: url must be set before setting properties
   [1] 	at org.apache.camel.dsl.yaml.deserializers.ModelDeserializers$ToDefinitionDeserializer.setProperty(ModelDeserializers.java:14189)
   [1] 	at org.apache.camel.dsl.yaml.deserializers.ModelDeserializers$ToDefinitionDeserializer.setProperty(ModelDeserializers.java:14141)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerBase.setProperties(YamlDeserializerBase.java:103)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:51)
   [1] 	at org.apache.camel.k.loader.yaml.YamlSourceLoaderDeserializerResolver$ToDeserializer.construct(YamlSourceLoaderDeserializerResolver.java:65)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializationContext$2.construct(YamlDeserializationContext.java:194)
   [1] 	at org.apache.camel.dsl.yaml.deserializers.ProcessorDefinitionDeserializer.construct(ProcessorDefinitionDeserializer.java:36)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializationContext$1.construct(YamlDeserializationContext.java:152)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asType(YamlDeserializerSupport.java:290)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asCollection(YamlDeserializerSupport.java:268)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asFlatCollection(YamlDeserializerSupport.java:249)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerSupport.asFlatList(YamlDeserializerSupport.java:223)
   [1] 	at org.apache.camel.dsl.yaml.deserializers.RouteFromDefinitionDeserializer.setProperties(RouteFromDefinitionDeserializer.java:76)
   [1] 	at org.apache.camel.dsl.yaml.deserializers.RouteFromDefinitionDeserializer.setProperties(RouteFromDefinitionDeserializer.java:36)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializerBase.construct(YamlDeserializerBase.java:51)
   [1] 	at org.apache.camel.k.loader.yaml.YamlSourceLoaderDeserializerResolver$RouteFromDeserializer.construct(YamlSourceLoaderDeserializerResolver.java:57)
   [1] 	at org.apache.camel.dsl.yaml.common.YamlDeserializationContext$2.construct(YamlDeserializationContext.java:194)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:140)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructObject(BaseConstructor.java:128)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructSequenceStep2(BaseConstructor.java:206)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructSequence(BaseConstructor.java:199)
   [1] 	at org.snakeyaml.engine.v2.constructor.StandardConstructor$ConstructYamlSeq.construct(StandardConstructor.java:340)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:140)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructObject(BaseConstructor.java:128)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.construct(BaseConstructor.java:87)
   [1] 	at org.snakeyaml.engine.v2.constructor.BaseConstructor.constructSingleDocument(BaseConstructor.java:74)
   [1] 	at org.snakeyaml.engine.v2.api.Load.loadOne(Load.java:84)
   [1] 	at org.snakeyaml.engine.v2.api.Load.loadFromInputStream(Load.java:96)
   [1] 	at org.apache.camel.dsl.yaml.YamlRoutesBuilderLoader$1.configure(YamlRoutesBuilderLoader.java:113)
   [1] 	at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:540)
   [1] 	at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:487)
   [1] 	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:462)
   [1] 	at org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1161)
   [1] 	at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:200)
   [1] 	at org.apache.camel.quarkus.main.CamelMain.configureRoutes(CamelMain.java:70)
   [1] 	at org.apache.camel.main.BaseMainSupport.postProcessCamelContext(BaseMainSupport.java:546)
   [1] 	at org.apache.camel.quarkus.main.CamelMain.initCamelContext(CamelMain.java:116)
   [1] 	at org.apache.camel.quarkus.main.CamelMain.doInit(CamelMain.java:86)
   [1] 	at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
   [1] 	at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:137)
   [1] 	at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
   [1] 	at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
   [1] 	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy_0(CamelBootstrapProcessor$boot-173480958.zig:101)
   [1] 	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy(CamelBootstrapProcessor$boot-173480958.zig:40)
   [1] 	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:719)
   [1] 	at io.quarkus.runtime.Application.start(Application.java:90)
   [1] 	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:100)
   [1] 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
   [1] 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
   [1] 	at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
   [1] 	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
   [1] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   [1] 	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   [1] 	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   [1] 	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
   [1] 	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.doRun(QuarkusEntryPoint.java:48)
   [1] 	at io.quarkus.bootstrap.runner.QuarkusEntryPoint.main(QuarkusEntryPoint.java:25)
   ```
   
   All the kamelets of the kamelet-catalog are affected.


-- 
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:
users@infra.apache.org



[GitHub] [camel-k] nicolaferraro commented on issue #2203: Kamelet yaml will be stored with wrong order of fields

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on issue #2203:
URL: https://github.com/apache/camel-k/issues/2203#issuecomment-817869742


   To simplify, it seems that using `parameters` with `to` does not work, so even the following fails:
   
   ```
   - from:
       uri: "timer:tick"
       steps:
       - to:
           uri: "log:info"
           parameters:
             showHeaders: "true"
   ```
   


-- 
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:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli closed issue #2203: Kamelet yaml will be stored with wrong order of fields

Posted by GitBox <gi...@apache.org>.
lburgazzoli closed issue #2203:
URL: https://github.com/apache/camel-k/issues/2203


   


-- 
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:
users@infra.apache.org



[GitHub] [camel-k] lburgazzoli commented on issue #2203: Kamelet yaml will be stored with wrong order of fields

Posted by GitBox <gi...@apache.org>.
lburgazzoli commented on issue #2203:
URL: https://github.com/apache/camel-k/issues/2203#issuecomment-817918856


   on it


-- 
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:
users@infra.apache.org



[GitHub] [camel-k] oscerd commented on issue #2203: Kamelet yaml will be stored with wrong order of fields

Posted by GitBox <gi...@apache.org>.
oscerd commented on issue #2203:
URL: https://github.com/apache/camel-k/issues/2203#issuecomment-817875973


   No, just double checked. This one works with 1.3.2 but not with 1.4.0-SNAPSHOT


-- 
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:
users@infra.apache.org



[GitHub] [camel-k] oscerd commented on issue #2203: Kamelet yaml will be stored with wrong order of fields

Posted by GitBox <gi...@apache.org>.
oscerd commented on issue #2203:
URL: https://github.com/apache/camel-k/issues/2203#issuecomment-817875164


   This seems to work
   
   ```
   - from:
       uri: 'timer:azure-storageope'
       parameters:
         period: '{{period}}'
       steps:
         - choice:
             when:
             - simple: "${header[file]}"
               steps:
               - set-header:
                   name: CamelAzureStorageBlobBlobName
                   simple: "${header[file]}"
             - simple: "${header[ce-file]}"
               steps:
               - set-header:
                   name: CamelAzureStorageBlobBlobName
                   simple: "${header[ce-file]}"
             otherwise:
               steps:
               - set-header:
                   name: CamelAzureStorageBlobBlobName
                   simple: "${exchangeId}"
         - to:
             uri: 'azure-storage-blob://xxx/xxx'
             parameters:
               operation: 'listBlobs'
               accessKey: 'xxxxx'
         - to:
             uri: "log:info"
   ```


-- 
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:
users@infra.apache.org



[GitHub] [camel-k] nicolaferraro commented on issue #2203: Kamelet yaml will be stored with wrong order of fields

Posted by GitBox <gi...@apache.org>.
nicolaferraro commented on issue #2203:
URL: https://github.com/apache/camel-k/issues/2203#issuecomment-817878412


   Opened this in Camel (cc: @lburgazzoli): https://issues.apache.org/jira/browse/CAMEL-16489


-- 
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:
users@infra.apache.org