Hi Roberto,
I think the modeline is meant for CLI only as a way to parse most of the
kamel run options and provide them for you. As stated in the example doc
[1];

$ kamel run Hello.java
Modeline options have been loaded from source files
Full command: kamel run Hello.java --dependency mvn:org.my:application:1.0

It expands the parameters provided in the Integration into a full command.

Regards,

Pasquale.


[1] https://camel.apache.org/camel-k/1.7.x/cli/modeline.html


On Fri, Dec 17, 2021 at 3:52 PM Roberto Camelk <[email protected]>
wrote:

> The YAML below is a snippet of my Integration resource in k8s, got by:
> kubectl get integration <my-integration-name> -o yaml
>
> apiVersion: camel.apache.org/v1
> kind: Integration
> metadata:
>   creationTimestamp: "2021-12-15T11:22:48Z"
>   generation: 1
>   name: micro-profile-metrics2
>   namespace: default
>   resourceVersion: "85599"
>   uid: 40f85faf-d9c6-472c-b10c-2d794e35e015
> spec:
>   dependencies:
>   - camel:cron
>   - camel:microprofile-metrics
>   sources:
>   - content: "//camel-k: dependency=camel-cron\n//camel-k:
> dependency=camel-quarkus-microprofile-metrics\n\nimport
>       org.apache.camel.builder.RouteBuilder;\n\npublic class
> MicroProfileMetrics2
>       extends RouteBuilder {\n\n    @Override\n    public void
> configure() throws
>       Exception
>
> {\n\tfrom(\"cron:tab?schedule=0/15+*+*+*+*+?\")\n\t\t.routeId(\"MicroProfileMetrics2-route-1\")\n\t\t.log(\"Starting
>       MicroProfile
>
> Metrics\")\n\t\t.delay(simple(\"${random(1000,5000)}\"))\n\t\t.choice()\n\t\t\t.when().simple(\"${random(1,10)}
>       < 2\")\n\t\t\t\t.throwException(new
>
> RuntimeException(\"Perdeu\"))\n\t\t\t.otherwise()\n\t\t\t\t.log(\"MicroProfile
>       Metrics sample done!\");\n    }\n\n}\n"
>     name: MicroProfileMetrics2.java
>
>
>
> Note for example the modeline in "source":  //camel-k:
> dependency=camel-quarkus-microprofile-metrics
>
> And note the value in the "dependencies":
> - camel:microprofile-metrics
>
> This is strange... why the dependency isn't
> "camel-quarkus-microprofile-metrics" (containing "quarkus" word) ?
> Is Modeline a specific feature of the CLI? If I submit an Integration
> resource via k8s API without that dependencies field but via modeline,
> will the operator parse the dependencies from source too?
>

Reply via email to