@@ -24,6 +24,7 @@ import (
24
24
"google.golang.org/grpc/status"
25
25
v1 "k8s.io/api/core/v1"
26
26
storagev1beta1 "k8s.io/api/storage/v1beta1"
27
+ apierrors "k8s.io/apimachinery/pkg/api/errors"
27
28
"k8s.io/client-go/tools/cache"
28
29
"k8s.io/klog/v2"
29
30
)
@@ -61,6 +62,9 @@ func (ctrl *modifyController) modify(pvc *v1.PersistentVolumeClaim, pv *v1.Persi
61
62
} else {
62
63
vac , err := ctrl .vacLister .Get (* pvcSpecVacName )
63
64
if err != nil {
65
+ if apierrors .IsNotFound (err ) {
66
+ ctrl .eventRecorder .Eventf (pvc , v1 .EventTypeWarning , util .VolumeModifyFailed , "VAC " + * pvcSpecVacName + " does not exist." )
67
+ }
64
68
return pvc , pv , err , false
65
69
}
66
70
return ctrl .controllerModifyVolumeWithTarget (pvc , pv , vac , pvcSpecVacName )
@@ -91,6 +95,9 @@ func (ctrl *modifyController) validateVACAndModifyVolumeWithTarget(
91
95
fmt .Sprintf ("external resizer is modifying volume %s with vac %s" , pvc .Name , * pvcSpecVacName ))
92
96
return ctrl .controllerModifyVolumeWithTarget (pvc , pv , vac , pvcSpecVacName )
93
97
} else {
98
+ if apierrors .IsNotFound (err ) {
99
+ ctrl .eventRecorder .Eventf (pvc , v1 .EventTypeWarning , util .VolumeModifyFailed , "VAC " + * pvcSpecVacName + " does not exist." )
100
+ }
94
101
klog .Errorf ("Get VAC with vac name %s in VACInformer cache failed: %v" , * pvcSpecVacName , err )
95
102
// Mark pvc.Status.ModifyVolumeStatus as pending
96
103
pvc , err = ctrl .markControllerModifyVolumeStatus (pvc , v1 .PersistentVolumeClaimModifyVolumePending , nil )
0 commit comments