Skip to content

Commit

Permalink
Fix the failure of getting pvc when deleting namespace (#6)
Browse files Browse the repository at this point in the history
* Fix the failure of getting pvc when name is empty when deleting namespace

Signed-off-by: f10atin9 <f10atin9@kubesphere.io>

Signed-off-by: f10atin9 <f10atin9@kubesphere.io>
  • Loading branch information
f10atin9 committed Sep 30, 2022
1 parent 7f579e7 commit 3c50863
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions webhook/pvc.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ func AdmitPVC(ar admissionv1.AdmissionReview) *admissionv1.AdmissionResponse {
return toV1AdmissionResponse(err)
}
case admissionv1.Delete:
if ar.Request.Namespace != "" && ar.Request.Name == "" {
return reviewResponse
}
pvcInfo := types.NamespacedName{
Namespace: ar.Request.Namespace,
Name: ar.Request.Name,
Expand Down

0 comments on commit 3c50863

Please sign in to comment.