diff --git a/webhook/resources/volume/mutator.go b/webhook/resources/volume/mutator.go index e1b9654079..eb2258de86 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 types.IsDataEngineV2(volume.Spec.DataEngine) { if volume.Spec.DataLocality != longhorn.DataLocalityDisabled { @@ -325,9 +329,6 @@ func mutate(newObj runtime.Object, moreLabels map[string]string) (admission.Patc if string(volume.Spec.DataEngine) == "" { patchOps = append(patchOps, fmt.Sprintf(`{"op": "replace", "path": "/spec/dataEngine", "value": "%s"}`, longhorn.DataEngineTypeV1)) } - if volume.Spec.DataLocality == longhorn.DataLocalityStrictLocal { - patchOps = append(patchOps, `{"op": "replace", "path": "/spec/revisionCounterDisabled", "value": true}`) - } if string(volume.Spec.FreezeFilesystemForSnapshot) == "" { patchOps = append(patchOps, fmt.Sprintf(`{"op": "replace", "path": "/spec/freezeFilesystemForSnapshot", "value": "%s"}`, longhorn.FreezeFilesystemForSnapshotDefault)) }