From 6bc13adc3100f5231c0362b8b351e191e77efe6d 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 (cherry picked from commit 6f809b3a394f70a2ccfd269bcd074a67f5adb7b2) --- 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 {