Skip to content
This repository was archived by the owner on Apr 25, 2023. It is now read-only.

Skip writing propagated version to the API when unchanged #1098

Merged
merged 1 commit into from
Aug 17, 2019
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Unreleased
- [#1098](https://github.com/kubernetes-sigs/kubefed/pull/1098)
Propagated version is now only updated when changed.
- [#1087](https://github.com/kubernetes-sigs/kubefed/issues/1087)
The ReplicaScheduling controller now correctly updates existing
overrides of `/spec/replicas`. Previously the controller was able
Expand Down
9 changes: 8 additions & 1 deletion pkg/controller/sync/version/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,12 @@ func (m *VersionManager) Update(resource VersionedResource,
}

if oldStatus != nil && util.PropagatedVersionStatusEquivalent(oldStatus, status) {
m.Unlock()
klog.V(4).Infof("No update necessary for %s %q", m.adapter.TypeName(), qualifiedName)
} else if obj == nil {
return nil
}

if obj == nil {
ownerReference := ownerReferenceForUnstructured(resource.Object())
obj = m.adapter.NewVersion(qualifiedName, ownerReference, status)
m.versions[key] = obj
Expand All @@ -186,6 +190,9 @@ func (m *VersionManager) Update(resource VersionedResource,

m.Unlock()

// Since writeVersion calls the Kube API, the manager should be
// unlocked to avoid blocking on calls across the network.

return m.writeVersion(obj, qualifiedName)
}

Expand Down