Skip to content

More granular master job targeting#10374

Merged
thatch45 merged 3 commits into
saltstack:developfrom
jacksontj:pubfilter
Feb 24, 2014
Merged

More granular master job targeting#10374
thatch45 merged 3 commits into
saltstack:developfrom
jacksontj:pubfilter

Conversation

@jacksontj
Copy link
Copy Markdown
Contributor

Please DO NOT MERGE IMMEDIATELY.

Salt targeting is done using the zmq pub/sub mechanism. No filtering is done so all requests go to all minions. This is an attempt to make the requests more target-able. ZeroMQ supports filters on these sockets which are processed publisher side. So the thought is to set it to the minion id and a shared "broadcast" one. Only requests of tgt_type == list will use this. The thought is if we like this we can use other data (mine etc) to determine a more specific target on the master (such as a list) from a glob match etc.

This is more or less backwards compatible, during my testing it still works but the old minion will throw an exception like:

[CRITICAL] An exception occurred while polling the minion
Traceback (most recent call last):
  File "/home/thjackso/src/salt/salt/minion.py", line 1324, in tune_in
    payload = self.serial.loads(self.socket.recv(zmq.NOBLOCK))
  File "/home/thjackso/src/salt/salt/payload.py", line 95, in loads
    return msgpack.loads(msg, use_list=True)
  File "_unpacker.pyx", line 114, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:114)
ExtraData: unpack(b) recieved extra data.

So if we decide this is a good idea we'll probably want to wrap the new master side logic in a config option, and just merge in the minion side changes for the first release.

@ghost
Copy link
Copy Markdown

ghost commented Feb 12, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/1369/

@ghost
Copy link
Copy Markdown

ghost commented Feb 12, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/1370/

@thatch45
Copy link
Copy Markdown
Contributor

I like where you are going with this, but it does involve sending targeting data in the clear which is why I did not do it this way in the beginning. This is one of the things that we hope to address with RAET

@jacksontj
Copy link
Copy Markdown
Contributor Author

What is the concern with targeting data in the clear? If you send data to
single hosts the packets destination gives you the same information. The
issue I'm trying to solve is if you send a command with a fairly large
payload (1k let's say) then zmq has to send that to all minions and there
isn't any way to not do that.
On Feb 12, 2014 8:52 AM, "Thomas S Hatch" notifications@github.com wrote:

I like where you are going with this, but it does involve sending
targeting data in the clear which is why I did not do it this way in the
beginning. This is one of the things that we hope to address with RAET

Reply to this email directly or view it on GitHubhttps://github.com//pull/10374#issuecomment-34889004
.

@jacksontj
Copy link
Copy Markdown
Contributor Author

Also, we could hash or encrypt the target if that's a major concern.
On Feb 12, 2014 8:55 AM, "Thomas Jackson" jacksontj.89@gmail.com wrote:

What is the concern with targeting data in the clear? If you send data to
single hosts the packets destination gives you the same information. The
issue I'm trying to solve is if you send a command with a fairly large
payload (1k let's say) then zmq has to send that to all minions and there
isn't any way to not do that.
On Feb 12, 2014 8:52 AM, "Thomas S Hatch" notifications@github.com
wrote:

I like where you are going with this, but it does involve sending
targeting data in the clear which is why I did not do it this way in the
beginning. This is one of the things that we hope to address with RAET

Reply to this email directly or view it on GitHubhttps://github.com//pull/10374#issuecomment-34889004
.

@ghost
Copy link
Copy Markdown

ghost commented Feb 12, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/1409/

@jacksontj
Copy link
Copy Markdown
Contributor Author

@thatch45 are there any specific concerns about sending the targeting data in the clear?

@thatch45
Copy link
Copy Markdown
Contributor

Yes, targets in the clear means that we compromise the predictability of future packets, as well as leaking what could be sensitive data, especially if the target is a pillar target

@jacksontj
Copy link
Copy Markdown
Contributor Author

The only targeting data in the clear in this implementation is the minion
id, which I figure isn't particuarly sensitive. I agree that compound
targets could contain information, but we can't have zmq filter those as it
would require an infinite number of filters to catch all permutations.

Tldr; as long as minion I'd isn't 'secret' this implementation should be
good.
On Feb 19, 2014 1:39 PM, "Thomas S Hatch" notifications@github.com wrote:

Yes, targets in the clear means that we compromise the predictability of
future packets, as well as leaking what could be sensitive data, especially
if the target is a pillar target

Reply to this email directly or view it on GitHubhttps://github.com//pull/10374#issuecomment-35552222
.

@thatch45
Copy link
Copy Markdown
Contributor

Ok, I am in, please rebase and we will give this a spin.

@jacksontj
Copy link
Copy Markdown
Contributor Author

Alright, i'll try to get this in tonight-- otherwise it'll be tomorrow :)

@ghost
Copy link
Copy Markdown

ghost commented Feb 21, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/1674/

@jacksontj
Copy link
Copy Markdown
Contributor Author

The rebase is going to be complicated ;) I'll get it working tomorrow.

