This is an automated email from the ASF dual-hosted git repository. pcongiusti pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k-examples.git
commit dc5382d984468dc11e501507f40bb0144b1e4b73 Author: Thomas Diesler <[email protected]> AuthorDate: Wed May 22 17:37:33 2024 +0200 (#56) Update generic - basic usage examples --- generic-examples/README.md | 72 ++++++------ generic-examples/cron/README.md | 40 ++----- generic-examples/cron/cron.groovy | 22 ---- generic-examples/cron/cron.yaml | 25 ++++ generic-examples/env/README.md | 2 +- generic-examples/jitpack/README.md | 6 +- generic-examples/modeline/README.md | 20 +++- generic-examples/modeline/SampleModeline.java | 4 +- .../modeline-build-property-file-route.groovy | 31 ----- .../modeline-build-property-file-route.yaml | 27 +++++ .../modeline/modeline-build-property-route.groovy | 31 ----- .../modeline/modeline-build-property-route.yaml | 27 +++++ .../modeline/modeline-config-file-route.groovy | 30 ----- .../modeline/modeline-config-file-route.yaml | 29 +++++ .../modeline/modeline-config-secret-route.groovy | 32 ------ .../modeline/modeline-config-secret-route.yaml | 30 +++++ .../modeline/modeline-property-file-route.groovy | 29 ----- .../modeline/modeline-property-file-route.yaml | 27 +++++ .../modeline/modeline-property-route.groovy | 29 ----- .../modeline/modeline-property-route.yaml | 27 +++++ .../modeline/modeline-resource-file-route.groovy | 27 ----- .../modeline/modeline-resource-file-route.yaml | 27 +++++ generic-examples/modeline/my.properties | 2 + generic-examples/openapi/README.md | 20 +++- generic-examples/openapi/greetings.groovy | 27 ----- generic-examples/openapi/greetings.yaml | 25 ++++ generic-examples/openapi/petstore-api.yaml | 128 --------------------- generic-examples/openapi/petstore.groovy | 31 ----- generic-examples/processor/README.md | 10 +- generic-examples/processor/kotlin-routes.kts | 6 - generic-examples/processor/routes.groovy | 22 +--- generic-examples/processor/routes.js | 14 +-- generic-examples/rest/README.md | 35 +++++- generic-examples/rest/RestDSL.java | 5 - .../rest/{routes-rest.js => rest-dsl.js} | 13 +-- generic-examples/user-config/README.md | 73 ++++++++---- .../user-config/build-property-file-route.groovy | 29 ----- .../user-config/build-property-file-route.yaml | 25 ++++ .../user-config/build-property-route.groovy | 29 ----- .../user-config/build-property-route.yaml | 25 ++++ .../user-config/config-configmap-route.groovy | 30 ----- .../user-config/config-configmap-route.yaml | 27 +++++ .../user-config/config-file-route.groovy | 28 ----- .../user-config/config-file-route.yaml | 27 +++++ .../user-config/config-secret-key-route.groovy | 30 ----- .../user-config/config-secret-key-route.yaml | 27 +++++ .../config-secret-property-route.groovy | 28 ----- .../user-config/config-secret-property-route.yaml | 25 ++++ .../user-config/config-secret-route.groovy | 30 ----- .../user-config/config-secret-route.yaml | 28 +++++ .../user-config/property-file-route.groovy | 27 ----- .../user-config/property-file-route.yaml | 25 ++++ generic-examples/user-config/property-route.groovy | 27 ----- generic-examples/user-config/property-route.yaml | 25 ++++ .../resource-configmap-key-location-route.groovy | 27 ----- .../resource-configmap-key-location-route.yaml | 25 ++++ .../resource-configmap-location-route.groovy | 27 ----- .../resource-configmap-location-route.yaml | 25 ++++ .../user-config/resource-configmap-route.groovy | 27 ----- .../user-config/resource-configmap-route.yaml | 25 ++++ .../resource-file-base64-encoded-route.groovy | 28 ----- .../user-config/resource-file-binary-route.groovy | 27 ----- .../user-config/resource-file-binary-route.yaml | 27 +++++ .../resource-file-location-route.groovy | 25 ---- .../user-config/resource-file-location-route.yaml | 25 ++++ .../user-config/resource-file-route.groovy | 25 ---- .../user-config/resource-file-route.yaml | 25 ++++ .../resource-secret-location-route.groovy | 27 ----- .../resource-secret-location-route.yaml | 25 ++++ .../user-config/resource-secret-route.groovy | 27 ----- .../user-config/resource-secret-route.yaml | 25 ++++ generic-examples/volumes/README.md | 8 ++ generic-examples/volumes/pvc-consumer.groovy | 30 ----- generic-examples/volumes/pvc-consumer.yaml | 25 ++++ generic-examples/volumes/pvc-producer.groovy | 33 ------ generic-examples/volumes/pvc-producer.yaml | 26 +++++ 76 files changed, 931 insertions(+), 1130 deletions(-) diff --git a/generic-examples/README.md b/generic-examples/README.md index ab70585..77b4c15 100644 --- a/generic-examples/README.md +++ b/generic-examples/README.md @@ -6,54 +6,54 @@ This folder contains various examples of `Camel K` integrations. You can use the In this section you will find the most basic examples. Useful to start learning about Camel K and how to run. You can use many supported languages and learn about the most basic features: -| Type | Description | Link | -|---|---|---| -| Languages | Simple integrations developed in various supported languages | [see examples](./languages/)| -| Env | Set and use env variables in an integration | [see examples](./env/)| -| Cron | How to create a `cron` integration | [see examples](./cron/)| -| User Config | Explore how to include a `property`, `secret`, `configmap` or file `resource` in your integration | [see examples](./user-config/)| -| User Dependencies | Explore how to include a local dependency in your integration with Jitpack | [see examples](./jitpack/)| -| Processor | Show how to include `Processor`s logic | [see examples](./processor/)| -| Open API | `Open API` support | [see examples](./openapi/)| -| Rest | Produce/Consume `REST`ful services | [see examples](./rest/)| -| Modeline | [Camel K modeline support](https://camel.apache.org/camel-k/latest/cli/modeline.html) | [see examples](./modeline/)| -| Volumes | Produce/Consume files attached to a `PVC` | [see examples](./volumes/)| +| Type | Description | Link | +|-------------------|---------------------------------------------------------------------------------------------------|--------------------------------| +| Languages | Simple integrations developed in various supported languages | [see examples](./languages/) | +| Env | Set and use env variables in an integration | [see examples](./env/) | +| Cron | How to create a `cron` integration | [see examples](./cron/) | +| User Config | Explore how to include a `property`, `secret`, `configmap` or file `resource` in your integration | [see examples](./user-config/) | +| User Dependencies | Explore how to include a local dependency in your integration with Jitpack | [see examples](./jitpack/) | +| Processor | Show how to include `Processor`s logic | [see examples](./processor/) | +| Open API | `Open API` support | [see examples](./openapi/) | +| Rest | Produce/Consume `REST`ful services | [see examples](./rest/) | +| Modeline | [Camel K modeline support](https://camel.apache.org/camel-k/latest/cli/modeline.html) | [see examples](./modeline/) | +| Volumes | Produce/Consume files attached to a `PVC` | [see examples](./volumes/) | ## Component usage examples In this section you can find a few examples of certain [`Camel` components](https://camel.apache.org/components/latest/index.html). This is a limited number of the wide variety of components supported by Apache Camel. You can also find useful examples [in this repository](https://github.com/apache/camel-k-examples). -| Type | Description | Link | -|---|---|---| -| AMQP | Component usage | [see examples](./amqp/)| -| Caffeine | Component usage | [see examples](./caffeine/)| -| Databases | Component usage | [see examples](./databases/)| -| DNS | Component usage | [see examples](./dns/)| -| HTTP/HTTPS | Component usage | [see examples](./http/)| -| Kafka | Component usage | [see examples](./kafka/)| -| Knative | Component usage | [see examples](./knative/)| +| Type | Description | Link | +|------------|-----------------|------------------------------| +| AMQP | Component usage | [see examples](./amqp/) | +| Caffeine | Component usage | [see examples](./caffeine/) | +| Databases | Component usage | [see examples](./databases/) | +| DNS | Component usage | [see examples](./dns/) | +| HTTP/HTTPS | Component usage | [see examples](./http/) | +| Kafka | Component usage | [see examples](./kafka/) | +| Knative | Component usage | [see examples](./knative/) | ## Advanced usage examples As soon as you will learn the basic stuff, you will like to try the new advanced feature offered by Camel K. Here a few examples: -| Type | Description | Link | -|---|---|---| -| Kamelets | How to use [`Kamelet`s](https://camel.apache.org/camel-k/latest/kamelets/kamelets.html) | [see examples](./kamelets/)| -| Master | Master support example | [see examples](./master/)| -| OLM | OPERATOR Lifecycle manager installation example | [see examples](./olm/)| -| Polyglot | Polyglot integration examples | [see examples](./polyglot/)| -| Pulsar | Pulsar usage | [see examples](./pulsar/)| -| Saga | Saga pattern example | [see examples](./saga/)| -| Tekton | Tekton tutorial | [see examples](./tekton/)| +| Type | Description | Link | +|----------|-----------------------------------------------------------------------------------------|-----------------------------| +| Kamelets | How to use [`Kamelet`s](https://camel.apache.org/camel-k/latest/kamelets/kamelets.html) | [see examples](./kamelets/) | +| Master | Master support example | [see examples](./master/) | +| OLM | OPERATOR Lifecycle manager installation example | [see examples](./olm/) | +| Polyglot | Polyglot integration examples | [see examples](./polyglot/) | +| Pulsar | Pulsar usage | [see examples](./pulsar/) | +| Saga | Saga pattern example | [see examples](./saga/) | +| Tekton | Tekton tutorial | [see examples](./tekton/) | ## Traits usage examples Traits configuration will be very helpful to fine tune your `Integration`. Here a few examples: -| Type | Description | Link | -|---|---|---| -| Container | How to customize with `container` trait| [see examples](./traits/container/)| -| Health | How to customize with `health` trait| [see examples](./traits/health/)| -| JVM | How to use `jvm` trait| [see examples](./traits/jvm/)| -| Tracing (opentracing) | How to use `tracing` trait| [see examples](./traits/tracing/)| \ No newline at end of file +| Type | Description | Link | +|-----------------------|-----------------------------------------|-------------------------------------| +| Container | How to customize with `container` trait | [see examples](./traits/container/) | +| Health | How to customize with `health` trait | [see examples](./traits/health/) | +| JVM | How to use `jvm` trait | [see examples](./traits/jvm/) | +| Tracing (opentracing) | How to use `tracing` trait | [see examples](./traits/tracing/) | \ No newline at end of file diff --git a/generic-examples/cron/README.md b/generic-examples/cron/README.md index f2dd1fb..f3d1fea 100644 --- a/generic-examples/cron/README.md +++ b/generic-examples/cron/README.md @@ -4,7 +4,6 @@ This example demonstrates how you can create cron routes in Camel K. You can find more information about Apache Camel and Apache Camel K on the [official Camel website](https://camel.apache.org). - ## Requirements for running this example **Kubectl CLI** @@ -16,19 +15,10 @@ You need to connect to a Kubernetes cluster in order to run the example. **Apache Camel K CLI ("kamel")** You need the Apache Camel K CLI ("kamel") in order to access all Camel K features. -### Optional Requirements - -The following requirements are optional. They don't prevent the execution of the demo, but may make it easier to follow. - -**VS Code Extension Pack for Apache Camel** -The [VS Code Extension Pack for Apache Camel](https://marketplace.visualstudio.com/items?itemName=redhat.apache-camel-extension-pack) provides a collection of useful tools for Apache Camel K developers, -such as code completion and integrated lifecycle management. They are **recommended** for the tutorial, but they are **not** -required. -You can install it from the VS Code Extensions marketplace. - ## Preparing the cluster + In order to follow this example: -- Create a namespace called `camel-cron` and set that namespace as default. +- Create a namespace called `kubectl create ns camel-cron` and set that namespace as default `kubectl config set-context --current --namespace=camel-cron`. - Install the Camel K operator in that namespace. In most cases, running `kamel install` should be enough. If not, you can read the [installation instructions for your specific cluster here](https://camel.apache.org/camel-k/latest/installation/installation.html). ## Understanding the Example @@ -43,19 +33,10 @@ This example is a Camel K integration that is scheduled to run periodically, pri Use the following command to run it: ``` -kamel run cron.groovy -``` - -The build phase may take some seconds to complete. When it finishes, if everything is okay, the integration should be running periodically every minute. \ -To view the logs of the running integration, run the command: - -``` -kamel log cron +kamel run --dev cron.yaml ``` -You should see the Camel K integration start, print "Hello Camel K using CronJob" and shutdown periodically every minute in the terminal window. - -You can terminate the log stream with `Ctrl+C` +The build phase may take some seconds to complete. When it finishes, if everything is okay, the integration should be running periodically every minute. To confirm that the integration is being run as a Kubernetes Cronjob, run: @@ -74,15 +55,10 @@ Hit `Ctrl+C` to exit ## Modifying the Cron expression -Run the integration in "dev mode" in order to see the logs in the terminal: -``` -kamel run cron.groovy --dev -``` - Since the integration is running in dev mode, you can change the integration code and Camel K will redeploy the changes automatically. Change the cron expression: \ -[open the `cron.groovy` file](./cron.groovy) +[open the `cron.yaml` file](./cron.yaml) and change the first endpoint from `cron:tab?schedule=*+*+*+*+?` to `cron:tab?schedule=*/2+*+*+*+?`, then save the file. You should see the new integration starting up in the terminal window and replacing the old one. @@ -90,7 +66,7 @@ It should print "Hello Camel K using CronJob" once every 2 minutes in the termin **Note:** *Cron only allows for a minimum of 1 minute apart between jobs* Change the cron expression again: \ -[open the `cron.groovy` file](./cron.groovy) +[open the `cron.yaml` file](./cron.yaml) and change the first endpoint to `cron:tab?schedule=*/3+*+*+*+?`, then save the file. Now, after a few seconds, it should print "Hello Camel K using CronJob" once every 3 minutes in the terminal. @@ -99,7 +75,9 @@ Hit `Ctrl+C` to exit dev mode and terminate execution ## Uninstall -To cleanup everything, execute the following command: +To clean up everything, execute the following command: + ``` +kubectl config set-context --current --namespace=default kubectl delete namespace camel-cron ``` \ No newline at end of file diff --git a/generic-examples/cron/cron.groovy b/generic-examples/cron/cron.groovy deleted file mode 100644 index 717683f..0000000 --- a/generic-examples/cron/cron.groovy +++ /dev/null @@ -1,22 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -from('cron:tab?schedule=*+*+*+*+?') // once every minute - .setBody() - .simple('Hello Camel K using CronJob') - .to('log:info?showAll=false') diff --git a/generic-examples/cron/cron.yaml b/generic-examples/cron/cron.yaml new file mode 100644 index 0000000..5026aa1 --- /dev/null +++ b/generic-examples/cron/cron.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "cron:tab?schedule=*+*+*+*+?" + steps: + - setBody: + simple: "Hello Camel K using CronJob" + - to: "log:info?showAll=false" diff --git a/generic-examples/env/README.md b/generic-examples/env/README.md index 7621e62..e8139cf 100644 --- a/generic-examples/env/README.md +++ b/generic-examples/env/README.md @@ -19,6 +19,6 @@ cluster before starting the example. To both set the `MY_ENV_VAR` env variable to `hello world` and run the integration, execute the following: ``` -kamel run --env MY_ENV_VAR="hello world" Env.java --dev +kamel run --dev --env MY_ENV_VAR="hello world" Env.java ``` You should see `hello world` logged to the terminal every second \ No newline at end of file diff --git a/generic-examples/jitpack/README.md b/generic-examples/jitpack/README.md index 2a0be05..a6aa7e5 100644 --- a/generic-examples/jitpack/README.md +++ b/generic-examples/jitpack/README.md @@ -41,7 +41,7 @@ Once done, you just reference the project (dependency) in `kamel run -d` option, You can choose to use the default dependency without specifying a tag or branch. That will fetch the source code on `main` branch: ``` -kamel run Jitpack.java --dev -d github:squakez/samplejp +kamel run --dev -d github:squakez/samplejp Jitpack.java ``` Running the above command, should log `HELLO` to the terminal every 2 seconds: ``` @@ -54,7 +54,7 @@ Running the above command, should log `HELLO` to the terminal every 2 seconds: You can choose to compile the source code stored on a given branch, ie, on `1.0.0` branch: ``` -kamel run Jitpack.java --dev -d github:squakez/samplejp:1.0.0-SNAPSHOT +kamel run --dev -d github:squakez/samplejp:1.0.0-SNAPSHOT Jitpack.java ``` Executing the above command, should log `v1.0.0-SNAPSHOT:HELLO` to the terminal every 2 seconds: @@ -67,7 +67,7 @@ Executing the above command, should log `v1.0.0-SNAPSHOT:HELLO` to the terminal You can also choose to package the source code released with a `tag`, ie `v1.0`: ``` -kamel run Jitpack.java --dev -d github:squakez/samplejp:v1.0 +kamel run --dev -d github:squakez/samplejp:v1.0 Jitpack.java ``` Running the command above should log `v1.0.0:HELLO` to the terminal every 2 seconds: ``` diff --git a/generic-examples/modeline/README.md b/generic-examples/modeline/README.md index 922833a..561fb8e 100644 --- a/generic-examples/modeline/README.md +++ b/generic-examples/modeline/README.md @@ -1,3 +1,21 @@ # Modeline Camel K examples -Find useful examples about how to use Modeline in a Camel K integration. \ No newline at end of file +Find useful examples about how to use Modeline in a Camel K integration. + +``` +kamel run --dev modeline-build-property-route.yaml + +kamel run --dev modeline-build-property-file-route.yaml + +kamel run --dev modeline-property-route.yaml + +kamel run --dev modeline-property-file-route.yaml + +kubectl create secret generic my-sec --from-literal=my-secret-key="very top secret" +kamel run --dev modeline-config-secret-route.yaml + +kubectl create configmap my-cm-file --from-file=resources-data.txt +kamel run --dev modeline-config-file-route.yaml + +kamel run --dev modeline-resource-file-route.yaml +``` \ No newline at end of file diff --git a/generic-examples/modeline/SampleModeline.java b/generic-examples/modeline/SampleModeline.java index 31ff1b6..f834a75 100644 --- a/generic-examples/modeline/SampleModeline.java +++ b/generic-examples/modeline/SampleModeline.java @@ -1,4 +1,4 @@ -// camel-k: dependency=mvn:com.google.guava:guava:28.0-jre +// camel-k: language=java /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -17,6 +17,8 @@ * limitations under the License. */ +// camel-k: dependency=mvn:com.google.guava:guava:28.0-jre + import org.apache.camel.builder.RouteBuilder; public class SampleModeline extends RouteBuilder { diff --git a/generic-examples/modeline/modeline-build-property-file-route.groovy b/generic-examples/modeline/modeline-build-property-file-route.groovy deleted file mode 100644 index 6892235..0000000 --- a/generic-examples/modeline/modeline-build-property-file-route.groovy +++ /dev/null @@ -1,31 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// Provide a build time configuration property file -// -// To run this integrations use: -// -// kamel run modeline-build-property-file-route.groovy --dev -// - -// camel-k: build-property=file:quarkus.properties - -from('timer:build-property') - .routeId('build-property') - .log('The application name: {{quarkus.application.name}}') diff --git a/generic-examples/modeline/modeline-build-property-file-route.yaml b/generic-examples/modeline/modeline-build-property-file-route.yaml new file mode 100644 index 0000000..97dea8b --- /dev/null +++ b/generic-examples/modeline/modeline-build-property-file-route.yaml @@ -0,0 +1,27 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +# camel-k: build-property=file:quarkus.properties + +- from: + uri: "timer:build-property" + steps: + - setBody: + simple: "The application name: {{quarkus.application.name}}" + - to: "log:info" diff --git a/generic-examples/modeline/modeline-build-property-route.groovy b/generic-examples/modeline/modeline-build-property-route.groovy deleted file mode 100644 index 749ad76..0000000 --- a/generic-examples/modeline/modeline-build-property-route.groovy +++ /dev/null @@ -1,31 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// Provide a build time configuration property (the application name) -// -// To run this integrations use: -// -// kamel run modeline-build-property-route.groovy --dev -// - -// camel-k: build-property=quarkus.application.name=my-super-application - -from('timer:build-property') - .routeId('build-property') - .log('The application name: {{quarkus.application.name}}') diff --git a/generic-examples/modeline/modeline-build-property-route.yaml b/generic-examples/modeline/modeline-build-property-route.yaml new file mode 100644 index 0000000..2cd6c0b --- /dev/null +++ b/generic-examples/modeline/modeline-build-property-route.yaml @@ -0,0 +1,27 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +# camel-k: build-property=quarkus.application.name=my-super-application + +- from: + uri: "timer:build-property" + steps: + - setBody: + simple: "The application name: {{quarkus.application.name}}" + - to: "log:info" diff --git a/generic-examples/modeline/modeline-config-file-route.groovy b/generic-examples/modeline/modeline-config-file-route.groovy deleted file mode 100644 index 850f7ad..0000000 --- a/generic-examples/modeline/modeline-config-file-route.groovy +++ /dev/null @@ -1,30 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// kamel run modeline-config-file-route.groovy --dev -// - -// camel-k: config=file:resources-data.txt - -from('timer:resources') - .routeId('resources') - .setBody() - .simple("resource:classpath:resources-data.txt") - .log('resource file content is: ${body}') diff --git a/generic-examples/modeline/modeline-config-file-route.yaml b/generic-examples/modeline/modeline-config-file-route.yaml new file mode 100644 index 0000000..5dc8e4b --- /dev/null +++ b/generic-examples/modeline/modeline-config-file-route.yaml @@ -0,0 +1,29 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +# camel-k: config=configmap:my-cm-file + +- from: + uri: "timer:config-file" + steps: + - setBody: + simple: "resource:classpath:resources-data.txt" + - setBody: + simple: "resource file content is: ${body}" + - to: "log:info" diff --git a/generic-examples/modeline/modeline-config-secret-route.groovy b/generic-examples/modeline/modeline-config-secret-route.groovy deleted file mode 100644 index e6b9dab..0000000 --- a/generic-examples/modeline/modeline-config-secret-route.groovy +++ /dev/null @@ -1,32 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kubectl create secret generic my-sec --from-literal=my-secret-key="very top secret" -// kamel run modeline-config-secret-route.groovy --dev -// - -// camel-k: config=secret:my-sec - -from('timer:secret') - .routeId('secret') - .setBody() - .simple("resource:classpath:my-secret-key") - .log('secret content is: ${body}') diff --git a/generic-examples/modeline/modeline-config-secret-route.yaml b/generic-examples/modeline/modeline-config-secret-route.yaml new file mode 100644 index 0000000..13b03ac --- /dev/null +++ b/generic-examples/modeline/modeline-config-secret-route.yaml @@ -0,0 +1,30 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +# camel-k: config=secret:my-sec + +- from: + uri: "timer:secret" + steps: + - setBody: + simple: "resource:classpath:my-secret-key" + - setBody: + simple: "secret content is: ${body}" + - to: "log:info" + diff --git a/generic-examples/modeline/modeline-property-file-route.groovy b/generic-examples/modeline/modeline-property-file-route.groovy deleted file mode 100644 index e831e21..0000000 --- a/generic-examples/modeline/modeline-property-file-route.groovy +++ /dev/null @@ -1,29 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kamel run modeline-property-file-route.groovy --dev -// - -// camel-k: property=file:my.properties - -from('timer:property') - .routeId('property') - .log('property content is: {{my.key.1}} {{my.key.2}}') diff --git a/generic-examples/modeline/modeline-property-file-route.yaml b/generic-examples/modeline/modeline-property-file-route.yaml new file mode 100644 index 0000000..1116d97 --- /dev/null +++ b/generic-examples/modeline/modeline-property-file-route.yaml @@ -0,0 +1,27 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +# camel-k: property=file:my.properties + +- from: + uri: "timer:property-file" + steps: + - setBody: + simple: "property file content is: {{my.key.1}} {{my.key.2}}" + - to: "log:info" diff --git a/generic-examples/modeline/modeline-property-route.groovy b/generic-examples/modeline/modeline-property-route.groovy deleted file mode 100644 index 472096f..0000000 --- a/generic-examples/modeline/modeline-property-route.groovy +++ /dev/null @@ -1,29 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kamel run modeline-property-route.groovy --dev -// - -// camel-k: property=my.message=test-property - -from('timer:property') - .routeId('property') - .log('property content is: {{my.message}}') diff --git a/generic-examples/modeline/modeline-property-route.yaml b/generic-examples/modeline/modeline-property-route.yaml new file mode 100644 index 0000000..066bc33 --- /dev/null +++ b/generic-examples/modeline/modeline-property-route.yaml @@ -0,0 +1,27 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +# camel-k: property=my.message=test-property + +- from: + uri: "timer:property" + steps: + - setBody: + simple: "property content is: {{my.message}}" + - to: "log:info" diff --git a/generic-examples/modeline/modeline-resource-file-route.groovy b/generic-examples/modeline/modeline-resource-file-route.groovy deleted file mode 100644 index 7bdcaf6..0000000 --- a/generic-examples/modeline/modeline-resource-file-route.groovy +++ /dev/null @@ -1,27 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// kamel run modeline-resource-file-route.groovy --dev -// - -// camel-k: resource=file:resources-data.txt - -from('file:/etc/camel/resources/?fileName=resources-data.txt&noop=true&idempotent=false') - .log('resource file content is: ${body}') diff --git a/generic-examples/modeline/modeline-resource-file-route.yaml b/generic-examples/modeline/modeline-resource-file-route.yaml new file mode 100644 index 0000000..93a9143 --- /dev/null +++ b/generic-examples/modeline/modeline-resource-file-route.yaml @@ -0,0 +1,27 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +# camel-k: resource=configmap:my-cm-file + +- from: + uri: "file:/etc/camel/resources/my-cm-file?fileName=resources-data.txt&noop=true&idempotent=false" + steps: + - setBody: + simple: "resource file content is: ${body}" + - to: "log:info" diff --git a/generic-examples/modeline/my.properties b/generic-examples/modeline/my.properties new file mode 100644 index 0000000..3ab9036 --- /dev/null +++ b/generic-examples/modeline/my.properties @@ -0,0 +1,2 @@ +my.key.1=hello +my.key.2=world \ No newline at end of file diff --git a/generic-examples/openapi/README.md b/generic-examples/openapi/README.md index 7e26b0c..05a16c1 100644 --- a/generic-examples/openapi/README.md +++ b/generic-examples/openapi/README.md @@ -8,17 +8,29 @@ Deploy the examples running ``` kubectl create configmap my-openapi --from-file=greetings-api.json -kamel run --dev --name greetings --open-api configmap:my-openapi greetings.groovy +kamel run --dev --name greetings --open-api configmap:my-openapi greetings.yaml ``` -Then you can test by calling the hello endpoint, ie: +If on minikube, you can get the service endpoint address like this ... ``` -$ curl -i http://192.168.49.2:31373/camel/greetings/hello +$ minikube service greetings +Starting tunnel for service greetings. +|-----------|-----------|-------------|------------------------| +| NAMESPACE | NAME | TARGET PORT | URL | +|-----------|-----------|-------------|------------------------| +| default | greetings | | http://127.0.0.1:58512 | +|-----------|-----------|-------------|------------------------| +``` + +You can then test that endpoint like this ... + +``` +$ curl -i http://127.0.0.1:58512/camel/greetings/hello HTTP/1.1 200 OK Accept: */* name: hello -User-Agent: curl/7.68.0 +User-Agent: curl/8.6.0 transfer-encoding: chunked Hello from hello diff --git a/generic-examples/openapi/greetings.groovy b/generic-examples/openapi/greetings.groovy deleted file mode 100644 index 511fb83..0000000 --- a/generic-examples/openapi/greetings.groovy +++ /dev/null @@ -1,27 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// kubectl create configmap my-openapi --from-file=greetings-api.json -// kamel run --dev --name greetings --open-api configmap:my-openapi greetings.groovy -// - -from('direct:greeting-api') - .to('log:api?showAll=true&multiline=true') - .setBody() - .simple('Hello from ${headers.name}') diff --git a/generic-examples/openapi/greetings.yaml b/generic-examples/openapi/greetings.yaml new file mode 100644 index 0000000..8ceac09 --- /dev/null +++ b/generic-examples/openapi/greetings.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "direct:greeting-api" + steps: + - to: "log:api?showAll=true&multiline=true" + - setBody: + simple: "Hello from ${headers.name}" diff --git a/generic-examples/openapi/petstore-api.yaml b/generic-examples/openapi/petstore-api.yaml deleted file mode 100644 index 1b6d69c..0000000 --- a/generic-examples/openapi/petstore-api.yaml +++ /dev/null @@ -1,128 +0,0 @@ -# --------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# --------------------------------------------------------------------------- - -openapi: "3.0.0" -info: - version: 1.0.0 - title: Swagger Petstore - license: - name: MIT -servers: - - url: http://petstore.swagger.io/v1 -paths: - /pets: - get: - summary: List all pets - operationId: listPets - tags: - - pets - parameters: - - name: limit - in: query - description: How many items to return at one time (max 100) - required: false - schema: - type: integer - format: int32 - responses: - '200': - description: A paged array of pets - headers: - x-next: - description: A link to the next page of responses - schema: - type: string - content: - application/json: - schema: - $ref: "#/components/schemas/Pets" - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - post: - summary: Create a pet - operationId: createPets - tags: - - pets - responses: - '201': - description: Null response - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" - /pets/{petId}: - get: - summary: Info for a specific pet - operationId: showPetById - tags: - - pets - parameters: - - name: petId - in: path - required: true - description: The id of the pet to retrieve - schema: - type: string - responses: - '200': - description: Expected response to a valid request - content: - application/json: - schema: - $ref: "#/components/schemas/Pet" - default: - description: unexpected error - content: - application/json: - schema: - $ref: "#/components/schemas/Error" -components: - schemas: - Pet: - type: object - required: - - id - - name - properties: - id: - type: integer - format: int64 - name: - type: string - tag: - type: string - Pets: - type: array - items: - $ref: "#/components/schemas/Pet" - Error: - type: object - required: - - code - - message - properties: - code: - type: integer - format: int32 - message: - type: string diff --git a/generic-examples/openapi/petstore.groovy b/generic-examples/openapi/petstore.groovy deleted file mode 100644 index 8f90173..0000000 --- a/generic-examples/openapi/petstore.groovy +++ /dev/null @@ -1,31 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - - -// -// kubectl create configmap my-petstore-api --from-file=petstore-api.yaml -// kamel run --dev --name petstore --open-api configmap:my-petstore-api petstore.groovy -// - -from('direct:listPets') - .log('listPets') -from('direct:createPets') - .log('createPets') -from('direct:showPetById') - .log('showPetById') - diff --git a/generic-examples/processor/README.md b/generic-examples/processor/README.md index 558280a..ea21e44 100644 --- a/generic-examples/processor/README.md +++ b/generic-examples/processor/README.md @@ -1,3 +1,11 @@ # Processors Camel K examples -Find useful examples about how to include a `Processor` in a Camel K integration. \ No newline at end of file +Useful examples on how to include a `Processor` in a Camel K integration. + +``` +kamel run --dev kotlin-routes.kts + +kamel run --dev routes.groovy + +kamel run --dev routes.js +``` \ No newline at end of file diff --git a/generic-examples/processor/kotlin-routes.kts b/generic-examples/processor/kotlin-routes.kts index 51a1b3f..def4a33 100644 --- a/generic-examples/processor/kotlin-routes.kts +++ b/generic-examples/processor/kotlin-routes.kts @@ -16,12 +16,6 @@ * limitations under the License. */ -// -// To run this integration use: -// -// kamel run kotlin examples/kotlin-routes.kts -// - val rnd = java.util.Random() from("timer:kotlin?period=1000") diff --git a/generic-examples/processor/routes.groovy b/generic-examples/processor/routes.groovy index 33c6f97..18e953d 100644 --- a/generic-examples/processor/routes.groovy +++ b/generic-examples/processor/routes.groovy @@ -18,26 +18,6 @@ import java.util.concurrent.ThreadLocalRandom -// -// To run this integration use: -// -// kamel run examples/routes.groovy -// - -camel { - - // - // configure components - // - components { - log { - formatter { - 'body: ' + it.in.body + ', random-value: ' + it.in.headers['RandomValue'] - } - } - } -} - // // configure beans // @@ -52,4 +32,6 @@ from('timer:groovy?period=1000') .setBody() .constant('Hello Camel K!') .process('myProcessor') + .setBody() + .simple('${body} - ${header.RandomValue}') .to('log:info') diff --git a/generic-examples/processor/routes.js b/generic-examples/processor/routes.js index 4896661..aa1f6ca 100644 --- a/generic-examples/processor/routes.js +++ b/generic-examples/processor/routes.js @@ -14,24 +14,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -// -// To run this integrations use: -// -// kamel run examples/routes.js -// const org_apache_camel_Processor = Java.type("org.apache.camel.Processor"); const Processor = Java.extend(org_apache_camel_Processor); -l = components.get('log'); -l.setExchangeFormatter(e => { - return "body=" + e.getIn().getBody() + ", headers=" + e.getIn().getHeaders() -}) - from('timer:js?period=1000') .routeId('js') .setBody() - .simple('Hello Camel K') + .constant('Hello Camel K') .process(new Processor(e => { e.getIn().setHeader('RandomValue', Math.floor((Math.random() * 100) + 1)) })) + .setBody() + .simple('${body} - ${header.RandomValue}') .to('log:info'); diff --git a/generic-examples/rest/README.md b/generic-examples/rest/README.md index ef29433..56518d4 100644 --- a/generic-examples/rest/README.md +++ b/generic-examples/rest/README.md @@ -1,3 +1,36 @@ # Rest Camel K examples -Find useful examples about how to Produce/Consume RESTful webservices in a Camel K integration. \ No newline at end of file +Find useful examples about how to Produce/Consume RESTful webservices in a Camel K integration. + +## REST endpoint with Java DSL + +``` +kamel run --dev RestDSL.java + +kamel run --dev rest-dsl.js +``` + +If on minikube, you can get the service endpoint address like this ... + +``` +$ minikube service rest-dsl +Starting tunnel for service rest-dsl. +|-----------|-----------|-------------|------------------------| +| NAMESPACE | NAME | TARGET PORT | URL | +|-----------|-----------|-------------|------------------------| +| default | rest-dsl | | http://127.0.0.1:58632 | +|-----------|-----------|-------------|------------------------| +``` + +You can then test that endpoint like this ... + +``` +$ curl -i http://127.0.0.1:58632/hello +HTTP/1.1 200 OK +Accept: */* +User-Agent: curl/8.6.0 +transfer-encoding: chunked +Content-Type: text/plain + +Hello World +``` \ No newline at end of file diff --git a/generic-examples/rest/RestDSL.java b/generic-examples/rest/RestDSL.java index 1037ba3..63b3aa2 100644 --- a/generic-examples/rest/RestDSL.java +++ b/generic-examples/rest/RestDSL.java @@ -15,11 +15,6 @@ * limitations under the License. */ -// -// To run this integrations use: -// -// kamel run examples/RestDSL.java -// import org.apache.camel.Exchange; public class RestDSL extends org.apache.camel.builder.RouteBuilder { diff --git a/generic-examples/rest/routes-rest.js b/generic-examples/rest/rest-dsl.js similarity index 84% rename from generic-examples/rest/routes-rest.js rename to generic-examples/rest/rest-dsl.js index f232943..6c18caf 100644 --- a/generic-examples/rest/routes-rest.js +++ b/generic-examples/rest/rest-dsl.js @@ -1,4 +1,5 @@ // camel-k: language=js + // Licensed to the Apache Software Foundation (ASF) under one or more // contributor license agreements. See the NOTICE file distributed with // this work for additional information regarding copyright ownership. @@ -14,16 +15,10 @@ // See the License for the specific language governing permissions and // limitations under the License. -// -// To run this integrations use: -// -// kamel run --name=withrest examples/routes-rest.js -// - -rest('/say/hello') +rest('/hello') .produces("text/plain") .get() - .to('direct:sayHello'); + .to('direct:hello'); -from('direct:sayHello') +from('direct:hello') .transform().constant("Hello World"); diff --git a/generic-examples/user-config/README.md b/generic-examples/user-config/README.md index 261c77b..c1ff8c4 100644 --- a/generic-examples/user-config/README.md +++ b/generic-examples/user-config/README.md @@ -6,55 +6,84 @@ These examples use the Camel-k CLI `kamel run ...` command. ## Configuration properties -These examples show the different ways you can **properties** to configure integrations. +These examples show the different ways you can use **properties** to configure integrations. * provide build time properties with `--build-property` - * `build-property-route.groovy` - * `build-property-file-route.groovy` + * `kamel run --dev --build-property=quarkus.application.name=my-super-application build-property-route.yaml` + * `kamel run --dev --build-property=file:quarkus.properties build-property-file-route.yaml` * provide runtime properties with `-p` - * `property-file-route.groovy` - * `property-route.groovy` + * `kamel run --dev -p file:my.properties property-file-route.yaml` + * `kamel run --dev -p my.message=test-property property-route.yaml` ## Configuration Configmap These examples show the different ways you can use **ConfigMaps** to configure integrations. * provide properties from a configmap with `--config` - * `config-configmap-route.groovy` + +``` +kubectl create configmap my-cm --from-literal=my-configmap-key="configmap content" +kamel run --dev --config configmap:my-cm config-configmap-route.yaml +``` * provide properties from a configmap with `--resource` - * `resource-configmap-route.groovy` - * `resource-configmap-location-route.groovy` - * `resource-configmap-key-location-route.groovy` + +``` +kubectl create configmap my-cm --from-literal=my-configmap-key="configmap content" +kamel run --dev --resource configmap:my-cm resource-configmap-route.yaml + +kamel run --dev --resource configmap:my-cm@/tmp/app/data resource-configmap-location-route.yaml + +kubectl create configmap my-cm-multi --from-literal=my-configmap-key="configmap content" --from-literal=my-configmap-key-2="another content" +kamel run --dev --resource configmap:my-cm-multi/my-configmap-key-2@/tmp/app/data/test.txt resource-configmap-key-location-route.yaml +``` ## Configuration Secret These examples show the different ways you can use **Secrets** to configure integrations. * provide properties from a secret with `--config` -* `config-secret-route.groovy` -* `config-secret-property-route.groovy` -* `config-secret-key-route.groovy` -* provide properties from a secret with `--resource` -* `resource-secret-route.groovy` -* `resource-secret-location-route.groovy` +``` +kubectl create secret generic my-sec --from-literal=my-secret-key="very top secret" +kamel run --dev --config secret:my-sec config-secret-route.yaml +kubectl create secret generic my-secret-properties --from-file=my.properties +kamel run --dev --config secret:my-secret-properties config-secret-property-route.yaml +kubectl create secret generic my-sec-multi --from-literal=my-secret-key="very top secret" --from-literal=my-secret-key-2="even more secret" +kamel run --dev --config secret:my-sec-multi/my-secret-key-2 config-secret-key-route.yaml +``` -## Configuration Resource file (Camel-K <= 1.12.1) +* provide properties from a secret with `--resource` -**These examples only work with a version of Camel-K <= 1.12.1** +``` +kubectl create secret generic my-sec --from-literal=my-secret-key="very top secret" +kamel run --dev --resource secret:my-sec resource-secret-route.yaml + +kamel run --dev --resource secret:my-sec@/tmp/app/data resource-secret-location-route.yaml +``` + +## Configuration Resource file These examples show the different ways you can use **resource files** to configure integrations. * provide properties from a resource file with `--config` - * `config-file-route.groovy` + +``` +kubectl create configmap my-cm-file --from-file=resources-data.txt +kamel run --dev --config configmap:my-cm-file config-file-route.yaml +``` * provide properties from a resource file with `--resource` -* `resource-file-route.groovy` -* `resource-file-location-route.groovy` -* `resource-file-binary-route.groovy` -* `resource-file-base64-route.groovy` + +``` +kubectl create configmap my-cm-file --from-file=resources-data.txt +kamel run --dev --resource configmap:my-cm-file resource-file-route.yaml + +kamel run --dev --resource configmap:my-cm-file@/tmp/input resource-file-location-route.yaml + +kubectl create configmap my-cm-zip --from-file=resources-data.zip +kamel run --dev --resource configmap:my-cm-zip -d camel-zipfile resource-file-binary-route.yaml ``` diff --git a/generic-examples/user-config/build-property-file-route.groovy b/generic-examples/user-config/build-property-file-route.groovy deleted file mode 100644 index 8427b48..0000000 --- a/generic-examples/user-config/build-property-file-route.groovy +++ /dev/null @@ -1,29 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// Provide a build time configuration property file -// -// To run this integrations use: -// -// kamel run --build-property=file:quarkus.properties build-property-file-route.groovy --dev -// - -from('timer:build-property') - .routeId('build-property') - .log('The application name: {{quarkus.application.name}}') diff --git a/generic-examples/user-config/build-property-file-route.yaml b/generic-examples/user-config/build-property-file-route.yaml new file mode 100644 index 0000000..8c94469 --- /dev/null +++ b/generic-examples/user-config/build-property-file-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "timer:build-property" + steps: + - setBody: + simple: "The application name: {{quarkus.application.name}}" + - to: "log:info" diff --git a/generic-examples/user-config/build-property-route.groovy b/generic-examples/user-config/build-property-route.groovy deleted file mode 100644 index c32e5e6..0000000 --- a/generic-examples/user-config/build-property-route.groovy +++ /dev/null @@ -1,29 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// Provide a build time configuration property (the application name) -// -// To run this integrations use: -// -// kamel run --build-property=quarkus.application.name=my-super-application build-property-route.groovy --dev -// - -from('timer:build-property') - .routeId('build-property') - .log('The application name: {{quarkus.application.name}}') diff --git a/generic-examples/user-config/build-property-route.yaml b/generic-examples/user-config/build-property-route.yaml new file mode 100644 index 0000000..8c94469 --- /dev/null +++ b/generic-examples/user-config/build-property-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "timer:build-property" + steps: + - setBody: + simple: "The application name: {{quarkus.application.name}}" + - to: "log:info" diff --git a/generic-examples/user-config/config-configmap-route.groovy b/generic-examples/user-config/config-configmap-route.groovy deleted file mode 100644 index 97653b8..0000000 --- a/generic-examples/user-config/config-configmap-route.groovy +++ /dev/null @@ -1,30 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kubectl create configmap my-cm --from-literal=my-configmap-key="configmap content" -// kamel run --config configmap:my-cm config-configmap-route.groovy --dev -// - -from('timer:configmap') - .routeId('configmap') - .setBody() - .simple("resource:classpath:my-configmap-key") - .log('configmap content is: ${body}') diff --git a/generic-examples/user-config/config-configmap-route.yaml b/generic-examples/user-config/config-configmap-route.yaml new file mode 100644 index 0000000..6124dd8 --- /dev/null +++ b/generic-examples/user-config/config-configmap-route.yaml @@ -0,0 +1,27 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "timer:configmap" + steps: + - setBody: + simple: "resource:classpath:my-configmap-key" + - setBody: + simple: "configmap content is: ${body}" + - to: "log:info" diff --git a/generic-examples/user-config/config-file-route.groovy b/generic-examples/user-config/config-file-route.groovy deleted file mode 100644 index e899acd..0000000 --- a/generic-examples/user-config/config-file-route.groovy +++ /dev/null @@ -1,28 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// kamel run --config file:resources-data.txt config-file-route.groovy --dev -// - -from('timer:config-file') - .routeId('config-file') - .setBody() - .simple("resource:classpath:resources-data.txt") - .log('resource file content is: ${body}') diff --git a/generic-examples/user-config/config-file-route.yaml b/generic-examples/user-config/config-file-route.yaml new file mode 100644 index 0000000..6cf9980 --- /dev/null +++ b/generic-examples/user-config/config-file-route.yaml @@ -0,0 +1,27 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "timer:config-file" + steps: + - setBody: + simple: "resource:classpath:resources-data.txt" + - setBody: + simple: "resource file content is: ${body}" + - to: "log:info" diff --git a/generic-examples/user-config/config-secret-key-route.groovy b/generic-examples/user-config/config-secret-key-route.groovy deleted file mode 100644 index 724a885..0000000 --- a/generic-examples/user-config/config-secret-key-route.groovy +++ /dev/null @@ -1,30 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kubectl create secret generic my-sec-multi --from-literal=my-secret-key="very top secret" --from-literal=my-secret-key-2="even more secret" -// kamel run --config secret:my-sec-multi/my-secret-key-2 config-secret-key-route.groovy --dev -// - -from('timer:secret') - .routeId('secret') - .setBody() - .simple("resource:classpath:my-secret-key-2") - .log('secret content is: ${body}') diff --git a/generic-examples/user-config/config-secret-key-route.yaml b/generic-examples/user-config/config-secret-key-route.yaml new file mode 100644 index 0000000..bb1449f --- /dev/null +++ b/generic-examples/user-config/config-secret-key-route.yaml @@ -0,0 +1,27 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "timer:secret" + steps: + - setBody: + simple: "resource:classpath:my-secret-key-2" + - setBody: + simple: "secret content is: ${body}" + - to: "log:info" diff --git a/generic-examples/user-config/config-secret-property-route.groovy b/generic-examples/user-config/config-secret-property-route.groovy deleted file mode 100644 index 6a2ed2d..0000000 --- a/generic-examples/user-config/config-secret-property-route.groovy +++ /dev/null @@ -1,28 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kubectl create secret generic my-secret-properties --from-file=my.properties -// kamel run --config secret:my-secret-properties config-secret-property-route.groovy --dev -// - -from('timer:secret') - .routeId('secret') - .log('{{my.key.1}} {{my.key.2}}') diff --git a/generic-examples/user-config/config-secret-property-route.yaml b/generic-examples/user-config/config-secret-property-route.yaml new file mode 100644 index 0000000..fd3c5ba --- /dev/null +++ b/generic-examples/user-config/config-secret-property-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "timer:secret" + steps: + - setBody: + simple: "{{my.key.1}} {{my.key.2}}" + - to: "log:info" diff --git a/generic-examples/user-config/config-secret-route.groovy b/generic-examples/user-config/config-secret-route.groovy deleted file mode 100644 index 178bb8e..0000000 --- a/generic-examples/user-config/config-secret-route.groovy +++ /dev/null @@ -1,30 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kubectl create secret generic my-sec --from-literal=my-secret-key="very top secret" -// kamel run --config secret:my-sec config-secret-route.groovy --dev -// - -from('timer:secret') - .routeId('secret') - .setBody() - .simple("resource:classpath:my-secret-key") - .log('secret content is: ${body}') diff --git a/generic-examples/user-config/config-secret-route.yaml b/generic-examples/user-config/config-secret-route.yaml new file mode 100644 index 0000000..1d41ca2 --- /dev/null +++ b/generic-examples/user-config/config-secret-route.yaml @@ -0,0 +1,28 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "timer:secret" + steps: + - setBody: + simple: "resource:classpath:my-secret-key" + - setBody: + simple: "secret content is: ${body}" + - to: "log:info" + diff --git a/generic-examples/user-config/property-file-route.groovy b/generic-examples/user-config/property-file-route.groovy deleted file mode 100644 index 6ce6838..0000000 --- a/generic-examples/user-config/property-file-route.groovy +++ /dev/null @@ -1,27 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kamel run --property file:my.properties property-file-route.groovy --dev -// - -from('timer:property-file') - .routeId('property-file') - .log('property file content is: {{my.key.1}} {{my.key.2}}') diff --git a/generic-examples/user-config/property-file-route.yaml b/generic-examples/user-config/property-file-route.yaml new file mode 100644 index 0000000..2a8cc29 --- /dev/null +++ b/generic-examples/user-config/property-file-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "timer:property-file" + steps: + - setBody: + simple: "property file content is: {{my.key.1}} {{my.key.2}}" + - to: "log:info" diff --git a/generic-examples/user-config/property-route.groovy b/generic-examples/user-config/property-route.groovy deleted file mode 100644 index 705eca6..0000000 --- a/generic-examples/user-config/property-route.groovy +++ /dev/null @@ -1,27 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kamel run -p my.message=test-property property-route.groovy --dev -// - -from('timer:property') - .routeId('property') - .log('property content is: {{my.message}}') diff --git a/generic-examples/user-config/property-route.yaml b/generic-examples/user-config/property-route.yaml new file mode 100644 index 0000000..5d534e3 --- /dev/null +++ b/generic-examples/user-config/property-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "timer:property" + steps: + - setBody: + simple: "property content is: {{my.message}}" + - to: "log:info" diff --git a/generic-examples/user-config/resource-configmap-key-location-route.groovy b/generic-examples/user-config/resource-configmap-key-location-route.groovy deleted file mode 100644 index 0961f49..0000000 --- a/generic-examples/user-config/resource-configmap-key-location-route.groovy +++ /dev/null @@ -1,27 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kubectl create configmap my-cm-multi --from-literal=my-configmap-key="configmap content" --from-literal=my-configmap-key-2="another content" -// kamel run --resource configmap:my-cm-multi/my-configmap-key-2@/tmp/app/data/test.txt resource-configmap-key-location-route.groovy --dev -// - -from('file:/tmp/app/data/?fileName=test.txt&noop=true&idempotent=false') - .log('resource file content is: ${body} consumed from ${header.CamelFileName}') diff --git a/generic-examples/user-config/resource-configmap-key-location-route.yaml b/generic-examples/user-config/resource-configmap-key-location-route.yaml new file mode 100644 index 0000000..e52ca70 --- /dev/null +++ b/generic-examples/user-config/resource-configmap-key-location-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "file:/tmp/app/data/?fileName=test.txt&noop=true&idempotent=false" + steps: + - setBody: + simple: "resource file content is: ${body} consumed from ${header.CamelFileName}" + - to: "log:info" diff --git a/generic-examples/user-config/resource-configmap-location-route.groovy b/generic-examples/user-config/resource-configmap-location-route.groovy deleted file mode 100644 index 4714cc4..0000000 --- a/generic-examples/user-config/resource-configmap-location-route.groovy +++ /dev/null @@ -1,27 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kubectl create configmap my-cm --from-literal=my-configmap-key="configmap content" -// kamel run --resource configmap:my-cm@/tmp/app/data resource-configmap-location-route.groovy --dev -// - -from('file:/tmp/app/data/?fileName=my-configmap-key&noop=true&idempotent=false') - .log('resource file content is: ${body}') diff --git a/generic-examples/user-config/resource-configmap-location-route.yaml b/generic-examples/user-config/resource-configmap-location-route.yaml new file mode 100644 index 0000000..6201b3c --- /dev/null +++ b/generic-examples/user-config/resource-configmap-location-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "file:/tmp/app/data/?fileName=my-configmap-key&noop=true&idempotent=false" + steps: + - setBody: + simple: "resource file content is: ${body}" + - to: "log:info" diff --git a/generic-examples/user-config/resource-configmap-route.groovy b/generic-examples/user-config/resource-configmap-route.groovy deleted file mode 100644 index 5d0a522..0000000 --- a/generic-examples/user-config/resource-configmap-route.groovy +++ /dev/null @@ -1,27 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kubectl create configmap my-cm --from-literal=my-configmap-key="configmap content" -// kamel run --resource configmap:my-cm resource-configmap-route.groovy --dev -// - -from('file:/etc/camel/resources/my-cm/?fileName=my-configmap-key&noop=true&idempotent=false') - .log('resource file content is: ${body}') diff --git a/generic-examples/user-config/resource-configmap-route.yaml b/generic-examples/user-config/resource-configmap-route.yaml new file mode 100644 index 0000000..b49b308 --- /dev/null +++ b/generic-examples/user-config/resource-configmap-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "file:/etc/camel/resources/my-cm/?fileName=my-configmap-key&noop=true&idempotent=false" + steps: + - setBody: + simple: "resource file content is: ${body}" + - to: "log:info" diff --git a/generic-examples/user-config/resource-file-base64-encoded-route.groovy b/generic-examples/user-config/resource-file-base64-encoded-route.groovy deleted file mode 100644 index b88244d..0000000 --- a/generic-examples/user-config/resource-file-base64-encoded-route.groovy +++ /dev/null @@ -1,28 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// kamel run --resource file:resources-data.txt --compression=true resource-file-base64-encoded-route.groovy --dev -// - -from('timer:resources-bas64') - .routeId('resources-base64') - .setBody() - .simple("resource:classpath:resources-data.txt") - .log('resource file base64 content is: ${body}') diff --git a/generic-examples/user-config/resource-file-binary-route.groovy b/generic-examples/user-config/resource-file-binary-route.groovy deleted file mode 100644 index 7f88b9a..0000000 --- a/generic-examples/user-config/resource-file-binary-route.groovy +++ /dev/null @@ -1,27 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// kamel run --resource file:resources-data.zip resource-file-binary-route.groovy -d camel-zipfile --dev -// - -from('file:/etc/camel/resources/?fileName=resources-data.zip&noop=true&idempotent=false') - .routeId('resources-zip') - .unmarshal().zipFile() - .log('resource file unzipped content is: ${body}') diff --git a/generic-examples/user-config/resource-file-binary-route.yaml b/generic-examples/user-config/resource-file-binary-route.yaml new file mode 100644 index 0000000..e26a994 --- /dev/null +++ b/generic-examples/user-config/resource-file-binary-route.yaml @@ -0,0 +1,27 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "file:/etc/camel/resources/my-cm-zip?fileName=resources-data.zip&noop=true&idempotent=false" + steps: + - unmarshal: + zipFile: {} + - setBody: + simple: "resource file unzipped content is: ${body}" + - to: "log:info" diff --git a/generic-examples/user-config/resource-file-location-route.groovy b/generic-examples/user-config/resource-file-location-route.groovy deleted file mode 100644 index ec59eb4..0000000 --- a/generic-examples/user-config/resource-file-location-route.groovy +++ /dev/null @@ -1,25 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// kamel run --resource file:resources-data.txt@/tmp/input.txt resource-file-location-route.groovy --dev -// - -from('file:/tmp/?fileName=input.txt&noop=true&idempotent=false') - .log('resource file content is: ${body}') diff --git a/generic-examples/user-config/resource-file-location-route.yaml b/generic-examples/user-config/resource-file-location-route.yaml new file mode 100644 index 0000000..53401d4 --- /dev/null +++ b/generic-examples/user-config/resource-file-location-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "file:/tmp/input?fileName=resources-data.txt&noop=true&idempotent=false" + steps: + - setBody: + simple: "resource file content is: ${body}" + - to: "log:info" diff --git a/generic-examples/user-config/resource-file-route.groovy b/generic-examples/user-config/resource-file-route.groovy deleted file mode 100644 index 63d6298..0000000 --- a/generic-examples/user-config/resource-file-route.groovy +++ /dev/null @@ -1,25 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// kamel run --resource file:resources-data.txt resource-file-route.groovy --dev -// - -from('file:/etc/camel/resources/?fileName=resources-data.txt&noop=true&idempotent=false') - .log('resource file content is: ${body}') diff --git a/generic-examples/user-config/resource-file-route.yaml b/generic-examples/user-config/resource-file-route.yaml new file mode 100644 index 0000000..9b2d22d --- /dev/null +++ b/generic-examples/user-config/resource-file-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "file:/etc/camel/resources/my-cm-file?fileName=resources-data.txt&noop=true&idempotent=false" + steps: + - setBody: + simple: "resource file content is: ${body}" + - to: "log:info" diff --git a/generic-examples/user-config/resource-secret-location-route.groovy b/generic-examples/user-config/resource-secret-location-route.groovy deleted file mode 100644 index 747e7b2..0000000 --- a/generic-examples/user-config/resource-secret-location-route.groovy +++ /dev/null @@ -1,27 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kubectl create secret generic my-sec --from-literal=my-secret-key="very top secret" -// kamel run --resource secret:my-sec@/tmp/app/data resource-secret-location-route.groovy --dev -// - -from('file:/tmp/app/data/?fileName=my-secret-key&noop=true&idempotent=false') - .log('resource file content is: ${body}') diff --git a/generic-examples/user-config/resource-secret-location-route.yaml b/generic-examples/user-config/resource-secret-location-route.yaml new file mode 100644 index 0000000..b7f7668 --- /dev/null +++ b/generic-examples/user-config/resource-secret-location-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "file:/tmp/app/data/?fileName=my-secret-key&noop=true&idempotent=false" + steps: + - setBody: + simple: "resource file content is: ${body}" + - to: "log:info" diff --git a/generic-examples/user-config/resource-secret-route.groovy b/generic-examples/user-config/resource-secret-route.groovy deleted file mode 100644 index aab496b..0000000 --- a/generic-examples/user-config/resource-secret-route.groovy +++ /dev/null @@ -1,27 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// kubectl create secret generic my-sec --from-literal=my-secret-key="very top secret" -// kamel run --resource secret:my-sec resource-secret-route.groovy --dev -// - -from('file:/etc/camel/resources/my-sec/?fileName=my-secret-key&noop=true&idempotent=false') - .log('resource file content is: ${body}') diff --git a/generic-examples/user-config/resource-secret-route.yaml b/generic-examples/user-config/resource-secret-route.yaml new file mode 100644 index 0000000..dfdc82f --- /dev/null +++ b/generic-examples/user-config/resource-secret-route.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "file:/etc/camel/resources/my-sec/?fileName=my-secret-key&noop=true&idempotent=false" + steps: + - setBody: + simple: "resource file content is: ${body}" + - to: "log:info" diff --git a/generic-examples/volumes/README.md b/generic-examples/volumes/README.md index 347199a..8728f16 100644 --- a/generic-examples/volumes/README.md +++ b/generic-examples/volumes/README.md @@ -1,3 +1,11 @@ # Camel K Volumes examples In this section you will find examples about usage of `Persistent Volumes`. + +``` +kubectl apply -f minikube-pvc.yaml + +kamel run --dev --volume my-pv-claim:/tmp/data pvc-producer.yaml + +kamel run --dev --volume my-pv-claim:/tmp/data pvc-consumer.yaml +``` \ No newline at end of file diff --git a/generic-examples/volumes/pvc-consumer.groovy b/generic-examples/volumes/pvc-consumer.groovy deleted file mode 100644 index 86799d8..0000000 --- a/generic-examples/volumes/pvc-consumer.groovy +++ /dev/null @@ -1,30 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// on minikube environment, you can create a sample PVC named my-pv-claim by executing: -// -// kubectl apply -f minikube-pvc.yaml -// -// kamel run --volume my-pv-claim:/tmp/data pvc-consumer.groovy --dev -// - -from('file:/tmp/data/') - .log('Consuming: ${body}') diff --git a/generic-examples/volumes/pvc-consumer.yaml b/generic-examples/volumes/pvc-consumer.yaml new file mode 100644 index 0000000..a6463b5 --- /dev/null +++ b/generic-examples/volumes/pvc-consumer.yaml @@ -0,0 +1,25 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "file:/tmp/data/" + steps: + - setBody: + simple: "Consuming: ${body}" + - to: "log:info" diff --git a/generic-examples/volumes/pvc-producer.groovy b/generic-examples/volumes/pvc-producer.groovy deleted file mode 100644 index 19d4877..0000000 --- a/generic-examples/volumes/pvc-producer.groovy +++ /dev/null @@ -1,33 +0,0 @@ -// camel-k: language=groovy -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -// -// To run this integrations use: -// -// on minikube environment, you can create a sample PVC named my-pv-claim by executing: -// -// kubectl apply -f minikube-pvc.yaml -// -// kamel run --volume my-pv-claim:/tmp/data pvc-producer.groovy --dev -// - -from('timer:foo') - .setBody() - .simple('Hello Camel K') - .log('Producing: ${body}') - .to('file:/tmp/data/') diff --git a/generic-examples/volumes/pvc-producer.yaml b/generic-examples/volumes/pvc-producer.yaml new file mode 100644 index 0000000..e473d40 --- /dev/null +++ b/generic-examples/volumes/pvc-producer.yaml @@ -0,0 +1,26 @@ +# camel-k: language=yaml + +# --------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# --------------------------------------------------------------------------- + +- from: + uri: "timer:foo" + steps: + - setBody: + simple: "Hello Camel K" + - to: "log:info" + - to: "file:/tmp/data/"
