Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add section describing secret ref in properties files #1716

Merged
merged 2 commits into from
Sep 27, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions docs/modules/ROOT/pages/configuration/configmap-secret.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,44 @@ You can now run the integration with the following command to reference the _Sec
```
kamel run --secret=my-secret props.groovy
```

== Reference a Secret in Properties

Suppose you have an existing _Secret_ that contains sensitive information that your integration requires. You might want to reference the values from this _Secret_ in your configuration properties.

For example, a _Secret_ named *secret-message*:

[source,yaml]
.secret-message.yaml
----
apiVersion: v1
kind: Secret
metadata:
name: secret-message
data:
MESSAGE: SGVsbG8gV29ybGQK
type: Opaque
----

You can reference this _Secret_ in configuration properties using the `{{secret:secret-name/key-name}}` syntax.

For example, the following configuration stored in a _ConfigMap_ references the example _Secret_ defined previously:

[source,yaml]
.my-config.yaml
----
apiVersion: v1
kind: ConfigMap
metadata:
name: my-config
data:
application.properties: |
my.message=={{secret:secret-message/MESSAGE}}
----

You can now run the integration with the following commands to include necessary the _Secret_ and _ConfigMap_:

```
kubectl apply -f my-config.yaml -f secret-message.yaml
kamel run --secret=secret-message --configmap=my-config props.groovy
```