Salt targeting is done using the zmq pub/sub mechanism. No filtering is done so all requests go to all minions. This is an attempt to make the requests more target-able. ZeroMQ supports filters on these sockets which are processed publisher side. So the thought is to set it to the minion id and a shared "broadcast" one. Only requests of tgt_type == list will use this. The thought is if we like this we can use other data (mine etc) to determine a more specific target on the master (such as a list) from a glob match etc.

Syndication masters do not have zmq filters applied, but will send out their syndicated requests with a filter as well. So all targeted messages aren't gauranteed to go to only the minion, its just best effort
@jacksontj
Copy link
Copy Markdown
Contributor Author

K, lets wait on the jenkins run :)

@ghost
Copy link
Copy Markdown

ghost commented Feb 21, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/1686/

@ghost
Copy link
Copy Markdown

ghost commented Feb 21, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/1685/

@ghost
Copy link
Copy Markdown

ghost commented Feb 21, 2014

Test PASSed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/1697/

@ghost
Copy link
Copy Markdown

ghost commented Feb 21, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/1696/

@jacksontj
Copy link
Copy Markdown
Contributor Author

Says build finished, but the details link seems to be empty.

thatch45 added a commit that referenced this pull request Feb 24, 2014
More granular master job targeting
@thatch45 thatch45 merged commit d914c96 into saltstack:develop Feb 24, 2014
@thatch45
Copy link
Copy Markdown
Contributor

Since I assume you will be testing this more as well and it is not in until Helium I think we should be ok :)

@jacksontj
Copy link
Copy Markdown
Contributor Author

Looks like the commit was reverted, so we shouldnt be causing any more breakage. Do we know exactly what happened? In my testing updating the master then the minion is completely safe with this new feature. If thats not acceptable then I can wrap the minion filtering in a config and we can enable that after a few releases, just want to know whats the plan forward :)

@s0undt3ch
Copy link
Copy Markdown
Contributor

@jacksontj if you want to investigate, the jenkins master is always a little behind on the bootstrapped minions(commit wise), we'll even be enforcing the jenkins master to be on latest stable to find backwards incompatible changes.

@jacksontj
Copy link
Copy Markdown
Contributor Author

Does that mean "backwards compatibility" means it needs to work both ways (new minion old master AND old minion new master)?

@s0undt3ch
Copy link
Copy Markdown
Contributor

@jacksontj now that's really a question for @thatch45...

@basepi
Copy link
Copy Markdown
Contributor

basepi commented Feb 26, 2014

@jacksontj We don't ever guarantee that new minions will be able to talk to an old master. We do our best to make new masters talk to old minions, however.

@jacksontj
Copy link
Copy Markdown
Contributor Author

@basepi If that's the case then the pull req should have succeeded. Do we guarantee
that ordering in our Jenkins environment?
On Feb 26, 2014 2:49 PM, "Colton Myers" notifications@github.com wrote:

@jacksontj https://github.com/jacksontj We don't ever guarantee that
new minions will be able to talk to an old master. We do our best to make
new masters talk to old minions, however.

Reply to this email directly or view it on GitHubhttps://github.com//pull/10374#issuecomment-36187817
.

@jacksontj
Copy link
Copy Markdown
Contributor Author

@s0undt3ch So, i want to sync up with you before we try this again. Sounds like the CI tooling doesn't enforce the same compatibility model-- if that's correct I'll just commit the master side (which is completely backwards compatible both ways) and then config wrap the minion change and commit it later. IMO we should probably update the CI stack to enforce the same compatibility model that we want to follow for release, but I'm not sure how hard that is.

@s0undt3ch
Copy link
Copy Markdown
Contributor

@jacksontj sorry for my slow response but work has caught me up a bit. I'll get back to this when I have the necessary time. Again, sorry for my slow response.

@s0undt3ch
Copy link
Copy Markdown
Contributor

Too much time has passed without me replying to you. Sorry!

The salt-master used by Jenkins is now "locked" on latest stable release, 2014.1.0.

@jacksontj
Copy link
Copy Markdown
Contributor Author

That master is seperate from the one actually running the tests right? If i understand that master just spawns the other box which runs the tests? If so, then that would work fine for me :)

@s0undt3ch
Copy link
Copy Markdown
Contributor

The jenkins master spawns new vms, and uses the bootstrapped minion(which is based on the commit being tests) to run the tests.
This way we use the last stable master to trigger the tests execution on the remote machine which is running a newer minion code base.

Cool?

@jacksontj
Copy link
Copy Markdown
Contributor Author

That makes it sound like we only run the minion tests? Do we ever run tests with the master code as well? Also, if that is the case (new minion old master) isn't that the exact opposite of our support model?

@s0undt3ch
Copy link
Copy Markdown
Contributor

This is not the ideal situation, as you already know. We should cover all use cases. New master, old minion, the other way around, etc...

To do that, you'd need to orchestrate both deployments and run some tests on those deployments. We'd need to bootstrap, an older master, a newer minion, a newer master, an older minion, etc. Have them communicate and run some tests on all of these.

