From 338d057f20acd72aa844caca1f19af442279aa67 Mon Sep 17 00:00:00 2001 From: Mayank <33252549+mynktl@users.noreply.github.com> Date: Wed, 8 Jan 2020 12:43:26 +0530 Subject: [PATCH] cherry-pick(fix, statefuleset): fixing storageclass for STS if mentioned in annotation (#49) Signed-off-by: mayank --- pkg/cstor/pvc_operation.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/cstor/pvc_operation.go b/pkg/cstor/pvc_operation.go index 5e11114f..1bbd87d1 100644 --- a/pkg/cstor/pvc_operation.go +++ b/pkg/cstor/pvc_operation.go @@ -59,6 +59,11 @@ func (p *Plugin) backupPVC(volumeID string) error { bkpPvc.ResourceVersion = "" bkpPvc.SelfLink = "" + if bkpPvc.Spec.StorageClassName == nil || len(*bkpPvc.Spec.StorageClassName) == 0 { + sc := bkpPvc.Annotations[v1.BetaStorageClassAnnotation] + bkpPvc.Spec.StorageClassName = &sc + } + bkpPvc.Annotations = nil bkpPvc.UID = "" bkpPvc.Spec.VolumeName = ""