controller: engine: don't update engine status unnecessarily
Longhorn
@@ -679,6 +679,8 @@ func (m *EngineMonitor) stop(e *longhorn.Engine) {
}
func (m *EngineMonitor) refresh(engine *longhorn.Engine) error {
+ existingEngine := engine.DeepCopy()
+
addressReplicaMap := map[string]string{}
for replica, address := range engine.Status.CurrentReplicaAddressMap {
if addressReplicaMap[address] != "" {
@@ -800,10 +802,12 @@ func (m *EngineMonitor) refresh(engine *longhorn.Engine) error {
engine.Status.PurgeStatus = purgeStatus
}
+ if !reflect.DeepEqual(existingEngine.Status, engine.Status) {
engine, err = m.ds.UpdateEngineStatus(engine)
if err != nil {
return err
}
+ }
if !isOldVersion {
if engine.Spec.VolumeSize != engine.Status.CurrentSize {
