Skip to content

Commit

Permalink
(apache#56) Update generic user-config
Browse files Browse the repository at this point in the history
  • Loading branch information
tdiesler committed May 22, 2024
1 parent 2b24658 commit db3fbc2
Show file tree
Hide file tree
Showing 34 changed files with 363 additions and 526 deletions.
58 changes: 31 additions & 27 deletions generic-examples/user-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,55 +6,59 @@ These examples use the Camel-k CLI `kamel run ...` command.

## Configuration properties

These examples show the different ways you can **properties** to configure integrations.
These examples show the different ways you can use **properties** to configure integrations.

* provide build time properties with `--build-property`
* `build-property-route.groovy`
* `build-property-file-route.groovy`
* `kamel run --dev --build-property=quarkus.application.name=my-super-application build-property-route.yaml`
* `kamel run --dev --build-property=file:quarkus.properties build-property-file-route.yaml`

* provide runtime properties with `-p`
* `property-file-route.groovy`
* `property-route.groovy`
* `kamel run --dev -p file:my.properties property-file-route.yaml`
* `kamel run --dev -p my.message=test-property property-route.yaml`

## Configuration Configmap

These examples show the different ways you can use **ConfigMaps** to configure integrations.

* provide properties from a configmap with `--config`
* `config-configmap-route.groovy`

```
kubectl create configmap my-cm --from-literal=my-configmap-key="configmap content"
kamel run --dev --config configmap:my-cm config-configmap-route.yaml
```

* provide properties from a configmap with `--resource`
* `resource-configmap-route.groovy`
* `resource-configmap-location-route.groovy`
* `resource-configmap-key-location-route.groovy`

```
kamel run --dev --resource configmap:my-cm resource-configmap-route.yaml
kamel run --dev --resource configmap:my-cm@/tmp/app/data resource-configmap-location-route.yaml
kubectl create configmap my-cm-multi --from-literal=my-configmap-key="configmap content" --from-literal=my-configmap-key-2="another content"
kamel run --dev --resource configmap:my-cm-multi/my-configmap-key-2@/tmp/app/data/test.txt resource-configmap-key-location-route.yaml
```

## Configuration Secret

These examples show the different ways you can use **Secrets** to configure integrations.

* provide properties from a secret with `--config`
* `config-secret-route.groovy`
* `config-secret-property-route.groovy`
* `config-secret-key-route.groovy`

* provide properties from a secret with `--resource`
* `resource-secret-route.groovy`
* `resource-secret-location-route.groovy`


```
kubectl create secret generic my-sec --from-literal=my-secret-key="very top secret"
kamel run --dev --config secret:my-sec config-secret-route.yaml
## Configuration Resource file (Camel-K <= 1.12.1)
kubectl create secret generic my-secret-properties --from-file=my.properties
kamel run --dev --config secret:my-secret-properties config-secret-property-route.yaml
**These examples only work with a version of Camel-K <= 1.12.1**
kubectl create secret generic my-sec-multi --from-literal=my-secret-key="very top secret" --from-literal=my-secret-key-2="even more secret"
kamel run --dev --config secret:my-sec-multi/my-secret-key-2 config-secret-key-route.yaml
```

These examples show the different ways you can use **resource files** to configure integrations.
* provide properties from a secret with `--resource`

* provide properties from a resource file with `--config`
* `config-file-route.groovy`
```
kamel run --dev --resource secret:my-sec resource-secret-route.yaml
* provide properties from a resource file with `--resource`
* `resource-file-route.groovy`
* `resource-file-location-route.groovy`
* `resource-file-binary-route.groovy`
* `resource-file-base64-route.groovy`
kamel run --dev --resource secret:my-sec@/tmp/app/data resource-secret-location-route.yaml
```
29 changes: 0 additions & 29 deletions generic-examples/user-config/build-property-file-route.groovy

This file was deleted.

25 changes: 25 additions & 0 deletions generic-examples/user-config/build-property-file-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# camel-k: language=yaml

# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------

- from:
uri: "timer:build-property"
steps:
- setBody:
simple: "The application name: {{quarkus.application.name}}"
- to: "log:info"
29 changes: 0 additions & 29 deletions generic-examples/user-config/build-property-route.groovy

This file was deleted.

25 changes: 25 additions & 0 deletions generic-examples/user-config/build-property-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# camel-k: language=yaml

# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------

- from:
uri: "timer:build-property"
steps:
- setBody:
simple: "The application name: {{quarkus.application.name}}"
- to: "log:info"
30 changes: 0 additions & 30 deletions generic-examples/user-config/config-configmap-route.groovy

This file was deleted.

27 changes: 27 additions & 0 deletions generic-examples/user-config/config-configmap-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# camel-k: language=yaml

# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------

- from:
uri: "timer:configmap"
steps:
- setBody:
simple: "resource:classpath:my-configmap-key"
- setBody:
simple: "configmap content is: ${body}"
- to: "log:info"
28 changes: 0 additions & 28 deletions generic-examples/user-config/config-file-route.groovy

This file was deleted.

30 changes: 0 additions & 30 deletions generic-examples/user-config/config-secret-key-route.groovy

This file was deleted.

27 changes: 27 additions & 0 deletions generic-examples/user-config/config-secret-key-route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# camel-k: language=yaml

# ---------------------------------------------------------------------------
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ---------------------------------------------------------------------------

- from:
uri: "timer:secret"
steps:
- setBody:
simple: "resource:classpath:my-secret-key-2"
- setBody:
simple: "secret content is: ${body}"
- to: "log:info"
28 changes: 0 additions & 28 deletions generic-examples/user-config/config-secret-property-route.groovy

This file was deleted.

Loading

0 comments on commit db3fbc2

Please sign in to comment.