Skip to content

Commit

Permalink
[Enhancement] Support to mount emptyDir in storageVolumes
Browse files Browse the repository at this point in the history
Signed-off-by: yandongxiao <[email protected]>
  • Loading branch information
yandongxiao committed Dec 8, 2023
1 parent 87ac62d commit 4928526
Show file tree
Hide file tree
Showing 21 changed files with 879 additions and 786 deletions.
8 changes: 4 additions & 4 deletions config/crd/bases/starrocks.com_starrocksclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1289,8 +1289,8 @@ spec:
volume should be mounted. Defaults to "" (volume's root).
type: string
required:
- mountPath
- name
- storageSize
type: object
type: array
terminationGracePeriodSeconds:
Expand Down Expand Up @@ -3267,8 +3267,8 @@ spec:
volume should be mounted. Defaults to "" (volume's root).
type: string
required:
- mountPath
- name
- storageSize
type: object
type: array
terminationGracePeriodSeconds:
Expand Down Expand Up @@ -4392,8 +4392,8 @@ spec:
volume should be mounted. Defaults to "" (volume's root).
type: string
required:
- mountPath
- name
- storageSize
type: object
type: array
tolerations:
Expand Down Expand Up @@ -5677,8 +5677,8 @@ spec:
volume should be mounted. Defaults to "" (volume's root).
type: string
required:
- mountPath
- name
- storageSize
type: object
type: array
terminationGracePeriodSeconds:
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/starrocks.com_starrockswarehouses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1966,8 +1966,8 @@ spec:
volume should be mounted. Defaults to "" (volume's root).
type: string
required:
- mountPath
- name
- storageSize
type: object
type: array
terminationGracePeriodSeconds:
Expand Down
8 changes: 4 additions & 4 deletions deploy/starrocks.com_starrocksclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,8 @@ spec:
subPath:
type: string
required:
- mountPath
- name
- storageSize
type: object
type: array
terminationGracePeriodSeconds:
Expand Down Expand Up @@ -1507,8 +1507,8 @@ spec:
subPath:
type: string
required:
- mountPath
- name
- storageSize
type: object
type: array
terminationGracePeriodSeconds:
Expand Down Expand Up @@ -1995,8 +1995,8 @@ spec:
subPath:
type: string
required:
- mountPath
- name
- storageSize
type: object
type: array
tolerations:
Expand Down Expand Up @@ -2573,8 +2573,8 @@ spec:
subPath:
type: string
required:
- mountPath
- name
- storageSize
type: object
type: array
terminationGracePeriodSeconds:
Expand Down
2 changes: 1 addition & 1 deletion deploy/starrocks.com_starrockswarehouses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -923,8 +923,8 @@ spec:
subPath:
type: string
required:
- mountPath
- name
- storageSize
type: object
type: array
terminationGracePeriodSeconds:
Expand Down
2 changes: 1 addition & 1 deletion doc/mount_persistent_volume_howto.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ The following is a snippet of the values.yaml file:
```yaml
starrocks:
starrocksFESpec:
# fe storageSpec for persistent meta data.
# fe storageSpec for persistent metadata.
storageSpec:
name: ""
# the storageClassName represent the used storageclass name. if not set will use k8s cluster default storageclass.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
configMapInfo:
configMapName: starrockscluster-sample-fe-cm
resolveKey: fe.conf
# fe storage volumes for persistent meta data and log
# fe storage volumes for persistent metadata and log
storageVolumes:
- name: fe-storage-meta
# the storageClassName represent the used storageclass name. if not set will use k8s cluster default storageclass.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,27 +134,26 @@ spec:
configMapInfo:
configMapName: {{ template "starrockscluster.fe.configmap.name" . }}
resolveKey: fe.conf
{{- if .Values.starrocksFESpec.storageSpec.name }}
{{- if or .Values.starrocksFESpec.storageSpec.name .Values.starrocksFESpec.emptyDirs }}
storageVolumes:
{{- if .Values.starrocksFESpec.storageSpec.name }}
- name: {{ .Values.starrocksFESpec.storageSpec.name }}{{ template "starrockscluster.fe.meta.suffix" . }}
{{- if .Values.starrocksFESpec.storageSpec.storageClassName }}
storageClassName: {{ .Values.starrocksFESpec.storageSpec.storageClassName }}
{{- end }}
{{- if .Values.starrocksFESpec.storageSpec.storageSize }}
storageSize: {{ .Values.starrocksFESpec.storageSpec.storageSize }}
{{- end }}
mountPath: {{ template "starrockscluster.fe.meta.path" . }}
{{- if .Values.starrocksFESpec.storageSpec.logStorageSize }}
- name: {{ .Values.starrocksFESpec.storageSpec.name }}{{ template "starrockscluster.fe.log.suffix" . }}
{{- if .Values.starrocksFESpec.storageSpec.storageClassName }}
storageClassName: {{ .Values.starrocksFESpec.storageSpec.storageClassName }}
{{- end }}
{{- if .Values.starrocksFESpec.storageSpec.logStorageSize }}
storageSize: {{ .Values.starrocksFESpec.storageSpec.logStorageSize }}
{{- end }}
mountPath: {{ template "starrockscluster.fe.log.path" . }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.starrocksFESpec.emptyDirs }}
{{- range .Values.starrocksFESpec.emptyDirs }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
storageClassName: "emptyDir"
{{- end }}
{{- end }}
{{- end }}

{{- if .Values.starrocksCluster.enabledBe }}
starRocksBeSpec:
Expand Down Expand Up @@ -280,29 +279,27 @@ spec:
configMapInfo:
configMapName: {{template "starrockscluster.be.configmap.name" . }}
resolveKey: be.conf
{{- if .Values.starrocksBeSpec.storageSpec.name }}
{{- if or .Values.starrocksBeSpec.storageSpec.name .Values.starrocksBeSpec.emptyDirs }}
{{- if .Values.starrocksBeSpec.storageSpec.name }}
storageVolumes:
- name: {{ .Values.starrocksBeSpec.storageSpec.name }}{{template "starrockscluster.be.data.suffix" . }}
{{- if .Values.starrocksBeSpec.storageSpec.storageClassName }}
storageClassName: {{ .Values.starrocksBeSpec.storageSpec.storageClassName }}
{{- end }}
{{- if .Values.starrocksBeSpec.storageSpec.storageSize }}
storageSize: {{ .Values.starrocksBeSpec.storageSpec.storageSize }}
{{- end }}
mountPath: {{template "starrockscluster.be.data.path" . }}
{{- if .Values.starrocksBeSpec.storageSpec.logStorageSize }}
- name: {{ .Values.starrocksBeSpec.storageSpec.name }}{{template "starrockscluster.be.log.suffix" . }}
{{- if .Values.starrocksBeSpec.storageSpec.storageClassName }}
storageClassName: {{ .Values.starrocksBeSpec.storageSpec.storageClassName }}
{{- end }}
{{- if .Values.starrocksBeSpec.storageSpec.logStorageSize }}
storageSize: {{ .Values.starrocksBeSpec.storageSpec.logStorageSize }}
{{- end }}
mountPath: {{template "starrockscluster.be.log.path" . }}
{{- end }}
{{- end }}
{{- end }}

{{- end }}
{{- if .Values.starrocksBeSpec.emptyDirs }}
{{- range .Values.starrocksBeSpec.emptyDirs }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
storageClassName: "emptyDir"
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.starrocksCluster.enabledCn }}
starRocksCnSpec:
image: "{{ .Values.starrocksCnSpec.image.repository }}:{{ .Values.starrocksCnSpec.image.tag }}"
Expand Down Expand Up @@ -432,8 +429,9 @@ spec:
configMapInfo:
configMapName: {{template "starrockscluster.cn.configmap.name" . }}
resolveKey: cn.conf
{{- if .Values.starrocksCnSpec.storageSpec.name }}
{{- if or .Values.starrocksCnSpec.storageSpec.namer .Values.starrocksCnSpec.emptyDirs }}
storageVolumes:
{{- if .Values.starrocksCnSpec.storageSpec.name }}
- name: {{ .Values.starrocksCnSpec.storageSpec.name }}{{template "starrockscluster.cn.data.suffix" . }}
storageClassName: {{ .Values.starrocksCnSpec.storageSpec.storageClassName }}
storageSize: {{ .Values.starrocksCnSpec.storageSpec.storageSize }}
Expand All @@ -442,10 +440,18 @@ spec:
storageClassName: {{ .Values.starrocksCnSpec.storageSpec.storageClassName }}
storageSize: {{ .Values.starrocksCnSpec.storageSpec.logStorageSize }}
mountPath: {{template "starrockscluster.cn.log.path" . }}
{{- end }}
{{- if .Values.starrocksCnSpec.emptyDirs }}
{{- range .Values.starrocksCnSpec.emptyDirs }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
storageClassName: "emptyDir"
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

{{- if .Values.starrocksFeProxySpec.enabled }}
{{- if .Values.starrocksFeProxySpec.enabled }}
starRocksFeProxySpec:
{{- if .Values.starrocksFeProxySpec.image.repository }}
image: "{{ .Values.starrocksFeProxySpec.image.repository }}:{{ .Values.starrocksFeProxySpec.image.tag }}"
Expand Down Expand Up @@ -484,4 +490,12 @@ spec:
{{- if .Values.starrocksFeProxySpec.readinessProbeFailureSeconds }}
readinessProbeFailureSeconds: {{ .Values.starrocksFeProxySpec.readinessProbeFailureSeconds }}
{{- end }}
{{- end }}
{{- if .Values.starrocksFeProxySpec.emptyDirs }}
storageVolumes:
{{- range .Values.starrocksFeProxySpec.emptyDirs }}
- name: {{ .name }}
storageClassName: "emptyDir"
mountPath: {{ .mountPath }}
{{- end }}
{{- end }}
{{- end }}
25 changes: 24 additions & 1 deletion helm-charts/charts/kube-starrocks/charts/starrocks/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ starrocksFESpec:
limits:
cpu: 8
memory: 8Gi
# fe storageSpec for persistent meta data.
# fe storageSpec for persistent metadata.
storageSpec:
name: ""
# the storageClassName represent the used storageclass name. if not set will use k8s cluster default storageclass.
Expand All @@ -154,6 +154,12 @@ starrocksFESpec:
storageSize: 10Gi
# Setting this parameter can persist log storage
logStorageSize: 5Gi
# mount other volumes if necessary.
# Note: please use storageSpec field for persistent metadata and log.
emptyDirs: []
# e.g. mount an emptyDir volume to /tmp
# - name: tmp-data
# mountPath: /tmp
# the config for start fe. the base information as follows.
config: |
LOG_DIR = ${STARROCKS_HOME}/log
Expand Down Expand Up @@ -334,6 +340,12 @@ starrocksCnSpec:
storageSize: 1Ti
# the storage size of persistent volume for log.
logStorageSize: 1Gi
# mount other volumes if necessary.
# Note: please use storageSpec field for persistent storage data and log.
emptyDirs: []
# e.g. mount an emptyDir volume to /tmp
# - name: tmp-data
# mountPath: /tmp
# the config start for cn, the base information as follows.
config: |
sys_log_level = INFO
Expand Down Expand Up @@ -473,6 +485,12 @@ starrocksBeSpec:
storageSize: 1Ti
# Setting this parameter can persist log storage
logStorageSize: 1Gi
# mount other volumes if necessary.
# Note: please use storageSpec field for persistent storage data and log.
emptyDirs: []
# e.g. mount an emptyDir volume to /tmp
# - name: tmp-data
# mountPath: /tmp
# the config for start be. the base information as follows.
config: |
be_port = 9060
Expand Down Expand Up @@ -595,3 +613,8 @@ starrocksFeProxySpec:
# ReadinessProbeFailureSeconds defines the total failure seconds of readiness Probe.
# default value is 15 seconds
readinessProbeFailureSeconds:
# Note: will create emptyDir volume for fe proxy, PVC is not supported.
emptyDirs: []
# e.g. mount an emptyDir volume to /tmp
# - name: tmp-data
# mountPath: /tmp
25 changes: 24 additions & 1 deletion helm-charts/charts/kube-starrocks/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ starrocks:
limits:
cpu: 8
memory: 8Gi
# fe storageSpec for persistent meta data.
# fe storageSpec for persistent metadata.
storageSpec:
name: ""
# the storageClassName represent the used storageclass name. if not set will use k8s cluster default storageclass.
Expand All @@ -234,6 +234,12 @@ starrocks:
storageSize: 10Gi
# Setting this parameter can persist log storage
logStorageSize: 5Gi
# mount other volumes if necessary.
# Note: please use storageSpec field for persistent metadata and log.
emptyDirs: []
# e.g. mount an emptyDir volume to /tmp
# - name: tmp-data
# mountPath: /tmp
# the config for start fe. the base information as follows.
config: |
LOG_DIR = ${STARROCKS_HOME}/log
Expand Down Expand Up @@ -414,6 +420,12 @@ starrocks:
storageSize: 1Ti
# the storage size of persistent volume for log.
logStorageSize: 1Gi
# mount other volumes if necessary.
# Note: please use storageSpec field for persistent storage data and log.
emptyDirs: []
# e.g. mount an emptyDir volume to /tmp
# - name: tmp-data
# mountPath: /tmp
# the config start for cn, the base information as follows.
config: |
sys_log_level = INFO
Expand Down Expand Up @@ -553,6 +565,12 @@ starrocks:
storageSize: 1Ti
# Setting this parameter can persist log storage
logStorageSize: 1Gi
# mount other volumes if necessary.
# Note: please use storageSpec field for persistent storage data and log.
emptyDirs: []
# e.g. mount an emptyDir volume to /tmp
# - name: tmp-data
# mountPath: /tmp
# the config for start be. the base information as follows.
config: |
be_port = 9060
Expand Down Expand Up @@ -675,3 +693,8 @@ starrocks:
# ReadinessProbeFailureSeconds defines the total failure seconds of readiness Probe.
# default value is 15 seconds
readinessProbeFailureSeconds:
# Note: will create emptyDir volume for fe proxy, PVC is not supported.
emptyDirs: []
# e.g. mount an emptyDir volume to /tmp
# - name: tmp-data
# mountPath: /tmp
5 changes: 3 additions & 2 deletions pkg/apis/starrocks/v1/starrockscluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,11 @@ type StorageVolume struct {
// StorageSize is a valid memory size type based on powers-of-2, so 1Mi is 1024Ki.
// Supported units:Mi, Gi, GiB, Ti, Ti, Pi, Ei, Ex: `512Mi`.
// +kubebuilder:validation:Pattern:="(^0|([0-9]*l[.])?[0-9]+((M|G|T|E|P)i))$"
StorageSize string `json:"storageSize"`
// +optional
StorageSize string `json:"storageSize,omitempty"`

// MountPath specify the path of volume mount.
MountPath string `json:"mountPath,omitempty"`
MountPath string `json:"mountPath"`

// SubPath within the volume from which the container's volume should be mounted.
// Defaults to "" (volume's root).
Expand Down
9 changes: 9 additions & 0 deletions pkg/common/common.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package common

import "strings"

func EqualsIgnoreCase(a, b string) bool {
a = strings.ToLower(a)
b = strings.ToLower(b)
return a == b
}
Loading

0 comments on commit 4928526

Please sign in to comment.