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

RHIDP-4780: Document per-ConfigMap/Secret configuration of mountPath #842

Open
wants to merge 7 commits into
base: release-1.4
Choose a base branch
from
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions artifacts/attributes.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
:my-product-database-certificates-secrets: my-rhdh-database-certificates-secrets
:my-product-database-secrets: my-rhdh-database-secrets
:my-product-url: https://__<my_developer_hub_url>__
:my-extra-file-configmap: my-project-configmap

// Red Hat Platforms
:ocp-brand-name: Red Hat OpenShift Container Platform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ include::modules/configuring/proc-provisioning-your-custom-configuration.adoc[le

include::modules/configuring/proc-using-the-operator-to-run-rhdh-with-your-custom-configuration.adoc[leveloffset=+1]

include::modules/configuring/proc-mounting-additional-files-in-your-custom-configuration-using-rhdh-operator.adoc[leveloffset=+2]

include::modules/configuring/proc-using-the-helm-chart-to-run-rhdh-with-your-custom-configuration.adoc[leveloffset=+1]

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[id="mounting-additional-files-in-your-custom-configuration-using-rhdh-operator"]
= Mounting additional files in your custom configuration using the {product} operator

You can use the {product-short} Operator to mount extra files, such as config maps and secrets, to the container in a preferred location.

The `mountPath` field specifies the location where a ConfigMap or Secret is mounted. The behavior of the mount, whether it includes or excludes a `subPath`, depends on the specification of the `key` or `mountPath` fields.

* If `key` and `mountPath` are not specified: Each key or value is mounted as a `filename` or content with a `subPath`.
* If `key` is specified with or without `mountPath`: The specified key or value is mounted with a `subPath`.
* If only `mountPath` is specified: A directory containing all the keys or values is mounted without a `subPath`.

[NOTE]
====
* {ocp-short} does not automatically update a volume mounted with subPath. By default, the {product-very-short} operator monitors these ConfigMaps or Secrets and refreshes the {product-very-short} Pod when changes occur.
* For security purposes, {product} does not give the Operator Service Account read access to Secrets. As a result, mounting files from Secrets without specifying both mountPath and key is not supported.
====


.Prerequisites
* You have developer permissions to access the {ocp-short} cluster containing your {product-short} instance using the {openshift-cli}.
* link:{installing-on-ocp-book-url}[Your {ocp-short} administrator has installed the {product} Operator in {ocp-short}].

.Procedure

. In {ocp-short}, create your config map or secret with the following YAML codes:
+
.Minimal `{my-extra-file-configmap}` config map example
====
[source,yaml,subs="+attributes,+quotes"]
----
apiVersion: v1
kind: ConfigMap
metadata:
name: {my-extra-file-configmap}
data:
file11.txt: |
My file11 content
file 12.txt: |
My file12 content
----
====
+
.Minimal `{my-product-secrets}` secret example
====
[source,yaml,subs="+attributes,+quotes"]
----
apiVersion: v1
kind: Secret
metadata:
name: {my-product-secrets}
StringData:
secret11.txt: |
secret-content
----
====
For more information, see xref:provisioning-your-custom-configuration[Provisioning and using your custom {product} configuration].

. Set the value of the `configMaps name` to the name of the config map or `secrets name` to the name of the secret file in your `{product-custom-resource-type}` CR. For example:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is must clearer - thank you! The only comment I have is that Kubernetes formats these objects as ConfigMap and Secret (capitalized that way) so we should do the same in our docs. Please forgive me for not noticing that earlier!

Suggested change
. Set the value of the `configMaps name` to the name of the config map or `secrets name` to the name of the secret file in your `{product-custom-resource-type}` CR. For example:
. Set the value of the `configMaps name` to the name of the ConfigMap or `secrets name` to the name of the Secret in your `{product-custom-resource-type}` CR. For example:

====
[source,yaml,subs="+attributes,+quotes"]
----
spec:
application:
extraFiles:
mountPath: /my/path
configMaps:
- name: {my-extra-file-configmap}
key: file12.txt
mountPath: /my/my-rhdh-config-map/path
secrets:
- name: {my-product-secrets}
key: secret11.txt
mountPath: /my/my-rhdh-secret/path

----
====
2 changes: 1 addition & 1 deletion modules/release-notes/ref-release-notes-new-features.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This section highlights new features in {product} {product-version}.
[id="enhancement-rhidp-2200"]
== Added an individual `mountPath`

This update adds an additional individual `mountPath` for extra configmaps or secrets.
This update adds an individual `mountPath` for link:{configuring-book-url}#proc-mounting-additional-files-in-your-custom-configuration-using-rhdh-operator[extra configmaps or secrets].

[id="feature-rhidp-3621"]
== `PersistentVolumeClaims` support is available
Expand Down
Loading