How to define volumeclaimtemplate in Statefulset that uses a Volume Snapshot source with pod-ordinal in its name?

Hello community,

I’m running a statefulset with PVC template. So, I got PVC and PV per pod as expected. I took Volumesnapshot for backup. Now, I want to start my Statefulset with that source. I see that one can extract the pod ordinal from hostname. But, I dont find any documentation on how to get that ordinal so it can be used in dataSource section of volume claim template.

Any pointers to such documentation or procedure on how to do rollback of stateful application?

Thanks in advance,

// Kaja