From 0044ec7a78b68e3ad077d8b06dd329fbed292ec6 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Fri, 20 Sep 2024 13:12:14 +0000 Subject: [PATCH] fix: ignore snapshot keys in snapshot storage class --- pkg/azureconstants/azure_constants.go | 3 +++ pkg/azuredisk/controllerserver.go | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/pkg/azureconstants/azure_constants.go b/pkg/azureconstants/azure_constants.go index 58d15c88f0..4fb162b37d 100644 --- a/pkg/azureconstants/azure_constants.go +++ b/pkg/azureconstants/azure_constants.go @@ -56,6 +56,9 @@ const ( PvcNamespaceTag = "kubernetes.io-created-for-pvc-namespace" PvcNameTag = "kubernetes.io-created-for-pvc-name" PvNameKey = "csi.storage.k8s.io/pv/name" + VolumeSnapshotNameKey = "csi.storage.k8s.io/volumesnapshot/name" + VolumeSnapshotNamespaceKey = "csi.storage.k8s.io/volumesnapshot/namespace" + VolumeSnapshotContentNameKey = "csi.storage.k8s.io/volumesnapshotcontent/name" PvNameTag = "kubernetes.io-created-for-pv-name" RateLimited = "rate limited" RequestedSizeGib = "requestedsizegib" diff --git a/pkg/azuredisk/controllerserver.go b/pkg/azuredisk/controllerserver.go index e579ad9080..83a4274f15 100644 --- a/pkg/azuredisk/controllerserver.go +++ b/pkg/azuredisk/controllerserver.go @@ -1012,6 +1012,12 @@ func (d *Driver) CreateSnapshot(ctx context.Context, req *csi.CreateSnapshotRequ dataAccessAuthMode = v case consts.TagValueDelimiterField: tagValueDelimiter = v + case consts.VolumeSnapshotNameKey: + // ignore the key + case consts.VolumeSnapshotNamespaceKey: + // ignore the key + case consts.VolumeSnapshotContentNameKey: + // ignore the key default: return nil, status.Errorf(codes.Internal, "AzureDisk - invalid option %s in VolumeSnapshotClass", k) }