Such orchestration is an awesome use case for salt.

I've been implementing an orchestration strategy in order to test Halite on our jenkins server, you can have a look here, under halite/.

The same could be achieved for this specific use case, and it will be somewhere in the future.
If/when we move to a docker or salt-virt orchestration strategy, this will be way simpler.

So in conclusion. Yes, we are testing the opposite of our model(upgrade master first) but we're actually getting a heads up way earlier if we break backwards communication compatibility allowing us to properly warn the user on the release notes, ie, "this release it's specifically important that the master be upgraded first".

@jacksontj
Copy link
Copy Markdown
Contributor Author

So with this as the case how do I ever have the Jenkins stack test the
master? Seems that it will only test it once its released... This specific
change I'm making will require master upgrade first so I need to know how
to get it to the master in the Jenkins machinery. Or if not possible how
long I have to have the option config wrapped or something. In the current
setup it sounds like if I make the master change (which is backwards
compatible) it'll never end up on the Jenkins master...
On Mar 12, 2014 3:58 AM, "Pedro Algarvio" notifications@github.com wrote:

This is not the ideal situation, as you already know. We should cover all
use cases. New master, old minion, the other way around, etc...

To do that, you'd need to orchestrate both deployments and run some tests
on those deployments. We'd need to bootstrap, an older master, a newer
minion, a newer master, an older minion, etc. Have them communicate and run
some tests on all of these.

Such orchestration is an awesome use case for salt.

I've been implementing an orchestration strategy in order to test Halite
on our jenkins server, you can have a look herehttps://github.com/s0undt3ch/salt-jenkins,
under halite/.

The same could be achieved for this specific use case, and it will be
somewhere in the future.
If/when we move to a docker or salt-virt orchestration strategy, this will
be way simpler.

So in conclusion. Yes, we are testing the opposite of our model(upgrade
master first) but we're actually getting a heads up way earlier if we break
backwards communication compatibility allowing us to properly warn the user
on the release notes, ie, "this release it's specifically important that
the master be upgraded first".

Reply to this email directly or view it on GitHubhttps://github.com//pull/10374#issuecomment-37396171
.

@jacksontj
Copy link
Copy Markdown
Contributor Author

@s0undt3ch Any update on how to move forward?

@s0undt3ch
Copy link
Copy Markdown
Contributor

About Jenkins, the only, current, option is to wait until we setup orchestration, at which time we will be able to test against specific versions.
About a configuration switch, @thatch45 is the best source for that suggestion.

@jacksontj
Copy link
Copy Markdown
Contributor Author

Even if i do the config switch we'll have to get the new master done first...

@jacksontj
Copy link
Copy Markdown
Contributor Author

@s0undt3ch any update on this?

@s0undt3ch
Copy link
Copy Markdown
Contributor

Not yet, still on the TODO.

@jacksontj
Copy link
Copy Markdown
Contributor Author

@s0undt3ch ping :)

@s0undt3ch
Copy link
Copy Markdown
Contributor

@jacksontj sorry for the looong time to reply... Still no news, still preparing the LXC jenkins setup which will simplify this.

@jacksontj
Copy link
Copy Markdown
Contributor Author

OK, let me know when we are ready to give this another shot. This is going
to make a huge difference in our master load :)
On May 17, 2014 12:42 AM, "Pedro Algarvio" notifications@github.com wrote:

@jacksontj https://github.com/jacksontj sorry for the looong time to
reply... Still no news, still preparing the LXC jenkins setup which will
simplify this.


Reply to this email directly or view it on GitHubhttps://github.com//pull/10374#issuecomment-43400383
.

@jacksontj
Copy link
Copy Markdown
Contributor Author

@thatch45 similar to #10332 I'm going to change this to a config wrapped change which we can switch the default after this next release is cut

jacksontj added a commit to jacksontj/salt that referenced this pull request Jul 9, 2014
Salt targeting is done using the zmq pub/sub mechanism. No filtering is done so all requests go to all minions. This is an attempt to make the requests more target-able. ZeroMQ supports filters on these sockets which are processed publisher side. So the thought is to set it to the minion id and a shared "broadcast" one. Only requests of tgt_type == list will use this. The thought is if we like this we can use other data (mine etc) to determine a more specific target on the master (such as a list) from a glob match etc.

This is more or less backwards compatible, during my testing it still works but the old minion will throw an exception like:

[CRITICAL] An exception occurred while polling the minion
Traceback (most recent call last):
  File "/home/thjackso/src/salt/salt/minion.py", line 1324, in tune_in
    payload = self.serial.loads(self.socket.recv(zmq.NOBLOCK))
  File "/home/thjackso/src/salt/salt/payload.py", line 95, in loads
    return msgpack.loads(msg, use_list=True)
  File "_unpacker.pyx", line 114, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:114)
ExtraData: unpack(b) recieved extra data.

So if we decide this is a good idea we'll probably want to wrap the new master side logic in a config option, and just merge in the minion side changes for the first release.

This is another attempt of saltstack#10374.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants