From fb6fcf1d12616d776971c43ecb99b34b57507ff7 Mon Sep 17 00:00:00 2001 From: Heena Manwani Date: Wed, 13 Nov 2024 14:49:32 +0530 Subject: [PATCH 1/3] RHIDP-4566: document how to manage PVCs in RHDH operator --- .../admin/proc-rhdh-deployment-config.adoc | 61 ++++++++++++++++++- 1 file changed, 58 insertions(+), 3 deletions(-) diff --git a/modules/admin/proc-rhdh-deployment-config.adoc b/modules/admin/proc-rhdh-deployment-config.adoc index 47b44e98b0..6dc1dbe6f1 100644 --- a/modules/admin/proc-rhdh-deployment-config.adoc +++ b/modules/admin/proc-rhdh-deployment-config.adoc @@ -46,8 +46,10 @@ spec: ---- `volumes`:: -Add an additional volume named `my-volume` and mount it under `/my/path` in the {product-short} application container. + +-- +Add an additional volume named `my-volume` and mount it under `/my/path` in the {product-short} application container. + .Example additional volume [source, yaml] ---- @@ -73,9 +75,9 @@ spec: storageClassName: "special" name: my-volume ---- -+ + Replace the default `dynamic-plugins-root` volume with a persistent volume claim (PVC) named `dynamic-plugins-root`. Note the `$patch: replace` directive, otherwise a new volume will be added. -+ + .Example `dynamic-plugins-root` volume replacement [source, yaml] ---- @@ -96,6 +98,59 @@ spec: claimName: dynamic-plugins-root ---- +Starting from v1alpha3 (Operator version 0.4.0), you can mount directories from pre-created PVCs using the `spec.application.extraFiles.pvcs` field. PVCs are mounted as directories to the container's path, based on the following logic: + +* If `spec.application.extraFiles.pvcs[].mountPath` is defined, the PVC is mounted to the specified path. +* If `spec.application.extraFiles.pvcs[].mountPath` is not defined, the PVC is mounted under `spec.application.extraFiles.mountPath/`. +* If neither is defined, the PVC defaults to `/opt/app-root/src`. + +.Example PVC objects in the namespace +[source,yaml] +---- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: myclaim1 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: myclaim2 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi +---- + +The PVCs in the previous example can be mounted to the container as follows: + +.Example PVCs mounted to the container +[source,yaml] +---- +spec: + application: + extraFiles: + mountPath: /my/path + pods: + - name: myclaim1 + - name: myclaim2 + mountPath: /vol/my/claim +---- + +As a result, the following directories are mounted in the container: + +* `/my/path/myclaim1` +* `/vol/my/claim` +-- + `cpu` request:: Set the CPU request for the {product-short} application container to 250m. From 45e8a9ae8f871ba5f1c1a403f7968d854251e599 Mon Sep 17 00:00:00 2001 From: Heena Manwani Date: Wed, 20 Nov 2024 13:25:46 +0530 Subject: [PATCH 2/3] Incorporated review suggestions --- .../admin/proc-mount-directories-pvcs.adoc | 64 +++++++++++++++++++ .../admin/proc-rhdh-deployment-config.adoc | 52 --------------- titles/admin-rhdh/title-admin.adoc | 3 +- 3 files changed, 66 insertions(+), 53 deletions(-) create mode 100644 modules/admin/proc-mount-directories-pvcs.adoc diff --git a/modules/admin/proc-mount-directories-pvcs.adoc b/modules/admin/proc-mount-directories-pvcs.adoc new file mode 100644 index 0000000000..4d42818f6c --- /dev/null +++ b/modules/admin/proc-mount-directories-pvcs.adoc @@ -0,0 +1,64 @@ +[id="proc-mount-directories-pvcs_{context}"] += Mounting directories from pre-created PVCs + +Starting from `v1alpha3`, you can mount directories from pre-created PersistentVolumeClaims (PVCs) using the `spec.application.extraFiles.pvcs` field. + +.Prerequisites +* You have understanding of the mounting logic: +** If `spec.application.extraFiles.pvcs[].mountPath` is defined, the PVC is mounted to the specified path. +** If `spec.application.extraFiles.pvcs[].mountPath` is not defined, the PVC is mounted under the path specified in `spec.application.extraFiles.mountPath/`. +** If neither `mountPath` is defined, the PVC defaults to `/opt/app-root/src` or you can use {product-very-short} container working directory (if defined). + +.Procedure +. Define the PVCs using the following YAML example: ++ +-- +.Example YAML file to define PVCs +[source,yaml] +---- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: myclaim1 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: myclaim2 +spec: + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 2Gi +---- +-- + +. Use the following configuration to specify how the PVCs are mounted in the container: ++ +-- +.Example configuration for mounting PVCs in a container +[source,yaml] +---- +spec: + application: + extraFiles: + mountPath: /my/path + pvcs: + - name: myclaim1 + - name: myclaim2 + mountPath: /vol/my/claim +---- +-- + +.Verification +Based on the configuration, the following directories are mounted in the container: + +* `/my/path/myclaim1` +* `/vol/my/claim` \ No newline at end of file diff --git a/modules/admin/proc-rhdh-deployment-config.adoc b/modules/admin/proc-rhdh-deployment-config.adoc index 6dc1dbe6f1..29a866bea7 100644 --- a/modules/admin/proc-rhdh-deployment-config.adoc +++ b/modules/admin/proc-rhdh-deployment-config.adoc @@ -97,58 +97,6 @@ spec: persistentVolumeClaim: claimName: dynamic-plugins-root ---- - -Starting from v1alpha3 (Operator version 0.4.0), you can mount directories from pre-created PVCs using the `spec.application.extraFiles.pvcs` field. PVCs are mounted as directories to the container's path, based on the following logic: - -* If `spec.application.extraFiles.pvcs[].mountPath` is defined, the PVC is mounted to the specified path. -* If `spec.application.extraFiles.pvcs[].mountPath` is not defined, the PVC is mounted under `spec.application.extraFiles.mountPath/`. -* If neither is defined, the PVC defaults to `/opt/app-root/src`. - -.Example PVC objects in the namespace -[source,yaml] ----- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: myclaim1 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 2Gi ---- -apiVersion: v1 -kind: PersistentVolumeClaim -metadata: - name: myclaim2 -spec: - accessModes: - - ReadWriteOnce - resources: - requests: - storage: 2Gi ----- - -The PVCs in the previous example can be mounted to the container as follows: - -.Example PVCs mounted to the container -[source,yaml] ----- -spec: - application: - extraFiles: - mountPath: /my/path - pods: - - name: myclaim1 - - name: myclaim2 - mountPath: /vol/my/claim ----- - -As a result, the following directories are mounted in the container: - -* `/my/path/myclaim1` -* `/vol/my/claim` -- `cpu` request:: diff --git a/titles/admin-rhdh/title-admin.adoc b/titles/admin-rhdh/title-admin.adoc index 8aaea1cac5..f35bdaa36c 100644 --- a/titles/admin-rhdh/title-admin.adoc +++ b/titles/admin-rhdh/title-admin.adoc @@ -40,4 +40,5 @@ include::assemblies/assembly-admin-templates.adoc[leveloffset=+1] include::assemblies/assembly-techdocs-plugin.adoc[leveloffset=+1] // RHDH Operator deployment -include::modules//admin/proc-rhdh-deployment-config.adoc[leveloffset=+1] +include::modules/admin/proc-rhdh-deployment-config.adoc[leveloffset=+1] +include::modules/admin/proc-mount-directories-pvcs.adoc[leveloffset=+2] From 6805d4e412107415b50d46784b90753fdc0ec2a2 Mon Sep 17 00:00:00 2001 From: Heena Manwani Date: Wed, 4 Dec 2024 18:07:21 +0530 Subject: [PATCH 3/3] Incorporate QE suggestion --- modules/admin/proc-mount-directories-pvcs.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/admin/proc-mount-directories-pvcs.adoc b/modules/admin/proc-mount-directories-pvcs.adoc index 4d42818f6c..61cc8a6e59 100644 --- a/modules/admin/proc-mount-directories-pvcs.adoc +++ b/modules/admin/proc-mount-directories-pvcs.adoc @@ -7,7 +7,7 @@ Starting from `v1alpha3`, you can mount directories from pre-created PersistentV * You have understanding of the mounting logic: ** If `spec.application.extraFiles.pvcs[].mountPath` is defined, the PVC is mounted to the specified path. ** If `spec.application.extraFiles.pvcs[].mountPath` is not defined, the PVC is mounted under the path specified in `spec.application.extraFiles.mountPath/`. -** If neither `mountPath` is defined, the PVC defaults to `/opt/app-root/src` or you can use {product-very-short} container working directory (if defined). +** 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. .Procedure . Define the PVCs using the following YAML example: