'Clone pvc getting auto deleted, after successfull creation

What I observed is that after successful completion of a created volume workflow, it's getting auto-deleted.

logs:

    controller.go:1076] Requested volume size is 107374182400 and snapshot size is 107374182400 for the source snapshot test-snapshot
    controller.go:731] CreateVolumeRequest name:"abc-e366f836-18c8-4eb2-930a-85d066325381" capacity_range: volume_capabilities: access_mode: > secrets: secrets:  secrets: secrets: secrets: volume_content_source: > 
    connection.go:182] GRPC call: /csi.v1.Controller/CreateVolume
    connection.go:183] GRPC request: {"capacity_range": {"required_bytes":107374182400},"name":"abc-e366f836-18c8-4eb2-930a-85d066325381","secrets":"***stripped***","volume_capabilities":[{"AccessType":{"Mount":{"fs_type":"ext4"}},"access_mode":{"mode":1}}],"volume_content_source":{"Type":   {"Snapshot":{"snapshot_id":"efb2fbdf94b6-9b2efecf7096"}}}}
    time="2022-04-04T07:42:48Z" level=info msg="create volume called" method=create_volume parameters="map[]" secrets="map[xxxxxx]" storage_size_giga_bytes=100 version=volume_capabilities="[mount: access_mode:]" volume_content_source="snapshot: " 
    volume_name=abc-e366f836-18c8-4eb2-930a-85d066325381
    time="2022-04-04T07:42:48Z" level=info msg="New volume [abc-e366f836-18c8-4eb2-930a-85d066325381] of type clone being created using snap [snapshot-b88d2ba6-389b-4066-aac4-646606bcd759]." method=create_volume parameters="map[]" secrets="map[xxxxxx]" storage_size_giga_bytes=100 version= volume_capabilities="[mount: access_mode: ]" volume_content_source="snapshot:  " volume_name=abc-e366f836-18c8-4eb2-930a-85d066325381
    event.go:294] "Event occurred" object="default/test-abc-restore" kind="PersistentVolumeClaim" apiVersion="v1" type="Normal" reason="ExternalProvisioning" message="waiting for a volume to be created, either by external provisioner \"xyz.com\" or manually created by system administrator"
    time="2022-04-04T07:42:51Z" level=info msg="New volume [e001af7a-e58038270e158] has been created successfully." method=create_volume parameters="map[]" secrets="map[xxxxxx]" storage_size_giga_bytes=100 version= volume_capabilities="[mount: access_mode: ]" volume_content_source="snapshot: " volume_name=abc-e366f836-18c8-4eb2-930a-85d066325381
    connection.go:185] GRPC response: {"volume":{"capacity_bytes":107374182400,"volume_context":{"volname":"abc-e366f836-18c8-4eb2-930a-85d066325381","volsecret":"","volserial":"XXXX"},"volume_id":"e001af7a-e58038270e158"}}
    connection.go:186] GRPC error: 
    controller.go:762] create volume rep: {CapacityBytes:107374182400 VolumeId:e001af7a-e58038270e158 VolumeContext:map[xxxxxx] ContentSource: AccessibleTopology:[] XXX_NoUnkeyedLiteral:{} XXX_unrecognized:[] XXX_sizecache:0}
    connection.go:182] GRPC call: /csi.v1.Controller/DeleteVolume
    connection.go:183] GRPC request: {"secrets":"***stripped***","volume_id":"e001af7a-e58038270e158"}
    time="2022-04-04T07:42:51Z" level=info msg="delete volume called" method=delete_volume secrets="map[xxxxx]" version= volume_id=e001af7a-e58038270e158>

After successful CreateVolume why DeleteVolume is triggering? It was working with 1.18 k8s, but after upgrading to 1.23.X it is failing. Maybe some configuration that I am missing or doing something wrong. Any pointer will definitely help me to resolve this issue. Thank You.

Setup details:

    kubeadm version: &version.Info{Major:"1", Minor:"23", GitVersion:"**v1.23.5**", GitCommit:"c285e781331a3785a7f436042c65c5641ce8a9e9", GitTreeState:"clean", BuildDate:"2022-03-16T15:57:37Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"linux/amd64"}

    using,
    quay.io/k8scsi/csi-provisioner:v2.1.2
    quay.io/k8scsi/csi-attacher:v3.1.0 
    quay.io/k8scsi/csi-snapshotter:v4.0.0 
    quay.io/k8scsi/csi-resizer:v1.1.0


Solution 1:[1]

It requires adding ContentSource in CreateVolumeResponse. After adding ContentSource in CreateVolumeResponse issue got resolved.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aniket Bare