This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-k.git
The following commit(s) were added to refs/heads/main by this push: new a09a41c64 (#5489) Groovy > Yaml (#5497) a09a41c64 is described below commit a09a41c6473f5fbf7970f8942841a1d31b043736 Author: Thomas Diesler <tdies...@redhat.com> AuthorDate: Thu May 16 09:12:50 2024 +0200 (#5489) Groovy > Yaml (#5497) * (#5489) Use yaml in docs * (#5489) Use yaml in e2e advanced * (#5489) Use yaml in e2e builder --- .gitignore | 3 +- README.adoc | 15 +++-- docs/local-build.sh | 3 +- .../tekton/camel-k-pipeline-task-definition.yaml | 2 +- .../pages/configuration/build-time-properties.adoc | 44 ++++++++----- .../ROOT/pages/configuration/components.adoc | 27 ++++++-- .../ROOT/pages/configuration/configuration.adoc | 19 ++++-- .../ROOT/pages/configuration/maven-profile.adoc | 2 +- .../ROOT/pages/configuration/runtime-config.adoc | 74 +++++++++++++--------- .../pages/configuration/runtime-properties.adoc | 65 ++++++++++++------- .../pages/configuration/runtime-resources.adoc | 57 +++++++++++------ docs/modules/ROOT/pages/index.adoc | 27 +++++--- .../installation/advanced/multi-architecture.adoc | 6 +- .../modules/ROOT/pages/kamelets/kamelets-user.adoc | 71 ++++++++++++--------- docs/modules/ROOT/pages/languages/groovy.adoc | 5 +- docs/modules/ROOT/pages/running/running.adoc | 30 +++++---- docs/modules/traits/pages/3scale.adoc | 2 +- docs/modules/traits/pages/affinity.adoc | 2 +- docs/modules/traits/pages/aws-secrets-manager.adoc | 2 +- docs/modules/traits/pages/azure-key-vault.adoc | 2 +- docs/modules/traits/pages/builder.adoc | 4 +- docs/modules/traits/pages/camel.adoc | 2 +- docs/modules/traits/pages/container.adoc | 2 +- docs/modules/traits/pages/cron.adoc | 2 +- docs/modules/traits/pages/deployer.adoc | 2 +- docs/modules/traits/pages/deployment.adoc | 2 +- docs/modules/traits/pages/environment.adoc | 2 +- docs/modules/traits/pages/error-handler.adoc | 2 +- docs/modules/traits/pages/gc.adoc | 2 +- docs/modules/traits/pages/gcp-secret-manager.adoc | 2 +- docs/modules/traits/pages/hashicorp-vault.adoc | 2 +- docs/modules/traits/pages/health.adoc | 2 +- docs/modules/traits/pages/ingress.adoc | 2 +- docs/modules/traits/pages/istio.adoc | 2 +- docs/modules/traits/pages/jolokia.adoc | 2 +- docs/modules/traits/pages/jvm.adoc | 2 +- docs/modules/traits/pages/kamelets.adoc | 2 +- docs/modules/traits/pages/keda.adoc | 2 +- docs/modules/traits/pages/knative-service.adoc | 2 +- docs/modules/traits/pages/knative.adoc | 2 +- docs/modules/traits/pages/logging.adoc | 2 +- docs/modules/traits/pages/master.adoc | 2 +- docs/modules/traits/pages/mount.adoc | 2 +- docs/modules/traits/pages/openapi.adoc | 2 +- docs/modules/traits/pages/owner.adoc | 2 +- docs/modules/traits/pages/pdb.adoc | 2 +- docs/modules/traits/pages/platform.adoc | 2 +- docs/modules/traits/pages/pod.adoc | 35 +++++----- docs/modules/traits/pages/prometheus.adoc | 2 +- docs/modules/traits/pages/pull-secret.adoc | 2 +- docs/modules/traits/pages/quarkus.adoc | 2 +- docs/modules/traits/pages/registry.adoc | 2 +- docs/modules/traits/pages/resume.adoc | 2 +- docs/modules/traits/pages/route.adoc | 2 +- docs/modules/traits/pages/security-context.adoc | 2 +- docs/modules/traits/pages/service-binding.adoc | 2 +- docs/modules/traits/pages/service.adoc | 2 +- docs/modules/traits/pages/telemetry.adoc | 2 +- docs/modules/traits/pages/toleration.adoc | 2 +- docs/modules/traits/pages/tracing.adoc | 2 +- docs/modules/traits/pages/traits.adoc | 7 +- e2e/advanced/build_order_strategy_test.go | 8 +-- e2e/advanced/files/promote-route-edited.groovy | 22 ------- .../advanced/files/promote-route-edited.yaml | 17 ++--- e2e/advanced/files/promote-route.groovy | 25 -------- .../advanced/files/promote-route.yaml | 22 ++++--- e2e/advanced/files/timer-kamelet-usage.groovy | 19 ------ .../advanced/files/timer-kamelet-usage.yaml | 13 ++-- e2e/advanced/files/timer-source.groovy | 20 ------ .../advanced/files/timer-source.yaml | 13 ++-- e2e/advanced/main_test.go | 2 +- e2e/advanced/promote_test.go | 28 +++++--- .../builder/files/example.yaml | 18 +++--- e2e/builder/files/groovy.groovy | 23 ------- e2e/builder/registry_test.go | 16 ++--- 75 files changed, 420 insertions(+), 406 deletions(-) diff --git a/.gitignore b/.gitignore index ef4f286cf..7e62d4fbd 100644 --- a/.gitignore +++ b/.gitignore @@ -38,6 +38,7 @@ index.Dockerfile .gopath # Temporary Build Files +/api_* build/_output build/_offline build/camel-k-runtime-*-maven-offline.tar.gz @@ -49,7 +50,7 @@ build/_maven_overlay/ build/maven/target/ build/maven build/m2 -/api_* +_scratch/ # YAKS test output .yaks-jbang/ diff --git a/README.adoc b/README.adoc index ae0d17f36..1835498d9 100644 --- a/README.adoc +++ b/README.adoc @@ -28,15 +28,18 @@ https://camel.apache.org/camel-k/next/installation/installation.html[Installatio You can use Camel DSL to define your `Integration`. Just save it in a file and use `kamel` command line interface (https://github.com/apache/camel-k/releases/latest[download latest release]) to run it. As an example, just try running: -[source,groovy] -.hello.groovy +[source,yaml] +.hello.yaml ---- -from('timer:tick?period=3000') - .setBody().constant('Hello world from Camel K') - .to('log:info') +- from: + uri: "timer:tick?period=3000" + steps: + - setBody: + constant: "Hello world from Camel K" + - to: "log:info" ---- ---- -kamel run hello.groovy +kamel run hello.yaml ---- You can even run your integrations in a `dev` mode. Change the code and see the **changes automatically applied (instantly)** to the remote integration pod! We have provided link:/examples[more examples] that you can use to inspire your next `Integration` development. diff --git a/docs/local-build.sh b/docs/local-build.sh index 6e0b63f89..471f366c1 100755 --- a/docs/local-build.sh +++ b/docs/local-build.sh @@ -17,7 +17,8 @@ # limitations under the License. # -CW=./../../camel-website +SCRIPT_DIR=$(dirname $0) +CW=${SCRIPT_DIR}/../../camel-website LOCAL=./../camel-k cd $CW || (echo 'camel-website not in expected location $CW' && exit) diff --git a/docs/modules/ROOT/attachments/tekton/camel-k-pipeline-task-definition.yaml b/docs/modules/ROOT/attachments/tekton/camel-k-pipeline-task-definition.yaml index 220e43455..97b30e52e 100644 --- a/docs/modules/ROOT/attachments/tekton/camel-k-pipeline-task-definition.yaml +++ b/docs/modules/ROOT/attachments/tekton/camel-k-pipeline-task-definition.yaml @@ -87,4 +87,4 @@ spec: resource: source-repo params: - name: file - value: "examples/tekton/hello.groovy" + value: "examples/tekton/hello.yaml" diff --git a/docs/modules/ROOT/pages/configuration/build-time-properties.adoc b/docs/modules/ROOT/pages/configuration/build-time-properties.adoc index b8d239eb9..3393e74c5 100644 --- a/docs/modules/ROOT/pages/configuration/build-time-properties.adoc +++ b/docs/modules/ROOT/pages/configuration/build-time-properties.adoc @@ -8,17 +8,21 @@ You may be required to provide certain *build-time properties* that are needed o You will find this feature very useful when dealing with configuration that affects how `Quarkus` builds the `Integration`. For example, let's see how to override the default `quarkus.application.name` expected by any `Quarkus` application: -[source,groovy] -.build-property-route.groovy +[source,yaml] +.build-property-route.yaml ---- -from('timer:build-property') - .log('The application name: {{quarkus.application.name}}') +- from: + uri: "timer:build-property" + steps: + - setBody: + simple: "The application name: {{quarkus.application.name}}" + - to: "log:info" ---- In order to give a value to the `quarkus.application.name` property you can pass it using the command line with the `--build-property` flag: ---- -kamel run --build-property=quarkus.application.name=my-super-application build-property-route.groovy +kamel run --build-property=quarkus.application.name=my-super-application build-property-route.yaml ---- You can provide more than one single `build-property` at once by just adding the flag repeatedly (ie, `--build-property=prop1=val1 --build-property=prop2=val2 ...`) @@ -35,17 +39,21 @@ quarkus.application.name = my-super-application quarkus.banner.enabled = true ---- -[source,groovy] -.build-property-route.groovy +[source,yaml] +.build-property-route.yaml ---- -from('timer:build-property') - .log('The application name: {{quarkus.application.name}}') +- from: + uri: "timer:build-property" + steps: + - setBody: + simple: "The application name: {{quarkus.application.name}}" + - to: "log:info" ---- The `quarkus.banner.enabled` is configured to show the banner during the `Integration` startup. Let's use `--build-property` flag in conjunction with file: ---- -kamel run --build-property=file:quarkus.properties build-property-route.groovy +kamel run --build-property=file:quarkus.properties build-property-route.yaml ---- The property file is parsed and its properties configured on the `Integration`. As soon as the application starts, you will see the log with the expected configuration. @@ -63,17 +71,21 @@ kubectl create configmap my-cm-bp --from-literal=quarkus.application.name="my-gr Here, as an example we have create a configmap with 2 `Quarkus` properties. -[source,groovy] -.build-property-route.groovy +[source,yaml] +.build-property-route.yaml ---- -from('timer:build-property') - .log('The application name: {{quarkus.application.name}}') +- from: + uri: "timer:build-property" + steps: + - setBody: + simple: "The application name: {{quarkus.application.name}}" + - to: "log:info" ---- The `quarkus.banner.enabled` is configured to show the banner during the `Integration` startup. Let's use `--build-property` flag in conjunction with file: ---- -kamel run --build-property=configmap:my-cm-bp build-property-route.groovy +kamel run --build-property=configmap:my-cm-bp build-property-route.yaml ---- The key-value pairs of the `ConfigMap` are loaded and used as build-time properties of the `Integration`. As soon as the application starts, you will see the log with the expected configuration. @@ -105,7 +117,7 @@ kubectl create configmap my-cm-bps --from-file=quarkus.properties Then we launch the `run` command with the `--build-property` flag whose value matches with the appropriate syntax to refer to `my-cm-bps`: ---- -kamel run --build-property configmap:my-cm-bps build-property-route.groovy +kamel run --build-property configmap:my-cm-bps build-property-route.yaml ---- The value of the key-value of the `ConfigMap` is loaded as a property file and used as build-time properties of the `Integration`. you will see the log with the expected configuration. diff --git a/docs/modules/ROOT/pages/configuration/components.adoc b/docs/modules/ROOT/pages/configuration/components.adoc index ce95b9998..410c42c74 100644 --- a/docs/modules/ROOT/pages/configuration/components.adoc +++ b/docs/modules/ROOT/pages/configuration/components.adoc @@ -2,19 +2,36 @@ Camel components can be configured programmatically (within the integration code) or using properties with the following syntax: -``` +[source] +---- camel.component.${scheme}.${property}=${value} -``` +---- As example if you want to change the queue size of the seda component, you can use the following property: -``` +[source] +---- camel.component.seda.queueSize=10 -``` +---- For example, you can do it when running the integration from the command line: +[source,yaml] +.config-seda-route.yaml +---- +- from: + uri: "timer:seda" + steps: + - setBody: + simple: "Hello World!" + - to: "seda:next" +- from: + uri: "seda:next" + steps: + - to: "log:info" +---- + ``` -kamel run --property camel.component.seda.queueSize=10 examples/routes.groovy +kamel run --property camel.component.seda.queueSize=10 config-seda-route.yaml ``` diff --git a/docs/modules/ROOT/pages/configuration/configuration.adoc b/docs/modules/ROOT/pages/configuration/configuration.adoc index febf7ef1a..f44953f35 100644 --- a/docs/modules/ROOT/pages/configuration/configuration.adoc +++ b/docs/modules/ROOT/pages/configuration/configuration.adoc @@ -7,17 +7,22 @@ The property value can be used inside Camel K integrations using the *property p The syntax for properties has the form `{{my.property}}`, for example: -[source,groovy] -.props.groovy +[source,yaml] +.property-route.yaml ---- -from('timer:props?period=1000') - .log('{{my.message}}') +- from: + uri: "timer:props" + steps: + - setBody: + simple: "{{my.message}}" + - to: "log:info" ---- In order to give a value to the `my.message` property you can pass it using the command line: -``` -kamel run --property my.message="Hello World" props.groovy -``` +[source] +---- +kamel run --property my.message="Hello World" property-route.yaml +---- For more details and advanced use cases, see the xref:configuration/runtime-properties.adoc[runtime properties] section. diff --git a/docs/modules/ROOT/pages/configuration/maven-profile.adoc b/docs/modules/ROOT/pages/configuration/maven-profile.adoc index 3b6021a36..8bda1592e 100644 --- a/docs/modules/ROOT/pages/configuration/maven-profile.adoc +++ b/docs/modules/ROOT/pages/configuration/maven-profile.adoc @@ -19,7 +19,7 @@ kubectl create cm my-maven-profile --from-file my-profile.xml Once the Configmap/Secret is ready, then, you can use it to run your integration: ``` -kamel run hello.groovy -t builder.maven-profile=configmap:my-maven-profile/my-profile.xml +kamel run hello.yaml -t builder.maven-profile=configmap:my-maven-profile/my-profile.xml ``` The profile will be added to your integration's project generated pom file. What will be changed in the `mvn package` execution will depend on your profile definition. diff --git a/docs/modules/ROOT/pages/configuration/runtime-config.adoc b/docs/modules/ROOT/pages/configuration/runtime-config.adoc index 2c616b9a8..cce2072b3 100644 --- a/docs/modules/ROOT/pages/configuration/runtime-config.adoc +++ b/docs/modules/ROOT/pages/configuration/runtime-config.adoc @@ -20,19 +20,23 @@ kubectl create configmap my-cm --from-literal=my-configmap-key="configmap conten We want to use the materialized file in an integration: -[source,groovy] -.config-configmap-route.groovy +[source,yaml] +.config-configmap-route.yaml ---- -from('timer:configmap') - .setBody() - .simple("resource:classpath:my-configmap-key") - .log('configmap content is: ${body}') +- from: + uri: "timer:configmap" + steps: + - setBody: + simple: "resource:classpath:my-configmap-key" + - setBody: + simple: "configmap content is: ${body}" + - to: "log:info" ---- You can see that we're expecting to use a _my-configmap-key_ file stored somewhere in the classpath. In order to materialize the `Configmap` will be as easy as running the `--config` _configmap_ syntax: ---- -kamel run --config configmap:my-cm config-configmap-route.groovy +kamel run --config configmap:my-cm config-configmap-route.yaml ---- As soon as the `Integration` starts, the `Camel K` operator will take care to mount a volume with the `Configmap` 's content. @@ -52,19 +56,23 @@ kubectl create secret generic my-sec --from-literal=my-secret-key="very top secr We want to use the materialized secret file in an integration: -[source,groovy] -.config-secret-route.groovy +[source,yaml] +.config-secret-route.yaml ---- -from('timer:secret') - .setBody() - .simple("resource:classpath:my-secret-key") - .log('secret content is: ${body}') +- from: + uri: "timer:secret" + steps: + - setBody: + simple: "resource:classpath:my-secret-key" + - setBody: + simple: "secret content is: ${body}" + - to: "log:info" ---- You can see that we're expecting to use a _my-secret-key_ file stored somewhere in the classpath. In order to materialize the `Secret` will be as easy as running the `--config` _secret_ syntax: ---- -kamel run --config secret:my-sec config-secret-route.groovy +kamel run --config secret:my-sec config-secret-route.yaml ---- As soon as the `Integration` starts, the `Camel K` operator will take care to mount a volume with the `Secret` 's content. @@ -77,29 +85,33 @@ NOTE: you can provide a `Secret` which is not yet available on the cluster. The Each `Configmap`/`Secret` will be parsed as a property file and you will be able to use those properties inside your `Route` definition or, more in general, as you would do with any other xref:configuration/runtime-properties.adoc[runtime property]. As an example, you can create the following `Secret`: [source,text] -.my.properties +.secret.properties ---- my.key.1=hello my.key.2=world ---- + ---- -kubectl create secret generic my-secret-properties --from-file=my.properties +kubectl create secret generic my-secret-properties --from-file=secret.properties ---- In our `Integration` we can simply refer the properties defined in the `Secret` as we would do with any other property: -[source,groovy] -.config-secret-property-route.groovy +[source,yaml] +.config-secret-property-route.yaml ---- -from('timer:secret') - .routeId('secret') - .log('{{my.key.1}} {{my.key.2}}') +- from: + uri: "timer:secret" + steps: + - setBody: + simple: "{{my.key.1}} {{my.key.2}}" + - to: "log:info" ---- We just have to provide the `--config` we are willing to use: ---- -kamel run --config secret:my-secret-properties config-secret-property-route.groovy +kamel run --config secret:my-secret-properties config-secret-property-route.yaml ---- [[runtime-config-keys]] @@ -115,19 +127,23 @@ kubectl create secret generic my-sec-multi --from-literal=my-secret-key="very to In our `Integration` we plan to use only one of the resources of the `Secret`: -[source,groovy] -.config-secret-key-route.groovy +[source,yaml] +.config-secret-key-route.yaml ---- -from('timer:secret') - .setBody() - .simple("resource:classpath:my-secret-key-2") - .log('secret content is: ${body}') +- from: + uri: "timer:secret" + steps: + - setBody: + simple: "resource:classpath:my-secret-key-2" + - setBody: + simple: "secret content is: ${body}" + - to: "log:info" ---- Let's use the _key_ filtering: ---- -kamel run --config secret:my-sec-multi/my-secret-key-2 config-secret-key-route.groovy +kamel run --config secret:my-sec-multi/my-secret-key-2 config-secret-key-route.yaml ---- You may check in the `Integration` `Pod` that only the _my-secret-key-2_ data has been mounted. diff --git a/docs/modules/ROOT/pages/configuration/runtime-properties.adoc b/docs/modules/ROOT/pages/configuration/runtime-properties.adoc index 6ea961640..f4fb39d75 100644 --- a/docs/modules/ROOT/pages/configuration/runtime-properties.adoc +++ b/docs/modules/ROOT/pages/configuration/runtime-properties.adoc @@ -8,17 +8,21 @@ During the execution of an `Integration` you can provide a single property or a Imagine you have a generic `Route` and you set a placeholder for certain information (ie, _my.message_ variable): -[source,groovy] -.property-route.groovy +[source,yaml] +.property-route.yaml ---- -from('timer:property') - .log('property content is: {{my.message}}') +- from: + uri: "timer:property" + steps: + - setBody: + simple: "property content is: {{my.message}}" + - to: "log:info" ---- The simplest way to replace that variable with a real value is to use the `--property` flag (also shortcut by `-p`): ---- -kamel run -p my.message=test-property property-route.groovy +kamel run -p my.message=test-property property-route.yaml ---- At runtime, that variable will be substituted by the value you've provided. You can provide more than one single `property` at once by just adding the flag repeatedly (ie, `--property prop1=val1 --property prop2=val2 ...`) @@ -26,17 +30,23 @@ At runtime, that variable will be substituted by the value you've provided. You You can also use runtime properties in Camel endpoints, for example to make the timer period configurable you can do as follows: -[source,groovy] -.property-route.groovy +[source,yaml] +.config-property-route.yaml ---- -from('timer:property?period={{triggerPeriod}}') - .log('property content is: {{my.message}}') +- from: + uri: "timer:property" + parameters: + period: "{{triggerPeriod}}" + steps: + - setBody: + simple: "property content is: {{my.message}}" + - to: "log:info" ---- The simplest way to replace that variable with a real value is to use the `--property` flag (also shortcut by `-p`): ---- -kamel run -p my.message=test-property -p triggerPeriod=3000 property-route.groovy +kamel run -p my.message=test-property -p triggerPeriod=3000 config-property-route.yaml ---- [[runtime-props-file]] @@ -45,24 +55,27 @@ kamel run -p my.message=test-property -p triggerPeriod=3000 property-route.groov Another way to provide more property configuration at once is to use a *property file*. [source,properties] -.my.properties +.config.properties ---- my.key.1=hello my.key.2=world ---- -[source,groovy] -.property-route.groovy +[source,yaml] +.config-property-file-route.yaml ---- -from('timer:property-file') - .routeId('property-file') - .log('property file content is: {{my.key.1}} {{my.key.2}}') +- from: + uri: "timer:property-file'" + steps: + - setBody: + simple: "property file content is: {{my.key.1}} {{my.key.2}}" + - to: "log:info" ---- You'll need to provide a `property` _file_ flag when launching the application: ---- -kamel run --property file:my.properties property-route.groovy +kamel run --property file:config.properties config-property-file-route.yaml ---- The property file is parsed and its properties configured on the `Integration`. As soon as the application starts, you will see the log with the expected configuration. @@ -80,17 +93,23 @@ kubectl create configmap my-cm-rp --from-literal=name="Will Smith" --from-litera In our `Integration` we can simply refer to the properties defined in the `ConfigMap` as we'd do with any other property: -[source,groovy] -.property-configmap-route.groovy +[source,yaml] +.config-property-configmap-route.yaml ---- -from('timer:property?period={{period}}') - .log('Hello {{name}}!') +- from: + uri: "timer:property" + parameters: + period: "{{period}}" + steps: + - setBody: + simple: "Hello {{name}}!" + - to: "log:info" ---- Then we launch the `run` command with the `--property` flag whose value matches with the appropriate syntax to refer to `my-cm-rp`: ---- -kamel run --property configmap:my-cm-rp property-configmap-route.groovy +kamel run --property configmap:my-cm-rp config-property-configmap-route.yaml ---- The key-value pairs of the `ConfigMap` are loaded and used as runtime properties of the `Integration`. As soon as the application starts, you will see the log with the expected message. @@ -122,7 +141,7 @@ kubectl create configmap my-cm-rps --from-file=some.properties Then we launch the `run` command with the `--property` flag whose value matches with the appropriate syntax to refer to `my-cm-rps`: ---- -kamel run --property configmap:my-cm-rps property-configmap-route.groovy +kamel run --property configmap:my-cm-rps config-property-configmap-route.yaml ---- The value of the key-value of the `ConfigMap` is loaded as a property file and used as runtime properties of the `Integration`. As soon as the application starts, you will see the log with the expected message. diff --git a/docs/modules/ROOT/pages/configuration/runtime-resources.adoc b/docs/modules/ROOT/pages/configuration/runtime-resources.adoc index 1d43fcf82..a5aef8c92 100644 --- a/docs/modules/ROOT/pages/configuration/runtime-resources.adoc +++ b/docs/modules/ROOT/pages/configuration/runtime-resources.adoc @@ -20,17 +20,21 @@ kubectl create configmap my-cm --from-literal=my-configmap-key="configmap conten We want to use the materialized file in an integration: -[source,groovy] -.resource-configmap-route.groovy +[source,yaml] +.resource-configmap-route.yaml ---- -from('file:/etc/camel/resources/my-cm/?fileName=my-configmap-key&noop=true&idempotent=false') - .log('resource file content is: ${body}') +- 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" ---- You can see that we're expecting to use a _my-configmap-key_ file stored in the default resource location (_/etc/camel/resources/_). In order to materialize the `Configmap` will be as easy as running the `--resource` _configmap_ syntax: ---- -kamel run --resource configmap:my-cm resource-configmap-route.groovy +kamel run --resource configmap:my-cm resource-configmap-route.yaml ---- As soon as the `Integration` starts, the `Camel K` operator will take care to mount a volume with the `Configmap` 's content. @@ -50,17 +54,21 @@ kubectl create secret generic my-sec --from-literal=my-secret-key="very top secr We want to use the materialized secret file in an integration: -[source,groovy] -.resource-secret-route.groovy +[source,yaml] +.resource-secret-route.yaml ---- -from('file:/etc/camel/resources/my-sec/?fileName=my-secret-key&noop=true&idempotent=false') - .log('resource file content is: ${body}') +- from: + uri: "file:/etc/camel/resources/my-sec/?fileName=my-secret-key&noop=true&idempotent=false" + steps: + - setBody: + simple: "secret file content is: ${body}" + - to: "log:info" ---- You can see that we're expecting to use a _my-secret-key_ file stored in the default resource location (_/etc/camel/resources/_). In order to materialize the `Secret` will be as easy as running the `--resource` _secret_ syntax: ---- -kamel run --resource secret:my-sec resource-secret-route.groovy +kamel run --resource secret:my-sec resource-secret-route.yaml ---- As soon as the `Integration` starts, the `Camel K` operator will take care to mount a volume with the `Secret` 's content. @@ -78,20 +86,23 @@ As an example, let's create a `Configmap` named _my-cm_ containing certain infor kubectl create configmap my-cm-files --from-literal=input.txt="configmap input.txt content" ---- - Let's see an example where your integration expect a text file to be consumed under a specific filesystem location: -[source,groovy] -.resource-file-location-route.groovy +[source,yaml] +.resource-file-location-route.yaml ---- -from('file:/tmp/inputs/?fileName=input.txt&noop=true&idempotent=false') - .log('resource file content is: ${body}') +- from: + uri: "file:/tmp/inputs/?fileName=input.txt&noop=true&idempotent=false" + steps: + - setBody: + simple: "resource file content is: ${body}" + - to: "log:info" ---- When running the `Integration`, you can specify where to mount the resource content (either a `File`, `Configmap` or `Secret`) with the _@path_ syntax: ---- -kamel run --resource configmap:my-cm-files@/tmp/inputs resource-file-location-route.groovy +kamel run --resource configmap:my-cm-files@/tmp/inputs resource-file-location-route.yaml ---- You may check in the `Integration` `Pod` and verify that the file was mounted in the _tmp/inputs/input.txt_ destination. @@ -109,17 +120,21 @@ kubectl create configmap my-cm-multi --from-literal=my-configmap-key="configmap In our `Integration` we plan to use only one of the resources of the `Secret`: -[source,groovy] -.resource-configmap-key-location-route.groovy +[source,yaml] +.resource-configmap-key-location-route.yaml ---- -from('file:/tmp/app/data/?fileName=test.txt&noop=true&idempotent=false') - .log('resource file content is: ${body} consumed from ${header.CamelFileName}') +- 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" ---- Let's use the _key_ filtering. Also notice that we're combining with the _@path_ syntax to declare where to mount the file: ---- -kamel run --resource configmap:my-cm-multi/my-configmap-key-2@/tmp/app/data/test.txt resource-configmap-key-location-route.groovy +kamel run --resource configmap:my-cm-multi/my-configmap-key-2@/tmp/app/data/test.txt resource-configmap-key-location-route.yaml ---- You may check in the `Integration` `Pod` that only the _test.txt_ file has been mounted under _/tmp/app/data_ directory containing the information you had in _my-configmap-key-2_. diff --git a/docs/modules/ROOT/pages/index.adoc b/docs/modules/ROOT/pages/index.adoc index 4b13a0245..5608941b7 100644 --- a/docs/modules/ROOT/pages/index.adoc +++ b/docs/modules/ROOT/pages/index.adoc @@ -24,19 +24,26 @@ Users of Camel K can instantly run integration code written in Camel DSL on thei [[how-it-works]] == How It Works -Just write a _helloworld.groovy_ integration file with the following content: - -```groovy -from('timer:tick?period=3000') - .setBody().constant('Hello world from Camel K') - .to('log:info') -``` +Just write a _helloworld.yaml_ integration file with the following content: + +[source,yaml] +---- +- from: + uri: "timer:tick" + parameters: + period: "3000" + steps: + - setBody: + simple: "Hello world from Camel K" + - to: "log:info" +---- You can then execute the following command: -``` -kamel run helloworld.groovy -``` +[source] +---- +kamel run helloworld.yaml +---- The integration code immediately runs in the cloud. **Nothing else** is needed. diff --git a/docs/modules/ROOT/pages/installation/advanced/multi-architecture.adoc b/docs/modules/ROOT/pages/installation/advanced/multi-architecture.adoc index d082b32d1..c801f1e55 100644 --- a/docs/modules/ROOT/pages/installation/advanced/multi-architecture.adoc +++ b/docs/modules/ROOT/pages/installation/advanced/multi-architecture.adoc @@ -21,14 +21,14 @@ The logs should indicate the architecture at the start of the operator pod: === Example -Once you've installed the operator you will need to specify the platform target you whish to use. This is required as each of the different publishing tasks may need to know how to create a manifest accordingly. You can use `builder.platforms` trait option to control this behavior. +The operator will by default build integrations for the same platform it is running on. It is however also possible to explicitly define the set of target platforms integrations should be built for. You can use `builder.platforms` trait option to control this behavior. NOTE: you can set the property at IntegrationPlatform level to have it for all Integrations. -Send the groovy file to kamel operator to build, publish and run it +Send the integration to the kamel operator to build, publish and run it [source,shell] ---- -kamel run hello.groovy -t builder.platforms=linux/arm64 -t builder.platforms=linux/amd64 +kamel run hello.yaml -t builder.platforms=linux/arm64 -t builder.platforms=linux/amd64 ---- You should observe base image in the logs of the operator pod: diff --git a/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc b/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc index 10eec3afe..6011b4877 100644 --- a/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc +++ b/docs/modules/ROOT/pages/kamelets/kamelets-user.adoc @@ -1,7 +1,7 @@ = Kamelets user guide Speaking technically, a Kamelet is a resource that can be installed on any Kubernetes cluster. -The following is an example of Kamelet that we'll use to discuss the various parts: +The following is an example of a Kamelet that we'll use to discuss the various parts: .telegram-text-source.kamelet.yaml [source,yaml] @@ -74,7 +74,7 @@ Kamelets can be installed on a Kubernetes namespace with a simple command: [source,shell] ---- -kubectl apply -f yourkamelet.kamelet.yaml +kubectl apply -f telegram-text-source.kamelet.yaml ---- Kamelets are standard YAML files, but their common extension is `.kamelet.yaml` to help IDEs to recognize them and provide auto-completion (in the future). @@ -86,11 +86,13 @@ Kamelets can be used in integrations **as if they were standard Camel components suppose that you've created the `telegram-text-source` Kamelet in the `default` namespace on Kubernetes, then you can write the following integration to use the Kamelet: -.example.groovy -[source,groovy] +[source,yaml] +.kamlet-route.yaml ---- -from('kamelet:telegram-text-source?botToken=XXXXYYYY') - .to('log:INFO') +- from: + uri: "kamelet:telegram-text-source?botToken=XXXXYYYY" + steps: + - to: "log:info" ---- NOTE: URI properties ("botToken") match the corresponding parameters in the Kamelet definition @@ -99,13 +101,16 @@ Kamelets can also be used multiple times in the same route definition. This happ Suppose that you've defined a Kamelet named "my-company-log-sink" in your Kubernetes namespace, then you can write a route like this: -.example.groovy -[source,groovy] +[source,yaml] +.kamlet-multi-route.yaml ---- -from('kamelet:telegram-text-source?botToken=XXXXYYYY') - .to("kamelet:my-company-log-sink?bucket=general") - .filter().simple('${body} contains "Camel"') - .to("kamelet:my-company-log-sink?bucket=special") +- from: + uri: "kamelet:telegram-text-source?botToken=XXXXYYYY" + steps: + - to: "kamelet:my-company-log-sink?bucket=general" + - filter: + simple: '${body} contains "Camel"' + - to: "kamelet:my-company-log-sink?bucket=special" ---- The "my-company-log-sink" will obviously define what it means to write a log in the enterprise system and what is concretely a "bucket". @@ -119,10 +124,11 @@ loaded implicitly by the operator from Kubernetes secrets (see below). You can configure the Kamelet by passing directly the configuration parameters in the URI, as in: -[source,groovy] +[source,yaml] ---- -from("kamelet:telegram-text-source?botToken=the-token-value") -// ... +- from: + uri: "kamelet:telegram-text-source?botToken=the-token-value" +... ---- In this case, "the-token-value" is passed explicitly in the URI (you can also pass a custom property placeholder as value). @@ -133,20 +139,24 @@ An alternative way to configure the Kamelet is to provide configuration paramete Taking for example a different version of the integration above: -[source,groovy] +[source,yaml] +.kamelet-properties-route.yaml ---- -from('kamelet:telegram-text-source') - .to("kamelet:my-company-log-sink") - .filter().simple('${body} contains "Camel"') - .to("kamelet:my-company-log-sink/mynamedconfig") +- from: + uri: "kamelet:telegram-text-source" + steps: + - to: "kamelet:my-company-log-sink" + - filter: + simple: '${body} contains "Camel"' + - to: "kamelet:my-company-log-sink/mynamedconfig" ---- NOTE: The integration above does not contain URI query parameters and the last URI ("kamelet:my-company-log-sink/mynamedconfig") contains a path parameter with value "mynamedconfig" The integration above needs some configuration in order to run properly. The configuration can be provided in a property file: -.example.properties [source,properties] +.kamelet-example.properties ---- # Configuration for the Telegram source Kamelet camel.kamelet.telegram-text-source.botToken=the-token-value @@ -164,7 +174,7 @@ Then the integration can be run with the following command: [source,shell] ---- -kamel run example.groovy --property file:example.properties +kamel run kamelet-properties-route.yaml --property file:kamelet-example.properties ---- ==== 3. Implicit configuration using secrets @@ -174,8 +184,8 @@ determine the Kamelets configuration. To use implicit configuration via secret, we first need to create a configuration file holding only the properties of a named configuration. -.mynamedconfig.properties [source,properties] +.mynamedconfig.properties ---- # Only configuration related to the "mynamedconfig" named config camel.kamelet.my-company-log-sink.mynamedconfig.bucket=special @@ -194,12 +204,15 @@ kubectl label secret my-company-log-sink.mynamedconfig camel.apache.org/kamelet= You can now write an integration that uses the Kamelet with the named configuration: -.example.groovy -[source,groovy] ----- -from('timer:tick') - .setBody().constant('Hello') - .to('kamelet:my-company-log-sink/mynamedconfig') +[source,yaml] +.kamlet-namedconfig-route.yaml +---- +- from: + uri: "timer:tick" + steps: + - setBody: + constant: "Hello" + - to: "kamelet:my-company-log-sink/mynamedconfig" ---- You can run this integration without specifying other parameters, the Kamelet endpoint will be implicitly configured by the Camel K operator that will diff --git a/docs/modules/ROOT/pages/languages/groovy.adoc b/docs/modules/ROOT/pages/languages/groovy.adoc index ac8f56849..0c3eb99b9 100644 --- a/docs/modules/ROOT/pages/languages/groovy.adoc +++ b/docs/modules/ROOT/pages/languages/groovy.adoc @@ -16,9 +16,10 @@ from('timer:tick') You can run it with the standard command: -``` +[source] +---- kamel run example.groovy -``` +---- == Configuring the Application diff --git a/docs/modules/ROOT/pages/running/running.adoc b/docs/modules/ROOT/pages/running/running.adoc index 9dd1a4608..5980c2ee3 100644 --- a/docs/modules/ROOT/pages/running/running.adoc +++ b/docs/modules/ROOT/pages/running/running.adoc @@ -6,27 +6,33 @@ and have the `kamel` CLI correctly configured. Ensure you're connected to the cluster by executing a simple command using the Kubernetes CLI: -``` +[source] +---- kubectl get pod -``` +---- Just replace `kubectl` with `oc` if you're using OpenShift. If everything is correctly configured you should get a response from the Kubernetes API server (you should see at least the `camel-k-operator` running). -You are now ready to create your first integration using Camel K. Just create a new Groovy file with the following content: +You are now ready to create your first integration using Camel K. Just create a new Yaml file with the following content: -.hello.groovy -```groovy -from('timer:tick?period=3000') - .setBody().constant('Hello world from Camel K') - .to('log:info') -``` +[source,yaml] +.run-hello.yaml +---- +- from: + uri: "timer:tick?period=3000" + steps: + - setBody: + constant: "Hello world from Camel K" + - to: "log:info" +---- You can run it on the cluster by executing: -``` -kamel run hello.groovy -``` +[source] +---- +kamel run run-hello.yaml +---- Integrations can be written in any supported Camel DSL. We are collecting examples in our https://github.com/apache/camel-k/[Camel K GitHub repository]. diff --git a/docs/modules/traits/pages/3scale.adoc b/docs/modules/traits/pages/3scale.adoc index 4e410ddd0..d6fd68d9e 100755 --- a/docs/modules/traits/pages/3scale.adoc +++ b/docs/modules/traits/pages/3scale.adoc @@ -18,7 +18,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait 3scale.[key]=[value] --trait 3scale.[key2]=[value2] integration.groovy +$ kamel run --trait 3scale.[key]=[value] --trait 3scale.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/affinity.adoc b/docs/modules/traits/pages/affinity.adoc index 91691b40f..5f9efc5e8 100755 --- a/docs/modules/traits/pages/affinity.adoc +++ b/docs/modules/traits/pages/affinity.adoc @@ -18,7 +18,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait affinity.[key]=[value] --trait affinity.[key2]=[value2] integration.groovy +$ kamel run --trait affinity.[key]=[value] --trait affinity.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/aws-secrets-manager.adoc b/docs/modules/traits/pages/aws-secrets-manager.adoc index 7bf60ee29..96db11ead 100644 --- a/docs/modules/traits/pages/aws-secrets-manager.adoc +++ b/docs/modules/traits/pages/aws-secrets-manager.adoc @@ -27,7 +27,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait aws-secrets-manager.[key]=[value] --trait aws-secrets-manager.[key2]=[value2] integration.groovy +$ kamel run --trait aws-secrets-manager.[key]=[value] --trait aws-secrets-manager.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/azure-key-vault.adoc b/docs/modules/traits/pages/azure-key-vault.adoc index 79873afcb..454e11fd7 100644 --- a/docs/modules/traits/pages/azure-key-vault.adoc +++ b/docs/modules/traits/pages/azure-key-vault.adoc @@ -27,7 +27,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait azure-key-vault.[key]=[value] --trait azure-key-vault.[key2]=[value2] integration.groovy +$ kamel run --trait azure-key-vault.[key]=[value] --trait azure-key-vault.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/builder.adoc b/docs/modules/traits/pages/builder.adoc index af1d9a6c5..7f3c280f3 100755 --- a/docs/modules/traits/pages/builder.adoc +++ b/docs/modules/traits/pages/builder.adoc @@ -18,7 +18,7 @@ NOTE: The builder trait is a *platform trait* and cannot be disabled by the user Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait builder.[key]=[value] --trait builder.[key2]=[value2] integration.groovy +$ kamel run --trait builder.[key]=[value] --trait builder.[key2]=[value2] integration.yaml ---- The following configuration options are available: @@ -144,5 +144,5 @@ Node selectors can be specified when running an integration with the CLI: [source,console] ---- -$ kamel run --trait builder.node-selector.'size'=large integration.groovy +$ kamel run --trait builder.node-selector.'size'=large integration.yaml ---- diff --git a/docs/modules/traits/pages/camel.adoc b/docs/modules/traits/pages/camel.adoc index b6cde7896..82f381043 100755 --- a/docs/modules/traits/pages/camel.adoc +++ b/docs/modules/traits/pages/camel.adoc @@ -17,7 +17,7 @@ NOTE: The camel trait is a *platform trait* and cannot be disabled by the user. Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait camel.[key]=[value] --trait camel.[key2]=[value2] integration.groovy +$ kamel run --trait camel.[key]=[value] --trait camel.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/container.adoc b/docs/modules/traits/pages/container.adoc index 936a15665..39551b17f 100755 --- a/docs/modules/traits/pages/container.adoc +++ b/docs/modules/traits/pages/container.adoc @@ -19,7 +19,7 @@ NOTE: The container trait is a *platform trait* and cannot be disabled by the us Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait container.[key]=[value] --trait container.[key2]=[value2] integration.groovy +$ kamel run --trait container.[key]=[value] --trait container.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/cron.adoc b/docs/modules/traits/pages/cron.adoc index 2134f8ef2..4edbcce95 100755 --- a/docs/modules/traits/pages/cron.adoc +++ b/docs/modules/traits/pages/cron.adoc @@ -32,7 +32,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait cron.[key]=[value] --trait cron.[key2]=[value2] integration.groovy +$ kamel run --trait cron.[key]=[value] --trait cron.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/deployer.adoc b/docs/modules/traits/pages/deployer.adoc index ebcd18e0b..a220f1b3c 100755 --- a/docs/modules/traits/pages/deployer.adoc +++ b/docs/modules/traits/pages/deployer.adoc @@ -18,7 +18,7 @@ NOTE: The deployer trait is a *platform trait* and cannot be disabled by the use Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait deployer.[key]=[value] --trait deployer.[key2]=[value2] integration.groovy +$ kamel run --trait deployer.[key]=[value] --trait deployer.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/deployment.adoc b/docs/modules/traits/pages/deployment.adoc index 2127bb342..b1098aeb1 100755 --- a/docs/modules/traits/pages/deployment.adoc +++ b/docs/modules/traits/pages/deployment.adoc @@ -18,7 +18,7 @@ NOTE: The deployment trait is a *platform trait* and cannot be disabled by the u Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait deployment.[key]=[value] --trait deployment.[key2]=[value2] integration.groovy +$ kamel run --trait deployment.[key]=[value] --trait deployment.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/environment.adoc b/docs/modules/traits/pages/environment.adoc index adfdca710..d40ab6a5a 100755 --- a/docs/modules/traits/pages/environment.adoc +++ b/docs/modules/traits/pages/environment.adoc @@ -18,7 +18,7 @@ NOTE: The environment trait is a *platform trait* and cannot be disabled by the Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait environment.[key]=[value] --trait environment.[key2]=[value2] integration.groovy +$ kamel run --trait environment.[key]=[value] --trait environment.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/error-handler.adoc b/docs/modules/traits/pages/error-handler.adoc index 4695216cb..d30201802 100755 --- a/docs/modules/traits/pages/error-handler.adoc +++ b/docs/modules/traits/pages/error-handler.adoc @@ -17,7 +17,7 @@ NOTE: The error-handler trait is a *platform trait* and cannot be disabled by th Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait error-handler.[key]=[value] --trait error-handler.[key2]=[value2] integration.groovy +$ kamel run --trait error-handler.[key]=[value] --trait error-handler.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/gc.adoc b/docs/modules/traits/pages/gc.adoc index 86827d06f..a16cd570a 100755 --- a/docs/modules/traits/pages/gc.adoc +++ b/docs/modules/traits/pages/gc.adoc @@ -15,7 +15,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait gc.[key]=[value] --trait gc.[key2]=[value2] integration.groovy +$ kamel run --trait gc.[key]=[value] --trait gc.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/gcp-secret-manager.adoc b/docs/modules/traits/pages/gcp-secret-manager.adoc index ab754fc4e..257f1824c 100644 --- a/docs/modules/traits/pages/gcp-secret-manager.adoc +++ b/docs/modules/traits/pages/gcp-secret-manager.adoc @@ -27,7 +27,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait gcp-secret-manager.[key]=[value] --trait gcp-secret-manager.[key2]=[value2] integration.groovy +$ kamel run --trait gcp-secret-manager.[key]=[value] --trait gcp-secret-manager.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/hashicorp-vault.adoc b/docs/modules/traits/pages/hashicorp-vault.adoc index 337f86ae7..8adb2106b 100644 --- a/docs/modules/traits/pages/hashicorp-vault.adoc +++ b/docs/modules/traits/pages/hashicorp-vault.adoc @@ -23,7 +23,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait hashicorp-vault.[key]=[value] --trait hashicorp-vault.[key2]=[value2] integration.groovy +$ kamel run --trait hashicorp-vault.[key]=[value] --trait hashicorp-vault.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/health.adoc b/docs/modules/traits/pages/health.adoc index d6c4a1087..d8f1dcba0 100755 --- a/docs/modules/traits/pages/health.adoc +++ b/docs/modules/traits/pages/health.adoc @@ -17,7 +17,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait health.[key]=[value] --trait health.[key2]=[value2] integration.groovy +$ kamel run --trait health.[key]=[value] --trait health.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/ingress.adoc b/docs/modules/traits/pages/ingress.adoc index 788eed27a..bf26cee14 100755 --- a/docs/modules/traits/pages/ingress.adoc +++ b/docs/modules/traits/pages/ingress.adoc @@ -18,7 +18,7 @@ This trait is available in the following profiles: **Kubernetes**. Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait ingress.[key]=[value] --trait ingress.[key2]=[value2] integration.groovy +$ kamel run --trait ingress.[key]=[value] --trait ingress.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/istio.adoc b/docs/modules/traits/pages/istio.adoc index 4c707c391..230f567bb 100755 --- a/docs/modules/traits/pages/istio.adoc +++ b/docs/modules/traits/pages/istio.adoc @@ -16,7 +16,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait istio.[key]=[value] --trait istio.[key2]=[value2] integration.groovy +$ kamel run --trait istio.[key]=[value] --trait istio.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/jolokia.adoc b/docs/modules/traits/pages/jolokia.adoc index 3ce989fc2..59456761b 100755 --- a/docs/modules/traits/pages/jolokia.adoc +++ b/docs/modules/traits/pages/jolokia.adoc @@ -17,7 +17,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait jolokia.[key]=[value] --trait jolokia.[key2]=[value2] integration.groovy +$ kamel run --trait jolokia.[key]=[value] --trait jolokia.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/jvm.adoc b/docs/modules/traits/pages/jvm.adoc index 458b3daf6..a9b1ed480 100755 --- a/docs/modules/traits/pages/jvm.adoc +++ b/docs/modules/traits/pages/jvm.adoc @@ -17,7 +17,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait jvm.[key]=[value] --trait jvm.[key2]=[value2] integration.groovy +$ kamel run --trait jvm.[key]=[value] --trait jvm.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/kamelets.adoc b/docs/modules/traits/pages/kamelets.adoc index 632790c19..59e460e07 100755 --- a/docs/modules/traits/pages/kamelets.adoc +++ b/docs/modules/traits/pages/kamelets.adoc @@ -15,7 +15,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait kamelets.[key]=[value] --trait kamelets.[key2]=[value2] integration.groovy +$ kamel run --trait kamelets.[key]=[value] --trait kamelets.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/keda.adoc b/docs/modules/traits/pages/keda.adoc index 6c41a9ba4..f5bf8ec4e 100644 --- a/docs/modules/traits/pages/keda.adoc +++ b/docs/modules/traits/pages/keda.adoc @@ -24,7 +24,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait keda.[key]=[value] --trait keda.[key2]=[value2] integration.groovy +$ kamel run --trait keda.[key]=[value] --trait keda.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/knative-service.adoc b/docs/modules/traits/pages/knative-service.adoc index 4449d90df..5d8ebbedf 100755 --- a/docs/modules/traits/pages/knative-service.adoc +++ b/docs/modules/traits/pages/knative-service.adoc @@ -19,7 +19,7 @@ This trait is available in the following profiles: **Knative**. Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait knative-service.[key]=[value] --trait knative-service.[key2]=[value2] integration.groovy +$ kamel run --trait knative-service.[key]=[value] --trait knative-service.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/knative.adoc b/docs/modules/traits/pages/knative.adoc index 5b65347e6..d22f19f07 100755 --- a/docs/modules/traits/pages/knative.adoc +++ b/docs/modules/traits/pages/knative.adoc @@ -20,7 +20,7 @@ This trait is available in the following profiles: **Knative**. Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait knative.[key]=[value] --trait knative.[key2]=[value2] integration.groovy +$ kamel run --trait knative.[key]=[value] --trait knative.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/logging.adoc b/docs/modules/traits/pages/logging.adoc index 2906c75e2..4191c4de2 100755 --- a/docs/modules/traits/pages/logging.adoc +++ b/docs/modules/traits/pages/logging.adoc @@ -16,7 +16,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait logging.[key]=[value] --trait logging.[key2]=[value2] integration.groovy +$ kamel run --trait logging.[key]=[value] --trait logging.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/master.adoc b/docs/modules/traits/pages/master.adoc index 01a412c0b..e120f47b2 100755 --- a/docs/modules/traits/pages/master.adoc +++ b/docs/modules/traits/pages/master.adoc @@ -21,7 +21,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait master.[key]=[value] --trait master.[key2]=[value2] integration.groovy +$ kamel run --trait master.[key]=[value] --trait master.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/mount.adoc b/docs/modules/traits/pages/mount.adoc index ba74bfc58..46a0915f5 100644 --- a/docs/modules/traits/pages/mount.adoc +++ b/docs/modules/traits/pages/mount.adoc @@ -17,7 +17,7 @@ NOTE: The mount trait is a *platform trait* and cannot be disabled by the user. Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait mount.[key]=[value] --trait mount.[key2]=[value2] integration.groovy +$ kamel run --trait mount.[key]=[value] --trait mount.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/openapi.adoc b/docs/modules/traits/pages/openapi.adoc index 6d6de25fc..f5148671f 100755 --- a/docs/modules/traits/pages/openapi.adoc +++ b/docs/modules/traits/pages/openapi.adoc @@ -17,7 +17,7 @@ NOTE: The openapi trait is a *platform trait* and cannot be disabled by the user Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait openapi.[key]=[value] --trait openapi.[key2]=[value2] integration.groovy +$ kamel run --trait openapi.[key]=[value] --trait openapi.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/owner.adoc b/docs/modules/traits/pages/owner.adoc index 8ad3805e6..75ff69584 100755 --- a/docs/modules/traits/pages/owner.adoc +++ b/docs/modules/traits/pages/owner.adoc @@ -18,7 +18,7 @@ NOTE: The owner trait is a *platform trait* and cannot be disabled by the user. Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait owner.[key]=[value] --trait owner.[key2]=[value2] integration.groovy +$ kamel run --trait owner.[key]=[value] --trait owner.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/pdb.adoc b/docs/modules/traits/pages/pdb.adoc index b2c3280c7..92da7934f 100755 --- a/docs/modules/traits/pages/pdb.adoc +++ b/docs/modules/traits/pages/pdb.adoc @@ -15,7 +15,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait pdb.[key]=[value] --trait pdb.[key2]=[value2] integration.groovy +$ kamel run --trait pdb.[key]=[value] --trait pdb.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/platform.adoc b/docs/modules/traits/pages/platform.adoc index 449667d0c..e9abaac50 100755 --- a/docs/modules/traits/pages/platform.adoc +++ b/docs/modules/traits/pages/platform.adoc @@ -21,7 +21,7 @@ NOTE: The platform trait is a *platform trait* and cannot be disabled by the use Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait platform.[key]=[value] --trait platform.[key2]=[value2] integration.groovy +$ kamel run --trait platform.[key]=[value] --trait platform.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/pod.adoc b/docs/modules/traits/pages/pod.adoc index c87e4f5fa..19593a564 100755 --- a/docs/modules/traits/pages/pod.adoc +++ b/docs/modules/traits/pages/pod.adoc @@ -19,7 +19,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh [source,console] ---- -$ kamel run integration.groovy --pod-template template.yaml --env TEST_VARIABLE=will_be_overriden --env ANOTHER_VARIABLE=Im_There +$ kamel run integration.yaml --pod-template template.yaml --env TEST_VARIABLE=will_be_overriden --env ANOTHER_VARIABLE=Im_There ---- The value from the template overwrites the `TEST_VARIABLE` environment variable, while `ANOTHER_VARIABLE` stays unchanged. @@ -32,7 +32,7 @@ The value from the template overwrites the `TEST_VARIABLE` environment variable, Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait pod.[key]=[value] integration.groovy +$ kamel run --trait pod.[key]=[value] integration.yaml ---- The following configuration options are available: @@ -52,20 +52,21 @@ The following configuration options are available: With the following Integration, that reads files from a directory: -.integration.groovy -[source,groovy] +[source,yaml] +.pod-trait-route.yaml ---- -from('file:///var/log') - .convertBodyTo(String.class) - .setBody().simple('${body}: {{TEST_VARIABLE}} ') - .log('${body}') - +- from: + uri: "file:///var/log" + steps: + - setBody: + simple: "${body}: {{TEST_VARIABLE}}" + - to: "log:info" ---- Plus the following Pod template, that adds a sidecar container to the Integration Pod, generating some data into the directory, and mounts it into the `integration` container: -.template.yaml [source,yaml] +.pod-trait-template.yaml ---- containers: - name: integration @@ -90,15 +91,13 @@ The Integration route logs the content of the file generated by the sidecar cont [source,console] ---- -$ kamel run integration.groovy --pod-template template.yaml +kamel run pod-trait-route.yaml --pod-template pod-trait-template.yaml ... -Condition "Ready" is "True" for Integration integration -[1] 2021-04-30 07:40:03,136 INFO [route1] (Camel (camel-1) thread #0 - file:///var/log) Fri Apr 30 07:40:02 UTC 2021 Content from the sidecar container -[1] : hello from the template -[1] 2021-04-30 07:40:04,140 INFO [route1] (Camel (camel-1) thread #0 - file:///var/log) Fri Apr 30 07:40:03 UTC 2021 Content from the sidecar container -[1] : hello from the template -[1] 2021-04-30 07:40:05,142 INFO [route1] (Camel (camel-1) thread #0 - file:///var/log) Fri Apr 30 07:40:04 UTC 2021 Content from the sidecar container -[1] : hello from the template +Condition "Ready" is "True" for Integration pod-trait-route: 1/1 ready replicas +Integration "pod-trait-route" in phase "Running" +[1] 2024-05-15 11:32:30,562 INFO [info] (Camel (camel-1) thread #1 - file:///var/log) Exchange[ExchangePattern: InOnly, BodyType: String, Body: Wed May 15 11:32:30 UTC 2024 Content from the sidecar container: hello from the template] +[1] 2024-05-15 11:32:31,574 INFO [info] (Camel (camel-1) thread #1 - file:///var/log) Exchange[ExchangePattern: InOnly, BodyType: String, Body: Wed May 15 11:32:31 UTC 2024 Content from the sidecar container: hello from the template] +[1] 2024-05-15 11:32:32,583 INFO [info] (Camel (camel-1) thread #1 - file:///var/log) Exchange[ExchangePattern: InOnly, BodyType: String, Body: Wed May 15 11:32:32 UTC 2024 Content from the sidecar container: hello from the template] ---- == Init containers diff --git a/docs/modules/traits/pages/prometheus.adoc b/docs/modules/traits/pages/prometheus.adoc index 82d19c075..ae6aa3774 100755 --- a/docs/modules/traits/pages/prometheus.adoc +++ b/docs/modules/traits/pages/prometheus.adoc @@ -26,7 +26,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait prometheus.[key]=[value] --trait prometheus.[key2]=[value2] integration.groovy +$ kamel run --trait prometheus.[key]=[value] --trait prometheus.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/pull-secret.adoc b/docs/modules/traits/pages/pull-secret.adoc index 8c736917a..9a1b410cf 100755 --- a/docs/modules/traits/pages/pull-secret.adoc +++ b/docs/modules/traits/pages/pull-secret.adoc @@ -24,7 +24,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait pull-secret.[key]=[value] --trait pull-secret.[key2]=[value2] integration.groovy +$ kamel run --trait pull-secret.[key]=[value] --trait pull-secret.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/quarkus.adoc b/docs/modules/traits/pages/quarkus.adoc index 2531673fc..1521ed036 100755 --- a/docs/modules/traits/pages/quarkus.adoc +++ b/docs/modules/traits/pages/quarkus.adoc @@ -23,7 +23,7 @@ NOTE: The quarkus trait is a *platform trait* and cannot be disabled by the user Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait quarkus.[key]=[value] --trait quarkus.[key2]=[value2] integration.groovy +$ kamel run --trait quarkus.[key]=[value] --trait quarkus.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/registry.adoc b/docs/modules/traits/pages/registry.adoc index 209415495..3043f2d21 100644 --- a/docs/modules/traits/pages/registry.adoc +++ b/docs/modules/traits/pages/registry.adoc @@ -19,7 +19,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait registry.[key]=[value] integration.groovy +$ kamel run --trait registry.[key]=[value] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/resume.adoc b/docs/modules/traits/pages/resume.adoc index 4a5c08352..894fe4d12 100644 --- a/docs/modules/traits/pages/resume.adoc +++ b/docs/modules/traits/pages/resume.adoc @@ -28,7 +28,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait resume.[key]=[value] --trait resume.[key2]=[value2] integration.groovy +$ kamel run --trait resume.[key]=[value] --trait resume.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/route.adoc b/docs/modules/traits/pages/route.adoc index deb4d0cd4..246d8255b 100755 --- a/docs/modules/traits/pages/route.adoc +++ b/docs/modules/traits/pages/route.adoc @@ -23,7 +23,7 @@ This trait is available in the following profiles: **OpenShift**. Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait route.[key]=[value] --trait route.[key2]=[value2] integration.groovy +$ kamel run --trait route.[key]=[value] --trait route.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/security-context.adoc b/docs/modules/traits/pages/security-context.adoc index 516dda804..d53378caf 100644 --- a/docs/modules/traits/pages/security-context.adoc +++ b/docs/modules/traits/pages/security-context.adoc @@ -17,7 +17,7 @@ NOTE: The security-context trait is a *platform trait* and cannot be disabled by Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait security-context.[key]=[value] --trait security-context.[key2]=[value2] integration.groovy +$ kamel run --trait security-context.[key]=[value] --trait security-context.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/service-binding.adoc b/docs/modules/traits/pages/service-binding.adoc index 9638113ac..73582ad98 100755 --- a/docs/modules/traits/pages/service-binding.adoc +++ b/docs/modules/traits/pages/service-binding.adoc @@ -17,7 +17,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait service-binding.[key]=[value] --trait service-binding.[key2]=[value2] integration.groovy +$ kamel run --trait service-binding.[key]=[value] --trait service-binding.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/service.adoc b/docs/modules/traits/pages/service.adoc index 14c59f7c2..97bb436ac 100755 --- a/docs/modules/traits/pages/service.adoc +++ b/docs/modules/traits/pages/service.adoc @@ -18,7 +18,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait service.[key]=[value] --trait service.[key2]=[value2] integration.groovy +$ kamel run --trait service.[key]=[value] --trait service.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/telemetry.adoc b/docs/modules/traits/pages/telemetry.adoc index 18945f57b..44f54204e 100644 --- a/docs/modules/traits/pages/telemetry.adoc +++ b/docs/modules/traits/pages/telemetry.adoc @@ -21,7 +21,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait telemetry.[key]=[value] --trait telemetry.[key2]=[value2] integration.groovy +$ kamel run --trait telemetry.[key]=[value] --trait telemetry.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/toleration.adoc b/docs/modules/traits/pages/toleration.adoc index 9b5bb1864..ac8aa6833 100755 --- a/docs/modules/traits/pages/toleration.adoc +++ b/docs/modules/traits/pages/toleration.adoc @@ -26,7 +26,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait toleration.[key]=[value] --trait toleration.[key2]=[value2] integration.groovy +$ kamel run --trait toleration.[key]=[value] --trait toleration.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/tracing.adoc b/docs/modules/traits/pages/tracing.adoc index 1b25ba194..26d638f8e 100644 --- a/docs/modules/traits/pages/tracing.adoc +++ b/docs/modules/traits/pages/tracing.adoc @@ -24,7 +24,7 @@ This trait is available in the following profiles: **Kubernetes, Knative, OpenSh Trait properties can be specified when running any integration with the CLI: [source,console] ---- -$ kamel run --trait tracing.[key]=[value] --trait tracing.[key2]=[value2] integration.groovy +$ kamel run --trait tracing.[key]=[value] --trait tracing.[key2]=[value2] integration.yaml ---- The following configuration options are available: diff --git a/docs/modules/traits/pages/traits.adoc b/docs/modules/traits/pages/traits.adoc index 1f2135996..cbf1d2363 100644 --- a/docs/modules/traits/pages/traits.adoc +++ b/docs/modules/traits/pages/traits.adoc @@ -15,9 +15,10 @@ Each trait has a unique ID that can be used to configure it using the command li E.g. in order to disable the creation of a Service for a integration, a user can execute: -``` -kamel run --trait service.enabled=false file.groovy -``` +[source] +---- +kamel run --trait service.enabled=false file.yaml +---- The flag `--trait` can be also abbreviated with `-t`. diff --git a/e2e/advanced/build_order_strategy_test.go b/e2e/advanced/build_order_strategy_test.go index 7ba0de40e..15798e9e5 100644 --- a/e2e/advanced/build_order_strategy_test.go +++ b/e2e/advanced/build_order_strategy_test.go @@ -59,8 +59,8 @@ func TestRunBuildOrderStrategyMatchingDependencies(t *testing.T) { integrationC := RandomizedSuffixName("java-c") g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/Java.java", "--name", integrationC, "-d", "camel:cron", "-d", "camel:zipfile").Execute()).To(Succeed()) - integrationZ := RandomizedSuffixName("groovy-z") - g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-source.groovy", "--name", integrationZ).Execute()).To(Succeed()) + integrationZ := RandomizedSuffixName("yaml-z") + g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-source.yaml", "--name", integrationZ).Execute()).To(Succeed()) g.Eventually(IntegrationKit(t, ctx, ns, integrationB), TestTimeoutMedium).ShouldNot(BeEmpty()) g.Eventually(IntegrationKit(t, ctx, ns, integrationC), TestTimeoutMedium).ShouldNot(BeEmpty()) @@ -132,8 +132,8 @@ func TestRunBuildOrderStrategyFIFO(t *testing.T) { "-d", "camel:joor", ).Execute()).To(Succeed()) - integrationZ := RandomizedSuffixName("groovy-z") - g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-source.groovy", + integrationZ := RandomizedSuffixName("yaml-z") + g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-source.yaml", "--name", integrationZ, ).Execute()).To(Succeed()) diff --git a/e2e/advanced/files/promote-route-edited.groovy b/e2e/advanced/files/promote-route-edited.groovy deleted file mode 100644 index ab680d7bb..000000000 --- a/e2e/advanced/files/promote-route-edited.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('timer:configmap') - .setBody() - .simple("resource:classpath:my-configmap-key") - .log('configmap: ${body}') \ No newline at end of file diff --git a/docs/local-build.sh b/e2e/advanced/files/promote-route-edited.yaml old mode 100755 new mode 100644 similarity index 77% copy from docs/local-build.sh copy to e2e/advanced/files/promote-route-edited.yaml index 6e0b63f89..448240a69 --- a/docs/local-build.sh +++ b/e2e/advanced/files/promote-route-edited.yaml @@ -1,6 +1,5 @@ -#!/bin/sh +# 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. @@ -15,10 +14,12 @@ # 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. -# - -CW=./../../camel-website -LOCAL=./../camel-k -cd $CW || (echo 'camel-website not in expected location $CW' && exit) -./antora-local-build.sh $LOCAL $* +- from: + uri: "timer:configmap" + steps: + - setBody: + simple: "resource:classpath:my-configmap-key" + - setBody: + simple: "configmap: ${body}" + - to: "log:info" diff --git a/e2e/advanced/files/promote-route.groovy b/e2e/advanced/files/promote-route.groovy deleted file mode 100644 index 943a4ab91..000000000 --- a/e2e/advanced/files/promote-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. - */ - -from('timer:configmap') - .setBody() - .simple("resource:classpath:my-configmap-key") - .log('configmap: ${body}') - .setBody() - .simple("resource:classpath:my-secret-key") - .log('secret: ${body}') \ No newline at end of file diff --git a/docs/local-build.sh b/e2e/advanced/files/promote-route.yaml old mode 100755 new mode 100644 similarity index 67% copy from docs/local-build.sh copy to e2e/advanced/files/promote-route.yaml index 6e0b63f89..cb915b6ef --- a/docs/local-build.sh +++ b/e2e/advanced/files/promote-route.yaml @@ -1,6 +1,5 @@ -#!/bin/sh +# 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. @@ -15,10 +14,17 @@ # 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. -# - -CW=./../../camel-website -LOCAL=./../camel-k -cd $CW || (echo 'camel-website not in expected location $CW' && exit) -./antora-local-build.sh $LOCAL $* +- from: + uri: "timer:configmap" + steps: + - setBody: + simple: "resource:classpath:my-configmap-key" + - setBody: + simple: "configmap: ${body}" + - to: "log:info" + - setBody: + simple: "resource:classpath:my-secret-key" + - setBody: + simple: "secret: ${body}" + - to: "log:info" diff --git a/e2e/advanced/files/timer-kamelet-usage.groovy b/e2e/advanced/files/timer-kamelet-usage.groovy deleted file mode 100644 index 11ad5bb27..000000000 --- a/e2e/advanced/files/timer-kamelet-usage.groovy +++ /dev/null @@ -1,19 +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. - */ - -from('kamelet:my-own-timer-source?message=Hello+world') - .to('log:info?showAll=false') diff --git a/docs/local-build.sh b/e2e/advanced/files/timer-kamelet-usage.yaml old mode 100755 new mode 100644 similarity index 82% copy from docs/local-build.sh copy to e2e/advanced/files/timer-kamelet-usage.yaml index 6e0b63f89..c04b36b55 --- a/docs/local-build.sh +++ b/e2e/advanced/files/timer-kamelet-usage.yaml @@ -1,6 +1,3 @@ -#!/bin/sh - -# # 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. @@ -15,10 +12,8 @@ # 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. -# - -CW=./../../camel-website -LOCAL=./../camel-k -cd $CW || (echo 'camel-website not in expected location $CW' && exit) -./antora-local-build.sh $LOCAL $* +- from: + uri: "kamelet:my-own-timer-source?message=Hello+world" + steps: + - to: "log:info?showAll=false" diff --git a/e2e/advanced/files/timer-source.groovy b/e2e/advanced/files/timer-source.groovy deleted file mode 100644 index 9c2901ba2..000000000 --- a/e2e/advanced/files/timer-source.groovy +++ /dev/null @@ -1,20 +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('kamelet:timer-source?message=Magicstring!&period=3000') - .to('log:info?showAll=false') diff --git a/docs/local-build.sh b/e2e/advanced/files/timer-source.yaml old mode 100755 new mode 100644 similarity index 82% copy from docs/local-build.sh copy to e2e/advanced/files/timer-source.yaml index 6e0b63f89..e80528db1 --- a/docs/local-build.sh +++ b/e2e/advanced/files/timer-source.yaml @@ -1,6 +1,5 @@ -#!/bin/sh +# 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. @@ -15,10 +14,8 @@ # 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. -# - -CW=./../../camel-website -LOCAL=./../camel-k -cd $CW || (echo 'camel-website not in expected location $CW' && exit) -./antora-local-build.sh $LOCAL $* +- from: + uri: "kamelet:timer-source?message=Magicstring!&period=3000" + steps: + - to: "log:info?showAll=false" diff --git a/e2e/advanced/main_test.go b/e2e/advanced/main_test.go index 72958a168..eb08b0b8d 100644 --- a/e2e/advanced/main_test.go +++ b/e2e/advanced/main_test.go @@ -65,7 +65,7 @@ func TestMain(m *testing.M) { g.Eventually(IntegrationConditionStatus(t, ctx, ns, "yaml", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) g.Eventually(IntegrationLogs(t, ctx, ns, "yaml"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-source.groovy").Execute()).To(Succeed()) + g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/timer-source.yaml").Execute()).To(Succeed()) g.Eventually(IntegrationPodPhase(t, ctx, ns, "timer-source"), TestTimeoutLong).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationConditionStatus(t, ctx, ns, "timer-source", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) g.Eventually(IntegrationLogs(t, ctx, ns, "timer-source"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) diff --git a/e2e/advanced/promote_test.go b/e2e/advanced/promote_test.go index 649190855..77a9b1827 100644 --- a/e2e/advanced/promote_test.go +++ b/e2e/advanced/promote_test.go @@ -49,25 +49,33 @@ func TestKamelCLIPromote(t *testing.T) { // Dev content configmap var cmData = make(map[string]string) - cmData["my-configmap-key"] = "I am development configmap!" + cmData["my-configmap-key"] = "I am development configmap" CreatePlainTextConfigmap(t, ctx, nsDev, "my-cm-promote", cmData) + // Dev secret var secData = make(map[string]string) secData["my-secret-key"] = "very top secret development" CreatePlainTextSecret(t, ctx, nsDev, "my-sec-promote", secData) + /* + kubectl create configmap my-cm-promote --from-literal=my-configmap-key="I am development configmap" + kubectl create secret generic my-sec-promote --from-literal=my-secret-key="very top secret development" + + kamel run --dev e2e/advanced/files/promote-route.yaml --config configmap:my-cm-promote --config secret:my-sec-promote + */ + t.Run("plain integration dev", func(t *testing.T) { - g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev, "./files/promote-route.groovy", "--config", "configmap:my-cm-promote", "--config", "secret:my-sec-promote").Execute()).To(Succeed()) + g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev, "./files/promote-route.yaml", "--config", "configmap:my-cm-promote", "--config", "secret:my-sec-promote").Execute()).To(Succeed()) g.Eventually(IntegrationPodPhase(t, ctx, nsDev, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationObservedGeneration(t, ctx, nsDev, "promote-route")).Should(Equal(&one)) //g.Eventually(IntegrationConditionStatus(t, nsDev, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ctx, nsDev, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am development configmap!")) + g.Eventually(IntegrationLogs(t, ctx, nsDev, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am development configmap")) g.Eventually(IntegrationLogs(t, ctx, nsDev, "promote-route"), TestTimeoutShort).Should(ContainSubstring("very top secret development")) }) t.Run("kamelet integration dev", func(t *testing.T) { g.Expect(CreateTimerKamelet(t, ctx, operatorDevID, nsDev, "my-own-timer-source")()).To(Succeed()) - g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev, "./files/timer-kamelet-usage.groovy").Execute()).To(Succeed()) + g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev, "./files/timer-kamelet-usage.yaml").Execute()).To(Succeed()) g.Eventually(IntegrationPodPhase(t, ctx, nsDev, "timer-kamelet-usage"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationLogs(t, ctx, nsDev, "timer-kamelet-usage"), TestTimeoutShort).Should(ContainSubstring("Hello world")) }) @@ -93,7 +101,7 @@ func TestKamelCLIPromote(t *testing.T) { // Prod content configmap var cmData = make(map[string]string) - cmData["my-configmap-key"] = "I am production!" + cmData["my-configmap-key"] = "I am production" CreatePlainTextConfigmap(t, ctx, nsProd, "my-cm-promote", cmData) t.Run("no secret in destination", func(t *testing.T) { @@ -110,7 +118,7 @@ func TestKamelCLIPromote(t *testing.T) { g.Eventually(IntegrationObservedGeneration(t, ctx, nsProd, "promote-route")).Should(Equal(&one)) g.Eventually(IntegrationPodPhase(t, ctx, nsProd, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationConditionStatus(t, ctx, nsProd, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ctx, nsProd, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am production!")) + g.Eventually(IntegrationLogs(t, ctx, nsProd, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am production")) g.Eventually(IntegrationLogs(t, ctx, nsProd, "promote-route"), TestTimeoutShort).Should(ContainSubstring("very top secret production")) // They must use the same image g.Expect(IntegrationPodImage(t, ctx, nsProd, "promote-route")()).Should(Equal(IntegrationPodImage(t, ctx, nsDev, "promote-route")())) @@ -118,15 +126,15 @@ func TestKamelCLIPromote(t *testing.T) { t.Run("plain integration promotion update", func(t *testing.T) { // We need to update the Integration CR in order the operator to restart it both in dev and prod envs - g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev, "./files/promote-route-edited.groovy", "--name", "promote-route", "--config", "configmap:my-cm-promote").Execute()).To(Succeed()) + g.Expect(KamelRunWithID(t, ctx, operatorDevID, nsDev, "./files/promote-route-edited.yaml", "--name", "promote-route", "--config", "configmap:my-cm-promote").Execute()).To(Succeed()) // The generation has to be incremented g.Eventually(IntegrationObservedGeneration(t, ctx, nsDev, "promote-route")).Should(Equal(&two)) g.Eventually(IntegrationPodPhase(t, ctx, nsDev, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationConditionStatus(t, ctx, nsDev, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ctx, nsDev, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am development configmap!")) + g.Eventually(IntegrationLogs(t, ctx, nsDev, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am development configmap")) // Update the configmap only in prod var cmData = make(map[string]string) - cmData["my-configmap-key"] = "I am production, but I was updated!" + cmData["my-configmap-key"] = "I am production, but I was updated" UpdatePlainTextConfigmap(t, ctx, nsProd, "my-cm-promote", cmData) // Promote the edited Integration g.Expect(Kamel(t, ctx, "promote", "-n", nsDev, "promote-route", "--to", nsProd).Execute()).To(Succeed()) @@ -134,7 +142,7 @@ func TestKamelCLIPromote(t *testing.T) { g.Eventually(IntegrationObservedGeneration(t, ctx, nsDev, "promote-route")).Should(Equal(&two)) g.Eventually(IntegrationPodPhase(t, ctx, nsProd, "promote-route"), TestTimeoutMedium).Should(Equal(corev1.PodRunning)) g.Eventually(IntegrationConditionStatus(t, ctx, nsProd, "promote-route", v1.IntegrationConditionReady), TestTimeoutShort).Should(Equal(corev1.ConditionTrue)) - g.Eventually(IntegrationLogs(t, ctx, nsProd, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am production, but I was updated!")) + g.Eventually(IntegrationLogs(t, ctx, nsProd, "promote-route"), TestTimeoutShort).Should(ContainSubstring("I am production, but I was updated")) // They must use the same image g.Expect(IntegrationPodImage(t, ctx, nsProd, "promote-route")()).Should(Equal(IntegrationPodImage(t, ctx, nsDev, "promote-route")())) }) diff --git a/docs/local-build.sh b/e2e/builder/files/example.yaml old mode 100755 new mode 100644 similarity index 79% copy from docs/local-build.sh copy to e2e/builder/files/example.yaml index 6e0b63f89..861535412 --- a/docs/local-build.sh +++ b/e2e/builder/files/example.yaml @@ -1,6 +1,3 @@ -#!/bin/sh - -# # 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. @@ -15,10 +12,13 @@ # 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. -# - -CW=./../../camel-website -LOCAL=./../camel-k -cd $CW || (echo 'camel-website not in expected location $CW' && exit) -./antora-local-build.sh $LOCAL $* +- from: + uri: "timer:tick" + steps: + - setHeader: + name: "m" + simple: "string!" + - setBody: + simple: "Magic${header.m}" + - to: "log:info?showAll=false" diff --git a/e2e/builder/files/groovy.groovy b/e2e/builder/files/groovy.groovy deleted file mode 100644 index f87d81567..000000000 --- a/e2e/builder/files/groovy.groovy +++ /dev/null @@ -1,23 +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. - */ - -from('timer:groovy?period=1000') - .routeId('groovy') - .setHeader("m").constant("string!") - .setBody() - .simple('Magic${header.m}') - .to('log:info?showAll=false') diff --git a/e2e/builder/registry_test.go b/e2e/builder/registry_test.go index 4eb413cb5..c8fcbb05c 100644 --- a/e2e/builder/registry_test.go +++ b/e2e/builder/registry_test.go @@ -46,10 +46,10 @@ func TestRunWithDockerHubRegistry(t *testing.T) { operatorID := "camel-k-docker-hub" g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--registry", "docker.io", "--organization", user, "--registry-auth-username", user, "--registry-auth-password", pass, "--cluster-type", "kubernetes")).To(Succeed()) - g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/groovy.groovy").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "groovy"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationLogs(t, ctx, ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - g.Eventually(IntegrationPodImage(t, ctx, ns, "groovy"), TestTimeoutShort).Should(HavePrefix("docker.io")) + g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/example.yaml").Execute()).To(Succeed()) + g.Eventually(IntegrationPodPhase(t, ctx, ns, "example"), TestTimeoutLong).Should(Equal(v1.PodRunning)) + g.Eventually(IntegrationLogs(t, ctx, ns, "example"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + g.Eventually(IntegrationPodImage(t, ctx, ns, "example"), TestTimeoutShort).Should(HavePrefix("docker.io")) g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) }) @@ -68,10 +68,10 @@ func TestRunWithGithubPackagesRegistry(t *testing.T) { operatorID := "camel-k-github-registry" g.Expect(KamelInstallWithID(t, ctx, operatorID, ns, "--registry", "docker.pkg.github.com", "--organization", repo, "--registry-auth-username", user, "--registry-auth-password", pass, "--cluster-type", "kubernetes")).To(Succeed()) - g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/groovy.groovy").Execute()).To(Succeed()) - g.Eventually(IntegrationPodPhase(t, ctx, ns, "groovy"), TestTimeoutLong).Should(Equal(v1.PodRunning)) - g.Eventually(IntegrationLogs(t, ctx, ns, "groovy"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) - g.Eventually(IntegrationPodImage(t, ctx, ns, "groovy"), TestTimeoutShort).Should(HavePrefix("docker.pkg.github.com")) + g.Expect(KamelRunWithID(t, ctx, operatorID, ns, "files/example.yaml").Execute()).To(Succeed()) + g.Eventually(IntegrationPodPhase(t, ctx, ns, "example"), TestTimeoutLong).Should(Equal(v1.PodRunning)) + g.Eventually(IntegrationLogs(t, ctx, ns, "example"), TestTimeoutShort).Should(ContainSubstring("Magicstring!")) + g.Eventually(IntegrationPodImage(t, ctx, ns, "example"), TestTimeoutShort).Should(HavePrefix("docker.pkg.github.com")) g.Expect(Kamel(t, ctx, "delete", "--all", "-n", ns).Execute()).To(Succeed()) })