Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use Kamelets from Integration yaml resources #1882

Closed
lancerdima opened this issue Jan 6, 2021 · 4 comments · Fixed by apache/camel-k-runtime#583
Closed

Can't use Kamelets from Integration yaml resources #1882

lancerdima opened this issue Jan 6, 2021 · 4 comments · Fixed by apache/camel-k-runtime#583
Labels
kind/bug Something isn't working
Milestone

Comments

@lancerdima
Copy link

Using code from documentation as a guiding point (https://camel.apache.org/camel-k/latest/architecture/sources.html).

I create integration as k8s yaml resources and run it directly by applying to k8s cluster, without the help of kamel CLI.
I want to use kamelets to enable reuse of my connectivity points.
Integration fails to start, due to error: unable to find an EndpointUriFactory for scheme kamelet
k8s cluster (local docker desktop) has v1.3 camelK runtime.

kamelet.yaml

apiVersion: camel.apache.org/v1alpha1
kind: Kamelet
metadata:
  name: timer-source
  labels:
    camel.apache.org/kamelet.type: "source"
spec:
  definition:
    title: "Timer"
    description: "Produces periodic events with a custom payload"
    required:
      - message
    properties:
      payload:
        title: Payload
        description: The message to generate as payload of each Cloudevent
        type: string

  types:
    out:
      mediaType: text/plain

  flow:
    from:
      uri: timer:kameletTimer
      parameters:
        fixedRate: true
        period: 1000
      steps:
        - log: "{{message}}"
        - to: "kamelet:sink"

integration.yaml

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  name: timer-integration
spec:
  flows:
    - from:
        uri: kamelet:timer-source
        parameters:
          payload: "Hello World"
        steps:
          - log: "${body}"

Integration fails to start with error:

2021-01-06 15:25:49,298 ERROR [org.apa.cam.qua.mai.CamelMainRuntime] (main) Failed to start application: java.lang.IllegalArgumentException: Cannot compute endpoint URI: unable to find an EndpointUriFactory for scheme kamelet
	at org.apache.camel.k.loader.yaml.support.StepParserSupport.getEndpointUriFactory(StepParserSupport.java:121)
	at org.apache.camel.k.loader.yaml.support.StepParserSupport.createEndpointUri(StepParserSupport.java:84)
	at org.apache.camel.k.loader.yaml.parser.FromStepParser.process(FromStepParser.java:39)
	at org.apache.camel.k.loader.yaml.spi.StartStepParser.invoke(StartStepParser.java:28)
	at org.apache.camel.k.loader.yaml.YamlSourceLoader$1.accept(YamlSourceLoader.java:80)
	at org.apache.camel.k.loader.yaml.YamlSourceLoader$1.accept(YamlSourceLoader.java:76)
	at org.apache.camel.k.support.RouteBuilders$3.configure(RouteBuilders.java:57)
	at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:483)
	at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:430)
	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:405)
	at org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1110)
	at org.apache.camel.main.RoutesConfigurer.configureRoutes(RoutesConfigurer.java:94)
	at org.apache.camel.main.BaseMainSupport.configureRoutes(BaseMainSupport.java:454)
	at org.apache.camel.main.BaseMainSupport.postProcessCamelContext(BaseMainSupport.java:474)
	at org.apache.camel.quarkus.main.CamelMain.initCamelContext(CamelMain.java:97)
	at org.apache.camel.quarkus.main.CamelMain.doInit(CamelMain.java:67)
	at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
	at org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:118)
	at org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
	at org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:45)
	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy_0(CamelBootstrapProcessor$boot-173480958.zig:101)
	at io.quarkus.deployment.steps.CamelBootstrapProcessor$boot-173480958.deploy(CamelBootstrapProcessor$boot-173480958.zig:40)
	at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:534)
	at io.quarkus.runtime.Application.start(Application.java:90)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:97)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:62)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:38)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:104)
	at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)
@squakez
Copy link
Contributor

squakez commented Jan 7, 2021

Hi there, what camel k operator version are you using? Kamelets were introduced starting version 1.2, is your operator up to date?

@lancerdima
Copy link
Author

It's 1.3 (image: docker.io/apache/camel-k:1.3.0)

@squakez
Copy link
Contributor

squakez commented Jan 8, 2021

I've run some test and it seems to be a possible bug in the yaml loader. The issue is appearing also when a yaml integration is run via kamel. As an example, given the kamelet mentioned above and the test.yaml file with content:

- from:
    uri: "kamelet:timer-source"
    parameters:
      payload: "Hello World"
      message: "Hello World"
    steps:
      - log: "${body}"

Running kamel run test.yaml would produce the same result.

@squakez
Copy link
Contributor

squakez commented Jan 20, 2021

While having a patch release, as a workaround, we can omit parameters and put them as query parameters such as:

- from:
    uri: "kamelet:timer-source?payload=Hello%20World&message=Hello%20World"
    steps:
      - log: "${body}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants