From dbf1cef249eac4d83e71fdc279295dd85dc5429c Mon Sep 17 00:00:00 2001 From: Justin Date: Fri, 15 Sep 2023 11:52:38 +0800 Subject: [PATCH] Make PersistentVolume local path configurable (#1088) * Make PersistentVolume local path configurable * update volumeLocalPath in README * Use volumeLocalPath variable instead of root object reference --- helm-charts/easegress/README.md | 1 + helm-charts/easegress/templates/PersistentVolume.yaml | 3 ++- helm-charts/easegress/values.yaml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/helm-charts/easegress/README.md b/helm-charts/easegress/README.md index 6f6a825d29..7317de1e49 100644 --- a/helm-charts/easegress/README.md +++ b/helm-charts/easegress/README.md @@ -66,6 +66,7 @@ The following table lists the configurable parameters of the MegaEase Easegress | service.adminPort | int | `31255` | nodePort for egctl access. | | cluster.primaryReplicas | int | `1` | number of easegress service that persists cluster data to disk | | cluster.volumeType | string | `emptyDir` | `emptyDir`: use pods internal filesystem that is not persisted when pod crashes. Use `emptyDir` only when primaryReplicas is 1. | `persistentVolume`, create as many persistenVolumes and persistentVolumeClaims as there are nodeHostnames. +| cluster.volumeLocalPath | string | `/opt/easegress` | local path of persistenVolume on nodes | | cluster.nodeHostnames | list | `[]` | nodeHostnames are hostnames of VMs/Kubernetes nodes. Only used when `volumeType: persistentVolume`. Note that this require nodes to be static. | | secondaryReplicas | int | `0` | number of easegress service that not persists cluster data to disk. | | log.path | string | `/opt/easegress/log` | log path inside container | diff --git a/helm-charts/easegress/templates/PersistentVolume.yaml b/helm-charts/easegress/templates/PersistentVolume.yaml index 75e7845261..08cb6e0b0b 100644 --- a/helm-charts/easegress/templates/PersistentVolume.yaml +++ b/helm-charts/easegress/templates/PersistentVolume.yaml @@ -1,4 +1,5 @@ {{- if eq .Values.cluster.volumeType "persistentVolume" }} +{{- $volumeLocalPath := .Values.cluster.volumeLocalPath -}} {{- range $i, $hostname := .Values.cluster.nodeHostnames }} apiVersion: v1 kind: PersistentVolume @@ -13,7 +14,7 @@ spec: persistentVolumeReclaimPolicy: Delete storageClassName: easegress-storage local: - path: /opt/easegress + path: {{$volumeLocalPath}} nodeAffinity: required: nodeSelectorTerms: diff --git a/helm-charts/easegress/values.yaml b/helm-charts/easegress/values.yaml index 7bdb4f4a4a..137b995d00 100644 --- a/helm-charts/easegress/values.yaml +++ b/helm-charts/easegress/values.yaml @@ -16,6 +16,7 @@ image: cluster: primaryReplicas: 1 # or 3,5,7 volumeType: emptyDir # or persistentVolume + volumeLocalPath: /opt/easegress # nodeHostnames are hostnames of VMs/Kubernetes nodes. Only used when `volumeType: persistentVolume`. # Note that this require nodes to be static. nodeHostnames: