mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Merge pull request #89845 from yuga711/pvc-pv
Added events for failures in PV/PVC processing.
This commit is contained in:
commit
c70e3e93bd
@ -415,6 +415,8 @@ func (ctrl *PersistentVolumeController) syncUnboundClaim(claim *v1.PersistentVol
|
|||||||
// OBSERVATION: pvc is "Pending", pv is "Bound"
|
// OBSERVATION: pvc is "Pending", pv is "Bound"
|
||||||
if !metav1.HasAnnotation(claim.ObjectMeta, pvutil.AnnBoundByController) {
|
if !metav1.HasAnnotation(claim.ObjectMeta, pvutil.AnnBoundByController) {
|
||||||
klog.V(4).Infof("synchronizing unbound PersistentVolumeClaim[%s]: volume already bound to different claim by user, will retry later", claimToClaimKey(claim))
|
klog.V(4).Infof("synchronizing unbound PersistentVolumeClaim[%s]: volume already bound to different claim by user, will retry later", claimToClaimKey(claim))
|
||||||
|
claimMsg := fmt.Sprintf("volume %q already bound to a different claim.", volume.Name)
|
||||||
|
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.FailedBinding, claimMsg)
|
||||||
// User asked for a specific PV, retry later
|
// User asked for a specific PV, retry later
|
||||||
if _, err = ctrl.updateClaimStatus(claim, v1.ClaimPending, nil); err != nil {
|
if _, err = ctrl.updateClaimStatus(claim, v1.ClaimPending, nil); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -424,6 +426,9 @@ func (ctrl *PersistentVolumeController) syncUnboundClaim(claim *v1.PersistentVol
|
|||||||
// This should never happen because someone had to remove
|
// This should never happen because someone had to remove
|
||||||
// AnnBindCompleted annotation on the claim.
|
// AnnBindCompleted annotation on the claim.
|
||||||
klog.V(4).Infof("synchronizing unbound PersistentVolumeClaim[%s]: volume already bound to different claim %q by controller, THIS SHOULD NEVER HAPPEN", claimToClaimKey(claim), claimrefToClaimKey(volume.Spec.ClaimRef))
|
klog.V(4).Infof("synchronizing unbound PersistentVolumeClaim[%s]: volume already bound to different claim %q by controller, THIS SHOULD NEVER HAPPEN", claimToClaimKey(claim), claimrefToClaimKey(volume.Spec.ClaimRef))
|
||||||
|
claimMsg := fmt.Sprintf("volume %q already bound to a different claim.", volume.Name)
|
||||||
|
ctrl.eventRecorder.Event(claim, v1.EventTypeWarning, events.FailedBinding, claimMsg)
|
||||||
|
|
||||||
return fmt.Errorf("Invalid binding of claim %q to volume %q: volume already claimed by %q", claimToClaimKey(claim), claim.Spec.VolumeName, claimrefToClaimKey(volume.Spec.ClaimRef))
|
return fmt.Errorf("Invalid binding of claim %q to volume %q: volume already claimed by %q", claimToClaimKey(claim), claim.Spec.VolumeName, claimrefToClaimKey(volume.Spec.ClaimRef))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -604,12 +609,15 @@ func (ctrl *PersistentVolumeController) syncVolume(volume *v1.PersistentVolume)
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = ctrl.reclaimVolume(volume); err != nil {
|
if err = ctrl.reclaimVolume(volume); err != nil {
|
||||||
// Release failed, we will fall back into the same condition
|
// Release failed, we will fall back into the same condition
|
||||||
// in the next call to this method
|
// in the next call to this method
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
if volume.Spec.PersistentVolumeReclaimPolicy == v1.PersistentVolumeReclaimRetain {
|
||||||
|
// volume is being retained, it references a claim that does not exist now.
|
||||||
|
klog.V(4).Infof("PersistentVolume[%s] references a claim %q (%s) that is not found", volume.Name, claimrefToClaimKey(volume.Spec.ClaimRef), volume.Spec.ClaimRef.UID)
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
} else if claim.Spec.VolumeName == "" {
|
} else if claim.Spec.VolumeName == "" {
|
||||||
if pvutil.CheckVolumeModeMismatches(&claim.Spec, &volume.Spec) {
|
if pvutil.CheckVolumeModeMismatches(&claim.Spec, &volume.Spec) {
|
||||||
|
Loading…
Reference in New Issue
Block a user