aws-ebs-csi-driver
aws-ebs-csi-driver copied to clipboard
Support tagSpecification on VolumeSnapshotClass
/kind bug
What happened? The tagSpecification for StorageClass is not being applied on VolumeSnapshotClass as expected
What you expected to happen? The same tags applied to the PV, being populated to the Snapshots because it is useful to know contextual information about where the snapshot came from.
How to reproduce it (as minimally and precisely as possible)?
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: csi-block
provisioner: ebs.csi.aws.com
allowVolumeExpansion: true
parameters:
tagSpecification_1: "pvcnamespace={{ .PVCNamespace }}"
tagSpecification_2: "pvcname={{ .PVCName }}"
tagSpecification_3: "pvname={{ .PVName }}"
Anything else we need to know?:
Environment
- Kubernetes version (use
kubectl version):
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.0", GitCommit:"c2b5237ccd9c0f1d600d3072634ca66cefdf272f", GitTreeState:"clean", BuildDate:"2021-08-04T18:03:20Z", GoVersion:"go1.16.6", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"21+", GitVersion:"v1.21.9-eks-14c7a48", GitCommit:"717bfb2b8ceb809a42a6c0baabde59fae28637ef", GitTreeState:"clean", BuildDate:"2022-04-01T03:17:28Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"linux/amd64"}
- Driver version: v1.6.1
Hi @achetronic, currently CSI Driver doesn't have support tagSpecification on VolumeSnapshotClass, I will regard it as a feature request. We will keep this on our radar. Thank you for raise it up. kind/feature
Hi @achetronic, currently CSI Driver doesn't have support tagSpecification on VolumeSnapshotClass, I will regard it as a feature request. We will keep this on our radar. Thank you for raise it up. kind/feature
Thank you for the response. I will keep in touch about this feature
+1
@achetronic : Is this related to adding custom tags while creating PVC?
@achetronic : Is this related to adding custom tags while creating PVC?
Hello there,
This is about tagging the snapshots on the provider when creating a VolumeSnapshot CR. The point is that when you destroy a volume, it is possible to create a PVC from the Snapshot, but how do you identify the snapshot you need when destroyed the volume in the cloud and no tags to in the Snapshot? So this feature could solve that problem
Hi @achetronic, sorry for commenting on a closed issue. I tried deploying a volumesnapshotclass with specified extra tags but it can only work with static values and not the template ones. Below is my definition of volumesnapshotclass and the logs being thrown by ebs-plugin pod (similar errors are thrown by the csi-snapshotter)
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: delete-vsc
labels:
velero.io/csi-volumesnapshot-class: "true"
driver: ebs.csi.aws.com
deletionPolicy: Delete
parameters:
tagSpecification_1: "pvc_namespace={{ .PVCNamespace }}"
tagSpecification_2: "pvc_name={{ .PVCName }}"
tagSpecification_3: "pv_name={{ .PVName }}"
E1031 15:14:24.748339 1 driver.go:120] GRPC error: rpc error: code = InvalidArgument desc = Error interpolating the tag value: template: tmpl:1:3: executing "tmpl" at <.PVCName>: nil pointer evaluating *template.Props.PVCName
E1031 15:14:25.345460 1 driver.go:120] GRPC error: rpc error: code = InvalidArgument desc = Error interpolating the tag value: template: tmpl:1:3: executing "tmpl" at <.PVCNamespace>: nil pointer evaluating *template.Props.PVCNamespace
E1031 15:14:25.947252 1 driver.go:120] GRPC error: rpc error: code = InvalidArgument desc = Error interpolating the tag value: template: tmpl:1:3: executing "tmpl" at <.PVName>: nil pointer evaluating *template.Props.PVName
When I tested it with static value such as key1=value1 it worked okay. Do you know if this is a bug or intended functionality? Or is there something I am doing wrong? Using only static tags does not really help resolve the issue of having multiple snapshots in AWS but not knowing which snapshot is for which PVC
Thank you for your help and response
@aschi1 unfortunately, the only additional information provided by external-snapshotter is the snapshot's name/namespace and the snapshot content's name. We don't currently expose those as parameters but could, feel free to open a feature request if you need that functionality.
We do not receive and thus cannot expose the associated PV/PVC of a snapshot. You would first need to request the external-snapshotter project make that information available to us in the CreateSnapshot RPC call.
@ConnorJC3 Thank you for the response. I understand and I will try to move the discussion there!
Again, apologies for commenting on a closed issue. I would really value the change that @ConnorJC3 suggested, i.e. being able to expose the snapshot's name/namespace as parameters so that they could be added as AWS tags on the underlying EBS snapshots, which sounds like it wouldn't need the external-snapshotter change? Doing this (enabling us to tag snapshots with the namespace they are in) would allow us to explore costs per snapshot namespace in AWS. Should I raise a feature request or @aschi1 have you already raised one for this?
Hi @user36362992 , I just opened a feature req for this which will add the support in the CSI Driver to enable users to add snapshot name&namespace (and more expressive options) to snapshot tags. https://github.com/kubernetes-sigs/aws-ebs-csi-driver/issues/1553