mirror of
https://github.com/projectcapsule/capsule.git
synced 2026-08-25 16:07:24 +00:00
refactor: better name variables in pkg/webhook/pvc
This commit is contained in:
committed by
Dario Tranchitella
parent
7ca9fe0c63
commit
cec8cc0573
@@ -67,25 +67,25 @@ func (h *handler) OnCreate(c client.Client, decoder *admission.Decoder) capsulew
|
||||
return admission.Errored(http.StatusBadRequest, err)
|
||||
}
|
||||
|
||||
tl := &capsulev1alpha1.TenantList{}
|
||||
if err := c.List(ctx, tl, client.MatchingFieldsSelector{
|
||||
tntList := &capsulev1alpha1.TenantList{}
|
||||
if err := c.List(ctx, tntList, client.MatchingFieldsSelector{
|
||||
Selector: fields.OneTermEqualSelector(".status.namespaces", pvc.Namespace),
|
||||
}); err != nil {
|
||||
return admission.Errored(http.StatusBadRequest, err)
|
||||
}
|
||||
|
||||
if len(tl.Items) == 0 {
|
||||
if len(tntList.Items) == 0 {
|
||||
return admission.Allowed("")
|
||||
}
|
||||
|
||||
tnt := tl.Items[0]
|
||||
tnt := tntList.Items[0]
|
||||
|
||||
if tnt.Spec.StorageClasses == nil {
|
||||
return admission.Allowed("")
|
||||
}
|
||||
|
||||
if pvc.Spec.StorageClassName == nil {
|
||||
return admission.Errored(http.StatusBadRequest, NewStorageClassNotValid(*tl.Items[0].Spec.StorageClasses))
|
||||
return admission.Errored(http.StatusBadRequest, NewStorageClassNotValid(*tntList.Items[0].Spec.StorageClasses))
|
||||
}
|
||||
|
||||
sc := *pvc.Spec.StorageClassName
|
||||
|
||||
Reference in New Issue
Block a user