mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 21:12:07 +00:00
Merge pull request #21268 from jsafrane/devel/recycle-provisioned
Auto commit by PR queue bot
This commit is contained in:
commit
a52eb5d433
@ -239,6 +239,7 @@ func syncVolume(volumeIndex *persistentVolumeOrderedIndex, binderClient binderCl
|
|||||||
if volume.Spec.ClaimRef != nil {
|
if volume.Spec.ClaimRef != nil {
|
||||||
claim, err := binderClient.GetPersistentVolumeClaim(volume.Spec.ClaimRef.Namespace, volume.Spec.ClaimRef.Name)
|
claim, err := binderClient.GetPersistentVolumeClaim(volume.Spec.ClaimRef.Namespace, volume.Spec.ClaimRef.Name)
|
||||||
if errors.IsNotFound(err) {
|
if errors.IsNotFound(err) {
|
||||||
|
if volume.Spec.PersistentVolumeReclaimPolicy == api.PersistentVolumeReclaimRecycle {
|
||||||
// Pending volumes that have a ClaimRef where the claim is missing were recently recycled.
|
// Pending volumes that have a ClaimRef where the claim is missing were recently recycled.
|
||||||
// The Recycler set the phase to VolumePending to start the volume at the beginning of this lifecycle.
|
// The Recycler set the phase to VolumePending to start the volume at the beginning of this lifecycle.
|
||||||
// removing ClaimRef unbinds the volume
|
// removing ClaimRef unbinds the volume
|
||||||
@ -258,6 +259,12 @@ func syncVolume(volumeIndex *persistentVolumeOrderedIndex, binderClient binderCl
|
|||||||
volume = updatedVolume
|
volume = updatedVolume
|
||||||
volumeIndex.Update(volume)
|
volumeIndex.Update(volume)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// Pending volumes that has a ClaimRef and the claim is missing and is was not recycled.
|
||||||
|
// It must have been freshly provisioned and the claim was deleted during the provisioning.
|
||||||
|
// Mark the volume as Released, it will be deleted.
|
||||||
|
nextPhase = api.VolumeReleased
|
||||||
|
}
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return fmt.Errorf("Error getting PersistentVolumeClaim[%s/%s]: %v", volume.Spec.ClaimRef.Namespace, volume.Spec.ClaimRef.Name, err)
|
return fmt.Errorf("Error getting PersistentVolumeClaim[%s/%s]: %v", volume.Spec.ClaimRef.Namespace, volume.Spec.ClaimRef.Name, err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user