Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: do not change the revisionCounterDisabled as it is an immutable field after creation (backport #3085) #3093

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions upgrade/v14xto150/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 4 additions & 3 deletions webhook/resources/volume/mutator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
Loading