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 Apr 22, 2024
1 parent 882e9af commit 1e64799
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions images/webhooks/src/validators/storageClassUpdate.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,12 @@ func StorageClassUpdate(ctx context.Context, _ *model.AdmissionReview, obj metav

storageClasses, _ := staticClient.StorageV1beta1().StorageClasses().List(context.TODO(), metav1.ListOptions{})
for _, storageClass := range storageClasses.Items {
klog.Infof(storageClass.Name)
for label, value := range storageClass.GetObjectMeta().GetAnnotations() {
klog.Infof(label)
klog.Infof(value)
klog.Infof(storageClass.Name)
klog.Infof(sc.Name)
if label == "storageclass.kubernetes.io/is-default-class" && value == "true" && storageClass.Name != sc.Name {
klog.Infof("Default StorageClass already set: %s", storageClass.Name)
return &kwhvalidating.ValidatorResult{Valid: false, Message: fmt.Sprintf("Default StorageClass already set: %s", storageClass.Name)},
Expand Down

0 comments on commit 1e64799

Please sign in to comment.