From 5a652c0cf05ba0d2fd75fb34e4e2a54ea52a3018 Mon Sep 17 00:00:00 2001 From: mittachaitu Date: Thu, 9 Jan 2020 15:18:44 +0530 Subject: [PATCH 1/4] fix(cStor, deployments): add openebs base directory in deployments Signed-off-by: mittachaitu --- pkg/install/v1alpha1/cstor_pool.go | 25 ++++++++++++++++++++++--- pkg/install/v1alpha1/cstor_volume.go | 19 +++++++++++++------ 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/pkg/install/v1alpha1/cstor_pool.go b/pkg/install/v1alpha1/cstor_pool.go index 008481c4f6..7f6b10fab8 100644 --- a/pkg/install/v1alpha1/cstor_pool.go +++ b/pkg/install/v1alpha1/cstor_pool.go @@ -44,6 +44,13 @@ spec: # nothing exists at the given path i.e. an empty directory will be created. - name: HostPathType value: DirectoryOrCreate + # PersistentStoragePath is base directory to store lock, sock and cache and core files. + # PersistentStoragePath should be used only to mount inside a container. + - name: PersistentStoragePath + value: "/var/openebs" + # OpenebsBaseDir is a hostPath directory to store process files on host machine + - name: OpenebsBaseDir + value: {{env "OPENEBS_IO_BASE_DIR" | default "/var/openebs"}} # SparseDir is a hostPath directory where to look for sparse files - name: SparseDir value: {{env "OPENEBS_IO_CSTOR_POOL_SPARSE_DIR" | default "/var/openebs/sparse"}} @@ -277,6 +284,8 @@ spec: volumeMounts: - name: device mountPath: /dev + - name: storagepath + mountPath: {{ .Config.PersistentStoragePath.value }} - name: tmp mountPath: /tmp - name: sparse @@ -315,6 +324,8 @@ spec: mountPath: /dev - name: tmp mountPath: /tmp + - name: storagepath + mountPath: {{ .Config.PersistentStoragePath.value }} - name: sparse mountPath: {{ .Config.SparseDir.value }} - name: udev @@ -360,8 +371,10 @@ spec: volumeMounts: - mountPath: /dev name: device - - mountPath: /tmp - name: tmp + - name: tmp + mountPath: /tmp + - name: storagepath + mountPath: {{ .Config.PersistentStoragePath.value }} - mountPath: {{ .Config.SparseDir.value }} name: sparse - mountPath: /run/udev @@ -382,10 +395,16 @@ spec: path: /dev # this field is optional type: Directory + - name: storagepath + hostPath: + # host dir {{ .Config.OpenebsBaseDir.value }}/cstor-pool/ is + # created to avoid clash if two pool pods run on same node. + path: {{ .Config.OpenebsBaseDir.value }}/cstor-pool/{{.Storagepool.owner}} + type: {{ .Config.HostPathType.value }} - name: tmp hostPath: # host dir {{ .Config.SparseDir.value }}/shared- is - # created to avoid clash if two replicas run on same node. + # created to avoid clash if two pool pods run on same node. path: {{ .Config.SparseDir.value }}/shared-{{.Storagepool.owner}} type: {{ .Config.HostPathType.value }} - name: sparse diff --git a/pkg/install/v1alpha1/cstor_volume.go b/pkg/install/v1alpha1/cstor_volume.go index 83c89c9e56..f94f0de2ad 100644 --- a/pkg/install/v1alpha1/cstor_volume.go +++ b/pkg/install/v1alpha1/cstor_volume.go @@ -34,6 +34,13 @@ spec: value: {{env "OPENEBS_IO_VOLUME_MONITOR_IMAGE" | default "openebs/m-exporter:latest"}} - name: ReplicaCount value: "3" + # PersistentStoragePath is base directory to store core files. + # PersistentStoragePath should be used only to as mount in a container. + - name: PersistentStoragePath + value: "/var/openebs" + # OpenebsBaseDir is a hostPath directory to store process files on host machine + - name: OpenebsBaseDir + value: {{env "OPENEBS_IO_BASE_DIR" | default "/var/openebs"}} # Target Dir is a hostPath directory for target pod - name: TargetDir value: {{env "OPENEBS_IO_CSTOR_TARGET_DIR" | default "/var/openebs"}} @@ -579,8 +586,8 @@ spec: mountPath: /var/run - name: conf mountPath: /usr/local/etc/istgt - - name: tmp - mountPath: /tmp + - name: storagepath + mountPath: {{ .Config.PersistentStoragePath.value }} mountPropagation: Bidirectional {{- if eq $isMonitor "true" }} - image: {{ .Config.VolumeMonitorImage.value }} @@ -648,17 +655,17 @@ spec: mountPath: /var/run - name: conf mountPath: /usr/local/etc/istgt - - name: tmp - mountPath: /tmp + - name: storagepath + mountPath: {{ .Config.PersistentStoragePath.value }} mountPropagation: Bidirectional volumes: - name: sockfile emptyDir: {} - name: conf emptyDir: {} - - name: tmp + - name: storagepath hostPath: - path: {{ .Config.TargetDir.value }}/shared-{{ .Volume.owner }}-target + path: {{ .Config.OpenebsBaseDir.value }}/cstor-target/{{ .Volume.owner }}-target type: DirectoryOrCreate --- # runTask to create cStorVolumeReplica/(s) From 5b9ce75d9565343ddafe3b9790fd5b075a7a00d8 Mon Sep 17 00:00:00 2001 From: mittachaitu Date: Thu, 9 Jan 2020 16:10:55 +0530 Subject: [PATCH 2/4] This commit fixes the CASTemplate code comments Signed-off-by: mittachaitu --- pkg/install/v1alpha1/cstor_pool.go | 2 +- pkg/install/v1alpha1/cstor_volume.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/install/v1alpha1/cstor_pool.go b/pkg/install/v1alpha1/cstor_pool.go index 7f6b10fab8..a0467dfdb8 100644 --- a/pkg/install/v1alpha1/cstor_pool.go +++ b/pkg/install/v1alpha1/cstor_pool.go @@ -44,7 +44,7 @@ spec: # nothing exists at the given path i.e. an empty directory will be created. - name: HostPathType value: DirectoryOrCreate - # PersistentStoragePath is base directory to store lock, sock and cache and core files. + # PersistentStoragePath is base directory currently used to store core files. # PersistentStoragePath should be used only to mount inside a container. - name: PersistentStoragePath value: "/var/openebs" diff --git a/pkg/install/v1alpha1/cstor_volume.go b/pkg/install/v1alpha1/cstor_volume.go index f94f0de2ad..753812a186 100644 --- a/pkg/install/v1alpha1/cstor_volume.go +++ b/pkg/install/v1alpha1/cstor_volume.go @@ -34,7 +34,7 @@ spec: value: {{env "OPENEBS_IO_VOLUME_MONITOR_IMAGE" | default "openebs/m-exporter:latest"}} - name: ReplicaCount value: "3" - # PersistentStoragePath is base directory to store core files. + # PersistentStoragePath is base directory currently used to store core files. # PersistentStoragePath should be used only to as mount in a container. - name: PersistentStoragePath value: "/var/openebs" From 8a822aee0c0643e295416916ffe4b0d5f3fe908f Mon Sep 17 00:00:00 2001 From: mittachaitu Date: Thu, 9 Jan 2020 16:34:15 +0530 Subject: [PATCH 3/4] This commit reverts the changes done on target deployment Signed-off-by: mittachaitu --- pkg/install/v1alpha1/cstor_volume.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkg/install/v1alpha1/cstor_volume.go b/pkg/install/v1alpha1/cstor_volume.go index 753812a186..53f7cdf98d 100644 --- a/pkg/install/v1alpha1/cstor_volume.go +++ b/pkg/install/v1alpha1/cstor_volume.go @@ -588,6 +588,8 @@ spec: mountPath: /usr/local/etc/istgt - name: storagepath mountPath: {{ .Config.PersistentStoragePath.value }} + - name: tmp + mountPath: /tmp mountPropagation: Bidirectional {{- if eq $isMonitor "true" }} - image: {{ .Config.VolumeMonitorImage.value }} @@ -657,6 +659,8 @@ spec: mountPath: /usr/local/etc/istgt - name: storagepath mountPath: {{ .Config.PersistentStoragePath.value }} + - name: tmp + mountPath: /tmp mountPropagation: Bidirectional volumes: - name: sockfile @@ -667,6 +671,10 @@ spec: hostPath: path: {{ .Config.OpenebsBaseDir.value }}/cstor-target/{{ .Volume.owner }}-target type: DirectoryOrCreate + - name: tmp + hostPath: + path: {{ .Config.TargetDir.value }}/shared-{{ .Volume.owner }}-target + type: DirectoryOrCreate --- # runTask to create cStorVolumeReplica/(s) apiVersion: openebs.io/v1alpha1 From 67f260d233c0ff9d0b6c46aa255881f191cc3045 Mon Sep 17 00:00:00 2001 From: mittachaitu Date: Thu, 9 Jan 2020 18:58:03 +0530 Subject: [PATCH 4/4] This commit hardcode the mount path inside the container Signed-off-by: mittachaitu --- pkg/install/v1alpha1/cstor_pool.go | 10 +++------- pkg/install/v1alpha1/cstor_volume.go | 8 ++------ 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/pkg/install/v1alpha1/cstor_pool.go b/pkg/install/v1alpha1/cstor_pool.go index a0467dfdb8..d4315007b0 100644 --- a/pkg/install/v1alpha1/cstor_pool.go +++ b/pkg/install/v1alpha1/cstor_pool.go @@ -44,10 +44,6 @@ spec: # nothing exists at the given path i.e. an empty directory will be created. - name: HostPathType value: DirectoryOrCreate - # PersistentStoragePath is base directory currently used to store core files. - # PersistentStoragePath should be used only to mount inside a container. - - name: PersistentStoragePath - value: "/var/openebs" # OpenebsBaseDir is a hostPath directory to store process files on host machine - name: OpenebsBaseDir value: {{env "OPENEBS_IO_BASE_DIR" | default "/var/openebs"}} @@ -285,7 +281,7 @@ spec: - name: device mountPath: /dev - name: storagepath - mountPath: {{ .Config.PersistentStoragePath.value }} + mountPath: /var/openebs - name: tmp mountPath: /tmp - name: sparse @@ -325,7 +321,7 @@ spec: - name: tmp mountPath: /tmp - name: storagepath - mountPath: {{ .Config.PersistentStoragePath.value }} + mountPath: /var/openebs - name: sparse mountPath: {{ .Config.SparseDir.value }} - name: udev @@ -374,7 +370,7 @@ spec: - name: tmp mountPath: /tmp - name: storagepath - mountPath: {{ .Config.PersistentStoragePath.value }} + mountPath: /var/openebs - mountPath: {{ .Config.SparseDir.value }} name: sparse - mountPath: /run/udev diff --git a/pkg/install/v1alpha1/cstor_volume.go b/pkg/install/v1alpha1/cstor_volume.go index 53f7cdf98d..ce54b89017 100644 --- a/pkg/install/v1alpha1/cstor_volume.go +++ b/pkg/install/v1alpha1/cstor_volume.go @@ -34,10 +34,6 @@ spec: value: {{env "OPENEBS_IO_VOLUME_MONITOR_IMAGE" | default "openebs/m-exporter:latest"}} - name: ReplicaCount value: "3" - # PersistentStoragePath is base directory currently used to store core files. - # PersistentStoragePath should be used only to as mount in a container. - - name: PersistentStoragePath - value: "/var/openebs" # OpenebsBaseDir is a hostPath directory to store process files on host machine - name: OpenebsBaseDir value: {{env "OPENEBS_IO_BASE_DIR" | default "/var/openebs"}} @@ -587,7 +583,7 @@ spec: - name: conf mountPath: /usr/local/etc/istgt - name: storagepath - mountPath: {{ .Config.PersistentStoragePath.value }} + mountPath: /var/openebs - name: tmp mountPath: /tmp mountPropagation: Bidirectional @@ -658,7 +654,7 @@ spec: - name: conf mountPath: /usr/local/etc/istgt - name: storagepath - mountPath: {{ .Config.PersistentStoragePath.value }} + mountPath: /var/openebs - name: tmp mountPath: /tmp mountPropagation: Bidirectional