Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cStor, deployments): add OpenEBS base directory in deployments #1583

Merged
merged 4 commits into from
Jan 9, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 22 additions & 3 deletions pkg/install/v1alpha1/cstor_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
mittachaitu marked this conversation as resolved.
Show resolved Hide resolved
# 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"}}
Expand Down Expand Up @@ -277,6 +284,8 @@ spec:
volumeMounts:
- name: device
mountPath: /dev
- name: storagepath
mountPath: {{ .Config.PersistentStoragePath.value }}
- name: tmp
mountPath: /tmp
- name: sparse
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -382,10 +395,16 @@ spec:
path: /dev
# this field is optional
type: Directory
- name: storagepath
hostPath:
# host dir {{ .Config.OpenebsBaseDir.value }}/cstor-pool/<spc_name> 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-<uid> 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
Expand Down
19 changes: 13 additions & 6 deletions pkg/install/v1alpha1/cstor_volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}
Expand Down Expand Up @@ -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 }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why PersistentStoragePath variable is needed? it has to be "/var/openebs" all the time, other wise istgt image needs to be regenerated with the new mount path? isn't it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, If that variable changed then istgt image also needs to be regenerated. So one shouldn't touch that PersistentStoragePath variable(Made comments above that variable).
We are using in different places so made variable to make it use.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will hard code it

mountPropagation: Bidirectional
{{- if eq $isMonitor "true" }}
- image: {{ .Config.VolumeMonitorImage.value }}
Expand Down Expand Up @@ -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)
Expand Down