From 6f809b3a394f70a2ccfd269bcd074a67f5adb7b2 Mon Sep 17 00:00:00 2001 From: Derek Su Date: Fri, 7 Jul 2023 16:18:10 +0800 Subject: [PATCH 1/4] 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 { From 73e92f7069f1ae0d698198c6b43ccb400d2c10f6 Mon Sep 17 00:00:00 2001 From: Chin-Ya Huang Date: Mon, 10 Jul 2023 09:28:47 +0800 Subject: [PATCH 2/4] fix(recurring-job): flooded source label log ref: 6257 Signed-off-by: Chin-Ya Huang --- controller/volume_controller.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/controller/volume_controller.go b/controller/volume_controller.go index ec9e1ef8c5..c5301b27fd 100644 --- a/controller/volume_controller.go +++ b/controller/volume_controller.go @@ -3647,7 +3647,8 @@ func (c *VolumeController) syncPVCRecurringJobLabels(volume *longhorn.Volume) er } if !hasSourceLabel { - c.logger.Warnf("Ignoring recurring job labels on Volume %v PVC %v due to missing source label", volume.Name, pvc.Name) + c.logger.Debugf("Ignoring recurring job labels on Volume %v PVC %v due to missing source label", volume.Name, pvc.Name) + return nil } From 2c5b6234d5766344836e24f5c8faeb9c1f04d48a Mon Sep 17 00:00:00 2001 From: Chin-Ya Huang Date: Mon, 10 Jul 2023 10:08:10 +0800 Subject: [PATCH 3/4] fix: change default log level to info Signed-off-by: Chin-Ya Huang --- types/setting.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/setting.go b/types/setting.go index 69f0070ac2..2ee748cea2 100644 --- a/types/setting.go +++ b/types/setting.go @@ -1064,7 +1064,7 @@ var ( Type: SettingTypeString, Required: true, ReadOnly: false, - Default: "Debug", + Default: "Info", } SettingDefinitionOfflineReplicaRebuilding = SettingDefinition{ From 21976263f231ed46d22b96e3c70d1d0ec7ee5a23 Mon Sep 17 00:00:00 2001 From: Jack Lin Date: Mon, 10 Jul 2023 11:10:12 +0800 Subject: [PATCH 4/4] fix(backup): pvc storage class could be in annotation ref: longhorn/longhorn 6264 Signed-off-by: Jack Lin --- controller/backup_controller.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/controller/backup_controller.go b/controller/backup_controller.go index 4e18cbb22e..db311d98e1 100644 --- a/controller/backup_controller.go +++ b/controller/backup_controller.go @@ -636,7 +636,17 @@ func (bc *BackupController) checkMonitor(backup *longhorn.Backup, volume *longho if kubernetesStatus.PVCName != "" && kubernetesStatus.LastPVCRefAt == "" { pvc, _ := bc.ds.GetPersistentVolumeClaim(kubernetesStatus.Namespace, kubernetesStatus.PVCName) if pvc != nil { - storageClassName = *pvc.Spec.StorageClassName + if pvc.Spec.StorageClassName != nil { + storageClassName = *pvc.Spec.StorageClassName + } + if storageClassName == "" { + if v, exist := pvc.Annotations[corev1.BetaStorageClassAnnotation]; exist { + storageClassName = v + } + } + if storageClassName == "" { + bc.logger.Warnf("Failed to find the StorageClassName from the pvc %v", pvc.Name) + } } }