From 080e586a6656ee5def3c013d1c3b7ba941d3132b Mon Sep 17 00:00:00 2001 From: peng9808 Date: Mon, 15 Jul 2024 09:52:18 +0800 Subject: [PATCH] make data safer by default.in case user delete pvc by accident , and data lost happens Signed-off-by: peng9808 --- Dockerfile | 2 -- helm/operator/templates/hwameistorcluster.yaml | 2 +- helm/operator/values.yaml | 2 ++ pkg/install/storageclass/storageclass.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index fee3fa53..343b278b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,5 @@ FROM centos:7 -FROM centos:7 - # Update the CentOS repository configuration RUN sed -i 's|mirrorlist=http://mirrorlist.centos.org/?|#mirrorlist=http://mirrorlist.centos.org/?|g' /etc/yum.repos.d/CentOS-*.repo && \ sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*.repo diff --git a/helm/operator/templates/hwameistorcluster.yaml b/helm/operator/templates/hwameistorcluster.yaml index 57f05860..9f1b2a4b 100644 --- a/helm/operator/templates/hwameistorcluster.yaml +++ b/helm/operator/templates/hwameistorcluster.yaml @@ -255,7 +255,7 @@ spec: chartVersion: "v0.4.1" storageClass: allowVolumeExpansion: true - reclaimPolicy: "Delete" + reclaimPolicy: {{ $.Values.storageClassReclaimPolicy }} fsType: "xfs" dataLoadManager: diff --git a/helm/operator/values.yaml b/helm/operator/values.yaml index 1d3978a6..70b2e0d3 100644 --- a/helm/operator/values.yaml +++ b/helm/operator/values.yaml @@ -183,6 +183,8 @@ dataLoadInit: imageRepository: hwameistor/dataload-init tag: v0.0.1 + +#storageClassReclaimPolicy: Retain > Delete #datasetDefaultPoolClass: NVMe > SSD > HDD # diskReserve example diff --git a/pkg/install/storageclass/storageclass.go b/pkg/install/storageclass/storageclass.go index c97933f4..9db2b9a2 100644 --- a/pkg/install/storageclass/storageclass.go +++ b/pkg/install/storageclass/storageclass.go @@ -34,7 +34,7 @@ func NewMaintainer(cli client.Client, clusterInstance *hwameistoroperatorv1alpha var volumeBindingWaitForFirstConsumer = storagev1.VolumeBindingWaitForFirstConsumer var defaultAllowVolumeExpansionBooleanValue = true -var defaultReclaimPolicy = corev1.PersistentVolumeReclaimDelete +var defaultReclaimPolicy = corev1.PersistentVolumeReclaimRetain var defaultDiskType = "HDD" var defaultFSType = "xfs"