diff --git a/upgrade/v14xto150/upgrade.go b/upgrade/v14xto150/upgrade.go index ddbb52829c..3095c4d128 100644 --- a/upgrade/v14xto150/upgrade.go +++ b/upgrade/v14xto150/upgrade.go @@ -106,9 +106,6 @@ func upgradeVolumes(namespace string, lhClient *lhclientset.Clientset, resourceM if v.Spec.BackupCompressionMethod == "" { v.Spec.BackupCompressionMethod = longhorn.BackupCompressionMethodGzip } - if v.Spec.DataLocality == longhorn.DataLocalityStrictLocal { - v.Spec.RevisionCounterDisabled = true - } if v.Spec.ReplicaSoftAntiAffinity == "" { v.Spec.ReplicaSoftAntiAffinity = longhorn.ReplicaSoftAntiAffinityDefault } diff --git a/webhook/resources/volume/mutator.go b/webhook/resources/volume/mutator.go index 9f1892a818..6c5d14c68d 100644 --- a/webhook/resources/volume/mutator.go +++ b/webhook/resources/volume/mutator.go @@ -190,6 +190,10 @@ func (v *volumeMutator) Create(request *admission.Request, newObj runtime.Object patchOps = append(patchOps, fmt.Sprintf(`{"op": "replace", "path": "/spec/snapshotMaxCount", "value": %v}`, snapshotMaxCount)) } + if volume.Spec.DataLocality == longhorn.DataLocalityStrictLocal { + patchOps = append(patchOps, `{"op": "replace", "path": "/spec/revisionCounterDisabled", "value": true}`) + } + // TODO: Remove the mutations below after they are implemented for SPDK volumes if datastore.IsDataEngineV2(volume.Spec.DataEngine) { if volume.Spec.DataLocality != longhorn.DataLocalityDisabled { @@ -327,9 +331,6 @@ func mutate(newObj runtime.Object, moreLabels map[string]string) (admission.Patc // Always mutate the offlineReplicaRebuilding to disabled for non-SPDK volumes patchOps = append(patchOps, fmt.Sprintf(`{"op": "replace", "path": "/spec/offlineReplicaRebuilding", "value": "%s"}`, longhorn.OfflineReplicaRebuildingDisabled)) } - if volume.Spec.DataLocality == longhorn.DataLocalityStrictLocal { - patchOps = append(patchOps, `{"op": "replace", "path": "/spec/revisionCounterDisabled", "value": true}`) - } labels := volume.Labels if labels == nil {