You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by _ Jane <be...@hotmail.com> on 2024/06/24 08:03:49 UTC

how to set different path for the different Knative endpoint in Camel K

Dear Community,

I want to define 2 routes with Knative endpoint consumer as below:


from("knative:endpoint/test1")
        .routeId("route_inbound_knative1")
        .log("Trigger from test1 endpoint")
        .setBody(constant("Success test1"));

from("knative:endpoint/test2")
        .routeId("route_inbound_knative2")
        .log("Trigger from test2 endpoint")
        .setBody(constant("Success test2"));

After deploy it with "kamel run" command, the auto-generated CAMEL_KNATIVE_CONFIGURATION is as below:

{"services":[{"type":"endpoint","name":"test1","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"serving.knative.dev/v1","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"serving.knative.dev/v1","knative.kind":"Service"}}]}

How can I set different path for these 2 Knative endpoint like "/test1" and "/test2"?

Thanks!


Re: how to set different path for the different Knative endpoint in Camel K

Posted by Pasquale Congiusti <pa...@gmail.com>.
Thanks for testing with latest versions.
Please, open a gtihub issue in the Camel K project repository [1] so we can
triage and possibly fix the problem.

Thanks and regards,
Pasquale.

[1] https://github.com/apache/camel-k

On Wed, Jun 26, 2024 at 7:45 AM _ Jane <be...@hotmail.com> wrote:

