|
1 | | -[id="proc-mount-directories-pvcs_{context}"] |
2 | | -= Mounting directories from pre-created PVCs |
| 1 | +:_mod-docs-content-type: PROCEDURE |
| 2 | +[id="proc-configure-mount-path-secrets-pvcs_{context}"] |
| 3 | += Configuring mount paths for Secrets and PVCs |
3 | 4 |
|
4 | | -Starting from `v1alpha3`, you can mount directories from pre-created PersistentVolumeClaims (PVCs) using the `spec.application.extraFiles.pvcs` field. |
| 5 | +By default, the mount path is the {product-short} container's working directory. If you do not define the mount path, it defaults to `/opt/app-root/src`. |
5 | 6 |
|
6 | | -.Prerequisites |
7 | | -* You have understanding of the mounting logic: |
8 | | -** If `spec.application.extraFiles.pvcs[].mountPath` is defined, the PVC is mounted to the specified path. |
9 | | -** If `spec.application.extraFiles.pvcs[].mountPath` is not defined, the PVC is mounted under the path specified in `spec.application.extraFiles.mountPath/`. |
10 | | -** If `mountPath` is not defined, the PVC defaults to `/opt/app-root/src`, or you can use the {product-very-short} container's working directory if it is specified. |
| 7 | +You can add the `rhdh.redhat.com/mount-path` annotation to specify a custom path. |
11 | 8 |
|
12 | 9 | .Procedure |
13 | | -. Define the PVCs using the following YAML example: |
| 10 | + |
| 11 | +. To specify a PVC mount path, add the `rhdh.redhat.com/mount-path` annotation to your configuration file as shown in the following example: |
14 | 12 | + |
15 | | --- |
16 | | -.Example YAML file to define PVCs |
17 | | -[source,yaml] |
| 13 | +.Example specifying where the PVC mounts |
| 14 | +[source,yaml,subs="+attributes,+quotes"] |
18 | 15 | ---- |
19 | | -apiVersion: v1 |
20 | | -kind: PersistentVolumeClaim |
21 | | -metadata: |
22 | | - name: myclaim1 |
23 | | -spec: |
24 | | - accessModes: |
25 | | - - ReadWriteOnce |
26 | | - resources: |
27 | | - requests: |
28 | | - storage: 2Gi |
29 | | ---- |
30 | | -apiVersion: v1 |
31 | | -kind: PersistentVolumeClaim |
32 | | -metadata: |
33 | | - name: myclaim2 |
34 | | -spec: |
35 | | - accessModes: |
36 | | - - ReadWriteOnce |
37 | | - resources: |
38 | | - requests: |
39 | | - storage: 2Gi |
| 16 | +apiVersion: v1 |
| 17 | +kind: PersistentVolumeClaim |
| 18 | +metadata: |
| 19 | + name: _<my_claim>_ |
| 20 | + annotations: |
| 21 | + rhdh.redhat.com/mount-path: /mount/path/from/annotation |
40 | 22 | ---- |
41 | | --- |
| 23 | +where: |
| 24 | + |
| 25 | +`rhdh.redhat.com/mount-path`:: Specifies which mount path the PVC mounts to (in this case, `/mount/path/from/annotation` directory). |
| 26 | +<my_claim>:: Specifies the PVC to mount. |
42 | 27 |
|
43 | | -. Use the following configuration to specify how the PVCs are mounted in the container: |
| 28 | +. To specify a Secret mount path, add the `rhdh.redhat.com/mount-path` annotation to your configuration file as shown in the following example: |
44 | 29 | + |
45 | | --- |
46 | | -.Example configuration for mounting PVCs in a container |
47 | | -[source,yaml] |
| 30 | +.Example specifying where the Secret mounts |
| 31 | +[source,yaml,subs="+attributes,+quotes"] |
48 | 32 | ---- |
49 | | -spec: |
50 | | - application: |
51 | | - extraFiles: |
52 | | - mountPath: /my/path |
53 | | - pvcs: |
54 | | - - name: myclaim1 |
55 | | - - name: myclaim2 |
56 | | - mountPath: /vol/my/claim |
| 33 | +apiVersion: v1 |
| 34 | +kind: Secret |
| 35 | +metadata: |
| 36 | + name: _<my_secret>_ |
| 37 | + annotations: |
| 38 | + rhdh.redhat.com/mount-path: /mount/path/from/annotation |
57 | 39 | ---- |
58 | | --- |
59 | | - |
60 | | -.Verification |
61 | | -Based on the configuration, the following directories are mounted in the container: |
| 40 | +where: |
62 | 41 |
|
63 | | -* `/my/path/myclaim1` |
64 | | -* `/vol/my/claim` |
| 42 | +<my_secret>:: Specifies the Secret name. |
0 commit comments