salt icon indicating copy to clipboard operation
salt copied to clipboard

[FEATURE REQUEST] master/minion should accept a SIGHUP and reload config

Open whiteinge opened this issue 14 years ago • 51 comments

whiteinge avatar Jan 24 '12 22:01 whiteinge

this might be trickier than just that, at the least salt should reload the modules on the minion

thatch45 avatar Jan 24 '12 22:01 thatch45

+1 on this issue. I have plans on modifying the salt master's configuration very, very often, and would prefer to reload the config rather than needing to restart the daemon (which would cause salt outages).

ryan-lane avatar Jun 20 '12 15:06 ryan-lane

I will slate this for the next release then and investigate how viable it will be

thatch45 avatar Jun 20 '12 15:06 thatch45

I have added some code to help mitigate some issues when restarting the salt master. I am still looking into how to manage this one

thatch45 avatar Jul 09 '12 05:07 thatch45

I am running into this issue with upstart. When upstart signals a reload it sends SIGHUP to the parent salt-master. It then promptly dies without error or debug, orphaning all of the children salt-masters. Upstart then thinks the process is dead, leaving lots of orphaned children.

subsequent "start saltmaster" immediately dies off as the port is still used by the orphaned children

At the very least, the salt-master should catch the signal and kill off its children such as

salt/master.py:
  Master.start() (line 343)
        signal.signal(signal.SIGHUP, sigterm_clean)

steamraven avatar Jun 29 '13 18:06 steamraven

Ooh, thanks for the report -- even if we don't properly reload, we need to handle SIGHUP more gracefully than that.

basepi avatar Jul 01 '13 16:07 basepi

I don't want to be just another +1, but I too am planning to modify the configuration files. Mainly I already have an /etc/salt/master.d/nodegroups.conf file where I define my nodegroups (I am still not convinced by the available external node classifiers available). As such, any modification of said file must trigger a salt-master restart which, if I'm in the middle of a highstate call, triggers not-nice things to happen.

I tried to read salt's code to see if it was relatively easy to add this, but alas I did not understand much :)

godlike64 avatar Jan 03 '15 21:01 godlike64

Actually I've been digging around the daemons quite a bit recently and although I don't think this will be easy, it should be possible. I'll add this to my list of things to hack on ;)

jacksontj avatar Jan 05 '15 05:01 jacksontj

Thr reason this does not work is that catching signals in python inturupts the zmq threads and we get crashes of lost packets. We hope to get this working with salt raet once we have implimented more of the major components

On Sun, Jan 4, 2015, 22:12 Thomas Jackson [email protected] wrote:

Actually I've been digging around the daemons quite a bit recently and although I don't think this will be easy, it should be possible. I'll add this to my list of things to hack on ;)

Reply to this email directly or view it on GitHub https://github.com/saltstack/salt/issues/570#issuecomment-68669161.

thatch45 avatar Jan 05 '15 05:01 thatch45

We already catch quite a few signals in the daemons and IIRC we don't have stuff exploding all over... I think the larger problem is going to be the varying classes that keep copies of the opts dict all over creation ;)

jacksontj avatar Jan 05 '15 05:01 jacksontj

Good point. But just keep that in mind. And generally we are only catching sigint and sigterm which do not care if there are zmq issues. Just making sure you know the issues we have already seen here. But this is one reason why we daemonize child procs instead of using sigchld. Which will also cause isses with propogating the sighup

On Sun, Jan 4, 2015, 22:28 Thomas Jackson [email protected] wrote:

We already catch quite a few signals in the daemons and IIRC we don't have stuff exploding all over... I think the larger problem is the varying classes that keep copies of the opts dict all over creation ;)

Reply to this email directly or view it on GitHub https://github.com/saltstack/salt/issues/570#issuecomment-68669808.

thatch45 avatar Jan 05 '15 05:01 thatch45

Yea, I'm thinking we'll want the parent to catch the sighup and coordinate the reload amongst the children. I have some ideas, but I'll need to make some time to mess with it :)

jacksontj avatar Jan 05 '15 06:01 jacksontj

+1: I'm looking for a way to reload the nodegroups configuration only, without restarting the whole salt-master

bbinet avatar Jul 02 '15 08:07 bbinet

@bbinet Pretty sure that currently works. At least, last time I tried. Nodegroups don't require master restart.

basepi avatar Jul 02 '15 16:07 basepi

It does not work for me:

$ salt -c /config -N a test.ping
No minions matched the target. No command was sent, no jid was assigned.

The strange thing is that in the master logs, I can see that the a nodegroup had actually matched the correct list of minions:

2015-07-03 12:16:48,382 [salt.master      ][INFO    ][178] Clear payload received with command publish
2015-07-03 12:16:48,384 [salt.utils.minions][DEBUG   ][178] Evaluating final compound matching expr: ( ( set(['hl-lxc-1-dev', 'hl-mc-9999-dev', 'hl-mc-3-dev', 'hl-mc-8888-dev', 'hl-mc-4-dev', 'hl-mc-5-dev']) ) & ( set(['cm-mc-1-dev']) ) )

But I don't know why we then get the No minions matched the target message.

Note that it works correctly when I target a nodegroup that was already existing when the salt-master was started. Should I create a new issue specifically for that?

bbinet avatar Jul 03 '15 12:07 bbinet

If you look at that log line, that expression will evaluate to an empty set. It's &ing two sets, which have no strings in common. This is why it says no minions were matched. Are you certain your new nodegroup actually does match minions?

basepi avatar Jul 07 '15 22:07 basepi

You're right, so this is working as expected. Thanks and sorry for the noise.

bbinet avatar Jul 08 '15 08:07 bbinet

No problem, just wanted to make sure we fixed a bug if there was one! ;)

basepi avatar Jul 08 '15 19:07 basepi

Is it possible today to refresh just the gitfs_remotes or the file roots without restarting the salt-master?

sametimesolutions avatar Oct 15 '15 02:10 sametimesolutions

@sametimesolutions No, not yet.

eliasp avatar Oct 15 '15 05:10 eliasp