Skip to content

Commit

Permalink
feat(webhook): enable storage reserved updates via webhook
Browse files Browse the repository at this point in the history
Signed-off-by: jangseon.ryu <[email protected]>
  • Loading branch information
jangseon-ryu authored and derekbit committed Nov 22, 2024
1 parent 4864291 commit e0b9f14
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions webhook/resources/node/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ func (n *nodeValidator) Create(request *admission.Request, newObj runtime.Object
}
}

if disk.Type == longhorn.DiskTypeBlock {
if disk.StorageReserved != 0 {
return werror.NewInvalidError(fmt.Sprintf("disk %v type %v is not supported to reserve storage", name, disk.Type), "")
}
} else {
if disk.Type != longhorn.DiskTypeBlock {
if disk.DiskDriver != longhorn.DiskDriverNone {
return werror.NewInvalidError(fmt.Sprintf("disk %v type %v is not supported to specify disk driver", name, disk.Type), "")
}
Expand Down Expand Up @@ -177,11 +173,7 @@ func (n *nodeValidator) Update(request *admission.Request, oldObj runtime.Object
newNode.Name, name, disk.Path), "")
}
}
if disk.Type == longhorn.DiskTypeBlock {
if disk.StorageReserved != 0 {
return werror.NewInvalidError(fmt.Sprintf("disk %v type %v is not supported to reserve storage", name, disk.Type), "")
}
} else {
if disk.Type != longhorn.DiskTypeBlock {
if disk.DiskDriver != longhorn.DiskDriverNone {
return werror.NewInvalidError(fmt.Sprintf("disk %v type %v is not supported to specify disk driver", name, disk.Type), "")
}
Expand Down

0 comments on commit e0b9f14

Please sign in to comment.