Is there a way to create a Integration using XML by .yaml, without using kamel-client?

334 Views Asked by At

I have a Kubernets ambient with Camel-k operator installed and working correctly and if I use the Kamel-client it works ("kamel run Routes.xml"), but I need to run a XML Route without using the kamel-client.

I found that I can create a .yaml (https://operatorhub.io/operator/camel-k) and use "kubectl apply -f integrationJava.yaml", that would works for me, it a first step before XML, but I'm getting an error.

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  name: example
spec:
  sources:
  - content: |
      import org.apache.camel.builder.RouteBuilder;

      public class Example extends RouteBuilder {
          @Override
          public void configure() throws Exception {
              from("timer:tick")
                  .setBody(constant("Hello World!"))
              .to("log:info?skipBodyLineSeparator=false");
          }
      }
  name: Example.java

Error at the camel-operator pod

12/03/2021 09:57:53 {"level":"error","ts":1615553873.387946,"logger":"controller","msg":"Reconciler error","controller":"integration-controller","name":"javaintegration","namespace":"operator","error":"error executing post actions: error during replace resource: could not create or replace resource javaintegration: Deployment.apps \"javaintegration\" is invalid: [spec.template.spec.volumes[0].configMap.items[0].path: Required value, spec.template.spec.containers[0].volumeMounts[0].name: Not found: \"i-source-000\"]","errorVerbose":"Deployment.apps \"javaintegration\" is invalid: [spec.template.spec.volumes[0].configMap.items[0].path: Required value, spec.template.spec.containers[0].volumeMounts[0].name: Not found: \"i-source-000\"]

It's saying something about volumes/volumeMounts, but i already looked for theses parameters at the crd-integration.yml , and it doesn't have nothing like it.

Or is this some parameters at the camel-operator it self ?

2

There are 2 best solutions below

0
On

You can use the kamel cli to create a xml example

kamel init foo.xml

And then run that integration

kamel run foo.xml

Then you can go into k8s and find the integration CRD and dump it, where you can see the embedded XML route code.

You can then grab this CRD dump (yaml output etc) and use that as template for your own xml routes.

0
On

indentation seems to be wrong, language and content need to be at the same level of name as they are part of the same array element