|
| 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 | +---- |
0 commit comments