saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Get access to the Salt software package repository here:
https://repo.saltproject.io/
Apache License 2.0
14.12k stars 5.47k forks source link

[master] Handle disconnects from with ZeroMQ and make it re-resolve master IP #66760

Open vzhestkov opened 2 months ago

vzhestkov commented 2 months ago

What does this PR do?

With ZeroMQ transport the disconnect_callback was not called and because of it there was no way to re-resolve IP address as ZeroMQ socket is trying to reconnect to the master internally, while FQDN to IP resolution was performed before the connect call and IP address is used in the URI of the master to connect to, so in case of changing FQDN to IP assignment of the master there was no way to detect it and react properly.

With this PR the behaviour is changing and salt.transport.zeromq.ZeroMQSocketMonitor is used to detect disconnects and zmq_monitor config value is changed to True by default to make it working.

It seems that it also makes sense to set master_tries to -1 as the default value to make it possible to keep trying to reconnect to the master.

What issues does this PR fix or reference?

Tracks: https://github.com/SUSE/spacewalk/issues/24871

Previous Behavior

Minion is getting stuck trying to reconnect to the master using old IP address in case if the IP address of the master has changed in DNS.

New Behavior

Minion is able to reconnect to the master using its new IP address.

Merge requirements satisfied?

[NOTICE] Bug fixes or features added to Salt require tests.

Commits signed with GPG?

Yes/No

Please review Salt's Contributing Guide for best practices, including the PR Guidelines.

See GitHub's page on GPG signing for more information about signing commits with GPG.