Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: v.oleynikov <vasily.oleynikov@flant.com>
  • Loading branch information
duckhawk committed Mar 22, 2024
1 parent 8d60a20 commit 196a640
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions images/webhooks/src/validators/storageClassUpdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package validators

import (
"context"
"fmt"
"errors"
"webhooks/v1alpha1"

"github.com/slok/kubewebhook/v2/pkg/model"
Expand All @@ -33,8 +33,18 @@ func StorageClassUpdate(ctx context.Context, _ *model.AdmissionReview, obj metav
return &kwhmutating.MutatorResult{}, nil
}

thickExists := false
thinExists := false
for _, lvmGroup := range sc.Spec.LVM.LVMVolumeGroups {
fmt.Printf("#%v", lvmGroup)
if lvmGroup.Thin == nil {
thickExists = true
} else {
thinExists = true
}
}

if thickExists == true && thinExists == true {
return &kwhmutating.MutatorResult{}, errors.New("There must be only thin or thick pools simultaneously")
}

return &kwhmutating.MutatorResult{
Expand Down

0 comments on commit 196a640

Please sign in to comment.