Skip to content

Commit

Permalink
Only sync log settings to running instance manager pod
Browse files Browse the repository at this point in the history
No need to sync log settings to non-running instance manager pod for
avoiding flooding warning messages.

Longhorn 8466

Signed-off-by: Derek Su <derek.su@suse.com>
  • Loading branch information
derekbit authored and mergify[bot] committed Apr 29, 2024
1 parent 8a6682d commit 4dbba5b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions controller/instance_manager_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,11 +455,15 @@ func (imc *InstanceManagerController) syncInstanceStatus(im *longhorn.InstanceMa
return nil
}

func (imc *InstanceManagerController) syncLogSettingsToIMPod(im *longhorn.InstanceManager) error {
func (imc *InstanceManagerController) syncLogSettingsToInstanceManagerPod(im *longhorn.InstanceManager) error {
if types.IsDataEngineV1(im.Spec.DataEngine) {
return nil
}

if im.Status.CurrentState != longhorn.InstanceManagerStateRunning {
return nil
}

client, err := engineapi.NewInstanceManagerClient(im)
if err != nil {
return errors.Wrapf(err, "failed to create instance manager client for %v", im.Name)
Expand Down Expand Up @@ -501,9 +505,9 @@ func (imc *InstanceManagerController) handlePod(im *longhorn.InstanceManager) er
return err
}

err = imc.syncLogSettingsToIMPod(im)
err = imc.syncLogSettingsToInstanceManagerPod(im)
if err != nil {
log.WithError(err).Warnf("Failed to sync log settings to instance manager pod")
log.WithError(err).Warnf("Failed to sync log settings to instance manager pod %v", im.Name)
}

isSettingSynced, isPodDeletedOrNotRunning, areInstancesRunningInPod, err := imc.areDangerZoneSettingsSyncedToIMPod(im)
Expand Down

0 comments on commit 4dbba5b

Please sign in to comment.