> I tested the case on Camel K 2.2 and got the same result.
>
> multiple-endpoint.groovy
> // camel-k: language=groovy
>
> from('knative:endpoint/test1')
>        .log('Trigger from endpoint test1')
>        .setBody().constant('Success test123')
>
> from('knative:endpoint/test2')
>        .log('Trigger from endpoint test2')
>        .setBody().constant('Success test246')
>
> Command:
> $ kamel run --profile Knative multiple-endpoint.groovy
>
> Result:
> CAMEL_KNATIVE_CONFIGURATION:
>
> {"services":[{"type":"endpoint","name":"test1","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> serving.knative.dev/v1
> ","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> serving.knative.dev/v1","knative.kind":"Service"}}]}
>
> My expectation:
> CAMEL_KNATIVE_CONFIGURATION:
>
> {"services":[{"type":"endpoint","name":"test1","path":"/test1","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> serving.knative.dev/v1
> ","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/test2","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> serving.knative.dev/v1","knative.kind":"Service"}}]}
>
> ________________________________
> 发件人: Pasquale Congiusti <pa...@gmail.com>
> 发送时间: 2024年6月25日 17:28
> 收件人: users@camel.apache.org <us...@camel.apache.org>
> 主题: Re: how to set different path for the different Knative endpoint in
> Camel K
>
> Version 1.10 is very old (2 years or the like). We are not supporting since
> long time already.
>
> The suggestion is to move to version 2.3 which is the latest supporting
> Camel LTS. Mind that, although running this Camel K version, you can still
> use any runtime of version 1.x >= 1.17 (which is the default version used
> in Camel K 1.12).
>
> Cheers,
> Pasquale.
>
> On Tue, Jun 25, 2024 at 10:39 AM _ Jane <be...@hotmail.com> wrote:
>
> > Hi Pasquale,
> >
> > Thanks for your reply!
> >
> > I'm using Camel K 1.10. And I hope to find a way to achieve it without
> > upgrading the Camel K version, such as using Camel properties or Camel K
> > trait. I've tried to use below Camel k trait but failed.
> >
> > $ kamel run --name multi-endpoint --profile Knative --trait
> >
> knative.configuration='{"services":[{"type":"endpoint","name":"test1","path":"/test1","metadata"
> > :{"camel.endpoint.kind":"source","knative.apiVersion":"
> > serving.knative.dev/v1
> >
> ","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/test2","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"serving
> > .knative.dev/v1","knative.kind":"Service"}}]}' MultiEndpointRoute.java
> >
> > Error: 1 error(s) decoding:
> >
> > * 'knative.Configuration' expected a map, got 'string'
> >
> > Is there any good idea?
> > ________________________________
> > 发件人: Pasquale Congiusti <pa...@gmail.com>
> > 发送时间: 2024年6月24日 17:30
> > 收件人: users@camel.apache.org <us...@camel.apache.org>
> > 主题: Re: how to set different path for the different Knative endpoint in
> > Camel K
> >
> > Hello there.
> > What version of Camel K are you using? In the most recent versions we
> have
> > changed the way this is configured, and it's possible this issue got
> > solved. Can you try running the same with the latest stable releases?
> >
> > Thanks,
> > Pasquale.
> >
> > On Mon, Jun 24, 2024 at 10:04 AM _ Jane <be...@hotmail.com> wrote:
> >
> > > Dear Community,
> > >
> > > I want to define 2 routes with Knative endpoint consumer as below:
> > >
> > >
> > > from("knative:endpoint/test1")
> > >         .routeId("route_inbound_knative1")
> > >         .log("Trigger from test1 endpoint")
> > >         .setBody(constant("Success test1"));
> > >
> > > from("knative:endpoint/test2")
> > >         .routeId("route_inbound_knative2")
> > >         .log("Trigger from test2 endpoint")
> > >         .setBody(constant("Success test2"));
> > >
> > > After deploy it with "kamel run" command, the auto-generated
> > > CAMEL_KNATIVE_CONFIGURATION is as below:
> > >
> > >
> > >
> >
> {"services":[{"type":"endpoint","name":"test1","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> > > serving.knative.dev/v1
> > >
> >
> ","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> > > serving.knative.dev/v1","knative.kind":"Service"}}]}
> > >
> > > How can I set different path for these 2 Knative endpoint like "/test1"
> > > and "/test2"?
> > >
> > > Thanks!
> > >
> > >
> >
>

回复: how to set different path for the different Knative endpoint in Camel K

Posted by _ Jane <be...@hotmail.com>.
I tested the case on Camel K 2.2 and got the same result.

multiple-endpoint.groovy
// camel-k: language=groovy

from('knative:endpoint/test1')
       .log('Trigger from endpoint test1')
       .setBody().constant('Success test123')

from('knative:endpoint/test2')
       .log('Trigger from endpoint test2')
       .setBody().constant('Success test246')

Command:
$ kamel run --profile Knative multiple-endpoint.groovy

Result:
CAMEL_KNATIVE_CONFIGURATION:
{"services":[{"type":"endpoint","name":"test1","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"serving.knative.dev/v1","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"serving.knative.dev/v1","knative.kind":"Service"}}]}

My expectation:
CAMEL_KNATIVE_CONFIGURATION:
{"services":[{"type":"endpoint","name":"test1","path":"/test1","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"serving.knative.dev/v1","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/test2","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"serving.knative.dev/v1","knative.kind":"Service"}}]}

________________________________
发件人: Pasquale Congiusti <pa...@gmail.com>
发送时间: 2024年6月25日 17:28
收件人: users@camel.apache.org <us...@camel.apache.org>
主题: Re: how to set different path for the different Knative endpoint in Camel K

Version 1.10 is very old (2 years or the like). We are not supporting since
long time already.

The suggestion is to move to version 2.3 which is the latest supporting
Camel LTS. Mind that, although running this Camel K version, you can still
use any runtime of version 1.x >= 1.17 (which is the default version used
in Camel K 1.12).

Cheers,
Pasquale.

On Tue, Jun 25, 2024 at 10:39 AM _ Jane <be...@hotmail.com> wrote:

> Hi Pasquale,
>
> Thanks for your reply!
>
> I'm using Camel K 1.10. And I hope to find a way to achieve it without
> upgrading the Camel K version, such as using Camel properties or Camel K
> trait. I've tried to use below Camel k trait but failed.
>
> $ kamel run --name multi-endpoint --profile Knative --trait
> knative.configuration='{"services":[{"type":"endpoint","name":"test1","path":"/test1","metadata"
> :{"camel.endpoint.kind":"source","knative.apiVersion":"
> serving.knative.dev/v1
> ","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/test2","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"serving
> .knative.dev/v1","knative.kind":"Service"}}]}' MultiEndpointRoute.java
>
> Error: 1 error(s) decoding:
>
> * 'knative.Configuration' expected a map, got 'string'
>
> Is there any good idea?
> ________________________________
> 发件人: Pasquale Congiusti <pa...@gmail.com>
> 发送时间: 2024年6月24日 17:30
> 收件人: users@camel.apache.org <us...@camel.apache.org>
> 主题: Re: how to set different path for the different Knative endpoint in
> Camel K
>
> Hello there.
> What version of Camel K are you using? In the most recent versions we have
> changed the way this is configured, and it's possible this issue got
> solved. Can you try running the same with the latest stable releases?
>
> Thanks,
> Pasquale.
>
> On Mon, Jun 24, 2024 at 10:04 AM _ Jane <be...@hotmail.com> wrote:
>
> > Dear Community,
> >
> > I want to define 2 routes with Knative endpoint consumer as below:
> >
> >
> > from("knative:endpoint/test1")
> >         .routeId("route_inbound_knative1")
> >         .log("Trigger from test1 endpoint")
> >         .setBody(constant("Success test1"));
> >
> > from("knative:endpoint/test2")
> >         .routeId("route_inbound_knative2")
> >         .log("Trigger from test2 endpoint")
> >         .setBody(constant("Success test2"));
> >
> > After deploy it with "kamel run" command, the auto-generated
> > CAMEL_KNATIVE_CONFIGURATION is as below:
> >
> >
> >
> {"services":[{"type":"endpoint","name":"test1","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> > serving.knative.dev/v1
> >
> ","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> > serving.knative.dev/v1","knative.kind":"Service"}}]}
> >
> > How can I set different path for these 2 Knative endpoint like "/test1"
> > and "/test2"?
> >
> > Thanks!
> >
> >
>

Re: how to set different path for the different Knative endpoint in Camel K

Posted by Pasquale Congiusti <pa...@gmail.com>.
Version 1.10 is very old (2 years or the like). We are not supporting since
long time already.

The suggestion is to move to version 2.3 which is the latest supporting
Camel LTS. Mind that, although running this Camel K version, you can still
use any runtime of version 1.x >= 1.17 (which is the default version used
in Camel K 1.12).

Cheers,
Pasquale.

On Tue, Jun 25, 2024 at 10:39 AM _ Jane <be...@hotmail.com> wrote:

> Hi Pasquale,
>
> Thanks for your reply!
>
> I'm using Camel K 1.10. And I hope to find a way to achieve it without
> upgrading the Camel K version, such as using Camel properties or Camel K
> trait. I've tried to use below Camel k trait but failed.
>
> $ kamel run --name multi-endpoint --profile Knative --trait
> knative.configuration='{"services":[{"type":"endpoint","name":"test1","path":"/test1","metadata"
> :{"camel.endpoint.kind":"source","knative.apiVersion":"
> serving.knative.dev/v1
> ","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/test2","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"serving
> .knative.dev/v1","knative.kind":"Service"}}]}' MultiEndpointRoute.java
>
> Error: 1 error(s) decoding:
>
> * 'knative.Configuration' expected a map, got 'string'
>
> Is there any good idea?
> ________________________________
> 发件人: Pasquale Congiusti <pa...@gmail.com>
> 发送时间: 2024年6月24日 17:30
> 收件人: users@camel.apache.org <us...@camel.apache.org>
> 主题: Re: how to set different path for the different Knative endpoint in
> Camel K
>
> Hello there.
> What version of Camel K are you using? In the most recent versions we have
> changed the way this is configured, and it's possible this issue got
> solved. Can you try running the same with the latest stable releases?
>
> Thanks,
> Pasquale.
>
> On Mon, Jun 24, 2024 at 10:04 AM _ Jane <be...@hotmail.com> wrote:
>
> > Dear Community,
> >
> > I want to define 2 routes with Knative endpoint consumer as below:
> >
> >
> > from("knative:endpoint/test1")
> >         .routeId("route_inbound_knative1")
> >         .log("Trigger from test1 endpoint")
> >         .setBody(constant("Success test1"));
> >
> > from("knative:endpoint/test2")
> >         .routeId("route_inbound_knative2")
> >         .log("Trigger from test2 endpoint")
> >         .setBody(constant("Success test2"));
> >
> > After deploy it with "kamel run" command, the auto-generated
> > CAMEL_KNATIVE_CONFIGURATION is as below:
> >
> >
> >
> {"services":[{"type":"endpoint","name":"test1","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> > serving.knative.dev/v1
> >
> ","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> > serving.knative.dev/v1","knative.kind":"Service"}}]}
> >
> > How can I set different path for these 2 Knative endpoint like "/test1"
> > and "/test2"?
> >
> > Thanks!
> >
> >
>

回复: how to set different path for the different Knative endpoint in Camel K

Posted by _ Jane <be...@hotmail.com>.
Hi Pasquale,

Thanks for your reply!

I'm using Camel K 1.10. And I hope to find a way to achieve it without upgrading the Camel K version, such as using Camel properties or Camel K trait. I've tried to use below Camel k trait but failed.

$ kamel run --name multi-endpoint --profile Knative --trait knative.configuration='{"services":[{"type":"endpoint","name":"test1","path":"/test1","metadata"
:{"camel.endpoint.kind":"source","knative.apiVersion":"serving.knative.dev/v1","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/test2","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"serving
.knative.dev/v1","knative.kind":"Service"}}]}' MultiEndpointRoute.java

Error: 1 error(s) decoding:

* 'knative.Configuration' expected a map, got 'string'

Is there any good idea?
________________________________
发件人: Pasquale Congiusti <pa...@gmail.com>
发送时间: 2024年6月24日 17:30
收件人: users@camel.apache.org <us...@camel.apache.org>
主题: Re: how to set different path for the different Knative endpoint in Camel K

Hello there.
What version of Camel K are you using? In the most recent versions we have
changed the way this is configured, and it's possible this issue got
solved. Can you try running the same with the latest stable releases?

Thanks,
Pasquale.

On Mon, Jun 24, 2024 at 10:04 AM _ Jane <be...@hotmail.com> wrote:

> Dear Community,
>
> I want to define 2 routes with Knative endpoint consumer as below:
>
>
> from("knative:endpoint/test1")
>         .routeId("route_inbound_knative1")
>         .log("Trigger from test1 endpoint")
>         .setBody(constant("Success test1"));
>
> from("knative:endpoint/test2")
>         .routeId("route_inbound_knative2")
>         .log("Trigger from test2 endpoint")
>         .setBody(constant("Success test2"));
>
> After deploy it with "kamel run" command, the auto-generated
> CAMEL_KNATIVE_CONFIGURATION is as below:
>
>
> {"services":[{"type":"endpoint","name":"test1","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> serving.knative.dev/v1
> ","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> serving.knative.dev/v1","knative.kind":"Service"}}]}
>
> How can I set different path for these 2 Knative endpoint like "/test1"
> and "/test2"?
>
> Thanks!
>
>

Re: how to set different path for the different Knative endpoint in Camel K

Posted by Pasquale Congiusti <pa...@gmail.com>.
Hello there.
What version of Camel K are you using? In the most recent versions we have
changed the way this is configured, and it's possible this issue got
solved. Can you try running the same with the latest stable releases?

Thanks,
Pasquale.

On Mon, Jun 24, 2024 at 10:04 AM _ Jane <be...@hotmail.com> wrote:

> Dear Community,
>
> I want to define 2 routes with Knative endpoint consumer as below:
>
>
> from("knative:endpoint/test1")
>         .routeId("route_inbound_knative1")
>         .log("Trigger from test1 endpoint")
>         .setBody(constant("Success test1"));
>
> from("knative:endpoint/test2")
>         .routeId("route_inbound_knative2")
>         .log("Trigger from test2 endpoint")
>         .setBody(constant("Success test2"));
>
> After deploy it with "kamel run" command, the auto-generated
> CAMEL_KNATIVE_CONFIGURATION is as below:
>
>
> {"services":[{"type":"endpoint","name":"test1","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> serving.knative.dev/v1
> ","knative.kind":"Service"}},{"type":"endpoint","name":"test2","path":"/","metadata":{"camel.endpoint.kind":"source","knative.apiVersion":"
> serving.knative.dev/v1","knative.kind":"Service"}}]}
>
> How can I set different path for these 2 Knative endpoint like "/test1"
> and "/test2"?
>
> Thanks!
>
>