From 14666277902ec6bff79ca3f701d7d6a4e131f0f1 Mon Sep 17 00:00:00 2001 From: Derek Su Date: Fri, 7 Jul 2023 16:18:10 +0800 Subject: [PATCH] Remove orphapn UPDATE immutable validation Longhorn 6246 Signed-off-by: Derek Su --- webhook/resources/orphan/validator.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/webhook/resources/orphan/validator.go b/webhook/resources/orphan/validator.go index 744da5fbd7..ff059f1cae 100644 --- a/webhook/resources/orphan/validator.go +++ b/webhook/resources/orphan/validator.go @@ -2,7 +2,6 @@ package orphan import ( "fmt" - "reflect" admissionregv1 "k8s.io/api/admissionregistration/v1" "k8s.io/apimachinery/pkg/runtime" @@ -54,17 +53,12 @@ func (o *orphanValidator) Create(request *admission.Request, newObj runtime.Obje } func (o *orphanValidator) Update(request *admission.Request, oldObj runtime.Object, newObj runtime.Object) error { - oldOrphan := oldObj.(*longhorn.Orphan) newOrphan := newObj.(*longhorn.Orphan) if err := checkOrphanParameters(newOrphan); err != nil { return werror.NewInvalidError(err.Error(), "") } - if !reflect.DeepEqual(oldOrphan.Spec, newOrphan.Spec) { - return werror.NewInvalidError(fmt.Sprintf("orphan %v spec fields are immutable", oldOrphan.Name), "") - } - return nil } @@ -83,6 +77,7 @@ func checkOrphanForReplicaDirectory(orphan *longhorn.Orphan) error { longhorn.OrphanDiskName, longhorn.OrphanDiskUUID, longhorn.OrphanDiskPath, + longhorn.OrphanDiskType, } for _, param := range params {