Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG] Can't delete volumesnapshot if backup target not setΒ #4979

@chriscchien

Description

@chriscchien

Describe the bug (πŸ› if you encounter this issue)

Volumesnapshot can't delete if no backup target set

To Reproduce

Steps to reproduce the behavior:

  1. Deploy Longhorn without backup target set
  2. Enable CSI Snapshot Support here (Use 4.0)
    Enable CSI Snapshot Support here (Use 5.0.1)
  3. Create VolumeSnapshotClass
kind: VolumeSnapshotClass
apiVersion: snapshot.storage.k8s.io/v1
metadata:
     name: longhorn-backup
driver: driver.longhorn.io
deletionPolicy: Delete
parameters:
    type: bak
  1. Create a POD, PV and PVC. Waiting Longhorn volume generate and attach to one node.
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
 name: longhorn-volv-pvc
 namespace: default
spec:
 accessModes:
   - ReadWriteOnce
 storageClassName: longhorn
 resources:
   requests:
     storage: 5Gi
---
apiVersion: v1
kind: Pod
metadata:
 name: volume-test-1
 namespace: default
spec:
 restartPolicy: Always
 containers:
 - name: volume-test
   image: nginx:stable-alpine
   imagePullPolicy: IfNotPresent
   livenessProbe:
     exec:
       command:
         - ls
         - /data/lost+found
     initialDelaySeconds: 5
     periodSeconds: 5
   volumeMounts:
   - name: volv
     mountPath: /data
   ports:
   - containerPort: 80
 volumes:
 - name: volv
   persistentVolumeClaim:
     claimName: longhorn-volv-pvc
  1. Create a VolumeSnapshot to create backup for the volume
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshot
metadata:
  name: test-snapshot-longhorn-backup-1
spec:
  volumeSnapshotClassName: longhorn-backup
  source:
    persistentVolumeClaimName: longhorn-volv-pvc
  1. Delete the VolumeSnapshot
  2. VolumeSnapshot delete progress stuck

Expected behavior

Volumesnapshot should be able to delete if it's not started yet

Log or Support bundle

N/A

Environment

  • Longhorn version: master 0e002d
  • Installation method (e.g. Rancher Catalog App/Helm/Kubectl): kubectl
  • Kubernetes distro (e.g. RKE/K3s/EKS/OpenShift) and version: v1.25.4+k3s1
  • Number of Longhorn volumes in the cluster:

Additional context

#4107 (comment)

Metadata

Metadata

Labels

Type

No type

Projects

Status

Closed

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions