Skip to content

Commit 7753ac4

Browse files
author
GitHub Actions
committed
Configurable PVC mounting
Configurable PVC mounting Incorporate technical suggestions Incorporate technical suggestions
1 parent 486782f commit 7753ac4

File tree

3 files changed

+168
-0
lines changed

3 files changed

+168
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
:_mod-docs-content-type: PROCEDURE
2+
[id="proc-default-configuration-for-secrets-and-pvcs_{context}"]
3+
= Configuring default configuration for Secrets and PVCs
4+
5+
By default, the mount path is the {product-short} container's working directory, and if you do not define the mount path, it defaults to `/opt/app-root/src`. `app-config`, `configmap-files`, `secret-files`, `dynamic-plugins`, and PVCs mount to the container as either files or directories. The `default-config/deployment.yaml` file defines the dynamic plugins directory, as shown:
6+
7+
[source,yaml]
8+
----
9+
- ephemeral:
10+
volumeClaimTemplate:
11+
spec:
12+
accessModes:
13+
- ReadWriteOnce
14+
resources:
15+
requests:
16+
storage: 2Gi
17+
name: dynamic-plugins-root
18+
----
19+
20+
You can add the `rhdh.redhat.com/containers` annotation to your configuration file to specify the mount path.
21+
22+
.Procedure
23+
24+
. Specify the mount path where the PVC mounts to by adding the `rhdh.redhat.com/mount-path` annotation to your configuration as shown in the following example:
25+
+
26+
.Example specifying where the PVC mounts
27+
[source,yaml,subs="+attributes,+quotes"]
28+
----
29+
apiVersion: v1
30+
kind: PersistentVolumeClaim
31+
metadata:
32+
name: _<my_claim>_
33+
annotations:
34+
rhdh.redhat.com/mount-path: /mount/path/from/annotation
35+
----
36+
where:
37+
38+
`rhdh.redhat.com/mount-path`:: Specifies which mount path the PVC mounts to.
39+
<my_claim>:: Specifies the PVC to mount.
40+
41+
. Specify the mount path where the Secret mounts to by adding the `rhdh.redhat.com/mount-path` annotation to your configuration as shown in the following example:
42+
+
43+
.Example specifying where the Secret mounts
44+
[source,yaml,subs="+attributes,+quotes"]
45+
----
46+
apiVersion: v1
47+
kind: Secret
48+
metadata:
49+
name: _<my_secret>_
50+
annotations:
51+
rhdh.redhat.com/mount-path: /mount/path/from/annotation
52+
----
53+
where:
54+
55+
<my_secret>:: Specifies the Secret name.
56+
57+
. Use the following configuration to mount Secrets to all containers:
58+
+
59+
.Example configuration for mounting to all containers
60+
[source,yaml,subs="+attributes,+quotes"]
61+
----
62+
metadata:
63+
name: _<my_secret>_
64+
annotations:
65+
rhdh.redhat.com/containers: `*`
66+
----
67+
+
68+
[IMPORTANT]
69+
====
70+
Set `rhdh.redhat.com/containers` to `*` to mount it to all containers in the deployment.
71+
====
72+
73+
. Optional: Use commas to separate the list of containers to mount to as shown in the following example:
74+
+
75+
.Example configuration for separating the list of containers
76+
[source,yaml,subs="+attributes,+quotes"]
77+
----
78+
apiVersion: v1
79+
kind: PersistentVolumeClaim
80+
metadata:
81+
name: myclaim
82+
annotations:
83+
rhdh.redhat.com/containers: "init-dynamic-plugins,backstage-backend"
84+
----
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
[id="proc-configuring-pvc-secret-mounting_{context}"]
2+
= Configuring Persistent Volume Claim (PVC) mounting
3+
4+
You can configure which containers the Persistent Volume Claim (PVC) mounts to by adding `rhdh.redhat.com/containers` to your configuration. You can configure multiple secrets by using annotations to specify mount paths for each secret and target specific containers where the secrets should mount. Adding annotations ensures flexible storage and secrets management across different containers. The `default-config/deployment.yaml` defines the dynamic plugins directory, as shown in the following example:
5+
6+
[source,yaml]
7+
----
8+
- ephemeral:
9+
volumeClaimTemplate:
10+
spec:
11+
accessModes:
12+
- ReadWriteOnce
13+
resources:
14+
requests:
15+
storage: 2Gi
16+
name: dynamic-plugins-root
17+
----
18+
19+
.Prerequisites
20+
21+
* You have sufficient administrative permission.
22+
23+
.Procedure
24+
25+
To configure which container the PVC mounts to, add `rhdh.redhat.com/mount-path` annotation to your configuration as shown in the following examples:
26+
27+
[source,yaml,subs="+attributes,+quotes"]
28+
----
29+
apiVersion: v1
30+
kind: PersistentVolumeClaim
31+
metadata:
32+
name: _<my_claim>_
33+
annotations:
34+
rhdh.redhat.com/mount-path: /mount/path/from/annotation
35+
----
36+
where:
37+
38+
`rhdh.redhat.com/mount-path`:: Specifies which container the PVC mounts to.
39+
<my_claim>:: Specifies the PVC to mount.
40+
+
41+
[source,yaml,subs="+attributes,+quotes"]
42+
----
43+
apiVersion: v1
44+
kind: Secret
45+
metadata:
46+
name: _<my_secret>_
47+
annotations:
48+
rhdh.redhat.com/mount-path: /mount/path/from/annotation
49+
----
50+
where:
51+
52+
<my_secret>:: Specifies the Secret name.
53+
54+
To configure which container the PVC mounts to, add `rhdh.redhat.com/containers` to your configuration. You can configure multiple secrets within a single YAML file as shown in the following example:
55+
56+
[source,yaml,subs="+attributes,+quotes"]
57+
----
58+
apiVersion: v1
59+
kind: Secret
60+
metadata:
61+
name: _<my_secret>_
62+
annotations:
63+
rhdh.redhat.com/containers: `*`
64+
----
65+
66+
[IMPORTANT]
67+
====
68+
Set it to `*` to mount it to all containers in the deployment.
69+
====
70+
71+
You can use commas to separate the list of containers to mount as shown in the following example:
72+
73+
[source,yaml,subs="+attributes,+quotes"]
74+
----
75+
apiVersion: v1
76+
kind: PersistentVolumeClaim
77+
metadata:
78+
name: myclaim
79+
annotations:
80+
rhdh.redhat.com/containers: "init-dynamic-plugins,backstage-backend"
81+
----

titles/configuring/master.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,8 @@ include::modules/installation/proc-configuring-an-rhdh-instance-with-tls-in-kube
3333
include::modules/dynamic-plugins/con-dynamic-plugins-cache.adoc[ leveloffset=+1]
3434

3535

36+
include::modules/configuring-external-databases/proc-configuring-default-configuration-for-secrets-and-pvcs.adoc[leveloffset=+1]
37+
38+
3639
include::modules/dynamic-plugins/proc-installing-and-configuring-redis-cache.adoc[leveloffset=+1]
3740

0 commit comments

Comments
 (0)