salt icon indicating copy to clipboard operation
salt copied to clipboard

Request for change to allow the mine data to work with syndics via a pluggable data store (aka mysql, redis, etc)

Open junster1 opened this issue 11 years ago • 16 comments

The basic issue is that the data is only stored on the master that the minion is attached to. So if you have the following design, you will get different answers based on the master (or syndic) you run the mine.get against. The data will not be replicated to the other syndics or the master of masters. What we would like is something that makes the mine data store pluggable. We currently us rsync to replicate the data to all the syndics and the master of masters, we also have to replicate the minion public keys to as the mine.get will only return data for minions that master knows about. This is prone to failures and doesn’t scale well when you have 10’s of syndic pairs with 1000’s of minions.

                 Master of Masters
                 /                 \
                /                    \
               /                       \
              /                          \
  Syndic A1 <--> Syndic A2     Syndic B1 <--> Syndic B2

junster1 avatar Sep 28 '15 00:09 junster1

Thanks for filing this. This does look like a pretty good solution, we'll investigate making the store pluggable.

basepi avatar Sep 28 '15 16:09 basepi

@sejeff @jdconti

junster1 avatar Sep 28 '15 19:09 junster1

The solution here is to add pluggable support for the minion data cache system. This will allow for the minion data cache and the mine (which are stored in the same system on the master) to use this. it should be something we can plug into the returner system by just adding 2-3 functions to the returner definition.

thatch45 avatar Sep 28 '15 20:09 thatch45

@thatch45 that would be perfect. This would be a HUGE deal for our use case.

Thanks!

SEJeff avatar Oct 01 '15 22:10 SEJeff

as @junster1 mentioned, the workaround here is (unfortunately) rsync. if anyones curious, the two directories you need to duplicate ONEWAY from syndic to master master are: (keys and cache) /etc/salt/pki/master/minions/* /var/cache/salt/master/minions/*

additionally, the syndic's minions wont be able to use your syndic's own mine data unless its rsync'd back from master master. If you need this, you'll have to sync ONLY the syndic pubkey and mine data from master master -> syndic: /etc/salt/pki/master/minions/ /var/cache/salt/master/minions/

with these two fixes in place, i've achieved (mostly) dynamic pillars.

cybacolt avatar Oct 28 '15 08:10 cybacolt

Our solution was simply to rip out the mine and write a module / state which uses a shared mysql cluster, but we'd still like to see this be made extensible for the future.

SEJeff avatar Oct 28 '15 18:10 SEJeff

+1

morsik avatar Dec 23 '15 10:12 morsik

+1

msciciel avatar Dec 23 '15 12:12 msciciel

+1

If the backend data store allows auth, maybe we can synch the crypto keys too?

dkiser avatar Jan 08 '16 03:01 dkiser

its worth also considering (as mentioned my my post above) that the syndics minions also cant access the syndic's mine data, if registered upstream with the master master... eg: asking for syndic mine data from master master works:

salt 'mastermaster*' mine.get 'mysyndic*' grains.items 

asking for syndic mine data from the syndics minions fails:

salt 'mysyndicsminion*' mine.get 'mysyndic*' grains.items 

the solution may be to register the syndic minion with the syndic master... (rather than upstream). not sure if there are any shortcomings to this idea...

cybacolt avatar Jan 14 '16 03:01 cybacolt

@cachedout @thatch45 you guys need to talk about this next sprint

meggiebot avatar Jun 14 '16 18:06 meggiebot

ZD-798

meggiebot avatar Jun 29 '16 17:06 meggiebot

ZD-843

meggiebot avatar Jul 05 '16 15:07 meggiebot

I havent really figured out, how this contribution fixes the issue. Is there a documentation how to use this cache module? I also need to mine from minions to other minions across syndics.

fr6nco avatar Jul 12 '17 14:07 fr6nco

@fr6nco the external data cache allows to keep the cached minion data inside an external data storage like consul, etcd or mysql. To use this set minion_data_cache to True and configure one of the cache modules as described in the docs.

DmitryKuzmenko avatar Jul 17 '17 11:07 DmitryKuzmenko

sorry for reloading an old issue but even using an external data storage (redis) I can't get mines from minions under syndic. My structure is:

3 master of masters
1 syndic under 3 masters of masters
3 minions under 1 syndic

Masters and syndic are using MINION_DATA_CACHE with the same redis.

salt-run mine.get '*' my_mine in the master of masters returns mines only for syndic, just like salt 'syndic' mine.get '*' my_mine. Inside the syndic I can get mines for minions, but this is not useful in my case.

Exists another option to get this mines from master to minions under syndic?

rodolphopivetta avatar May 03 '19 02:05 rodolphopivetta