apache / camel-k

Apache Camel K is a lightweight integration platform, born on Kubernetes, with serverless superpowers
https://camel.apache.org/camel-k
Apache License 2.0
848 stars 345 forks source link

kamel run with reference to an existing Integration Kit in another namespace #3059

Open catshout opened 2 years ago

catshout commented 2 years ago

I'm going to run an Integration with a reference to an existing Integration Kit.

kamel run -t prometheus.enabled=true -k basic Hello.java -n integration-dev

When I'm using the -o yaml > Hello.yaml option I'm getting

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  creationTimestamp: null
  name: hello
  namespace: integration-dev
spec:
  integrationKit:
    name: basic
    namespace: integration-dev
  sources:
  - content: "// camel-k: language=java\n\npackage de.casag.hello.route;\n\nimport
      org.apache.camel.builder.RouteBuilder;\n\npublic class Hello extends RouteBuilder{\n\n\tpublic
      void configure() throws Exception {\n\n\t\tfrom(\"timer:enforedeinvoices?period=3600000&delay=0\")\n\t\t\t\t.log(\"Hello
      World!\")\n\t\t;\n\n\t}\n}\n\n"
    name: Hello.java
  traits:
    prometheus:
      configuration:
        enabled: true
status: {}

The Integration should be deployed in the namespace integration-dev. The Integration Kit being referenced is located in the namespace camel-k.

I can change this in the YAML file like

apiVersion: camel.apache.org/v1
kind: Integration
metadata:
  creationTimestamp: null
  name: hello
  namespace: integration-dev
spec:
  integrationKit:
    name: basic
    namespace: camel-k
  sources:
  - content: "// camel-k: language=java\n\npackage de.casag.hello.route;\n\nimport
      org.apache.camel.builder.RouteBuilder;\n\npublic class Hello extends RouteBuilder{\n\n\tpublic
      void configure() throws Exception {\n\n\t\tfrom(\"timer:enforedeinvoices?period=3600000&delay=0\")\n\t\t\t\t.log(\"Hello
      World!\")\n\t\t;\n\n\t}\n}\n\n"
    name: Hello.java
  traits:
    prometheus:
      configuration:
        enabled: true
status: {}

and deploy afterwards with

kubectl apply -f Hello.yaml

The Integration works event with the reference to an Integration Kit in another namespace.

Is there a way to address the different namespace in the kamel run -k <IntegrationKit> CLI part?

Best Gerald

squakez commented 2 years ago

No we have nothing like that. Maybe we could think to introduce a syntax such as namespace/kit.

catshout commented 2 years ago

Thanks @squakez. Could you than turn this into a feature request please?

squakez commented 2 years ago

Let's wait for others input. I have no strong opinion about the possibility to use cross namespace references, but others may have concerns about that.

astefanutti commented 2 years ago

Cross-namespace IntegrationKit references are already supported in the Integration type, so that seems like a reasonable request to surface it into the CLI.

catshout commented 2 years ago

Thanks a lot. The point is when the Operator has been installed with the --global option, let's say in namespace camel-k and we're going to create an integration in an other namespace, let's say integration-dev, the Integration Kit will be created in namespace camel-k.

astefanutti commented 2 years ago

Thanks a lot. The point is when the Operator has been installed with the --global option, let's say in namespace camel-k and we're going to create an integration in an other namespace, let's say integration-dev, the Integration Kit will be created in namespace camel-k.

Right, this primarily applies when the operator has been installed with the global option.

catshout commented 2 years ago

Could this be turned into a feature request @squakez? Many thanks in advance.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale due to 90 days of inactivity. It will be closed if no further activity occurs within 15 days. If you think that’s incorrect or the issue should never stale, please simply write any comment. Thanks for your contributions!