Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transport refactor #61450

Merged
merged 62 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
22491c1
Move resover stuff to tcp where it is useful
dwoz Sep 12, 2021
1c0073d
Refactor into transports and channels
dwoz Sep 12, 2021
feeffb8
Clean up transports
dwoz Sep 24, 2021
ecffab5
Fix Serial references
dwoz Sep 28, 2021
80ec7ee
Pickle PubServer
dwoz Sep 29, 2021
d917ee7
Fix pillar tests on macos
dwoz Sep 29, 2021
af6fa88
More test fixes
dwoz Sep 29, 2021
e975bde
Add pub server tests
dwoz Sep 30, 2021
7c18210
Start to add base class defs
dwoz Oct 3, 2021
80c9054
Remove raw opt from client send
dwoz Oct 3, 2021
9d76f10
Fix master_uri test
dwoz Oct 3, 2021
643e834
fix wart
dwoz Oct 3, 2021
295ac90
Clean up some docs and test fix
dwoz Oct 7, 2021
04ca108
Address docs and hard coded strings
dwoz Oct 18, 2021
6ee0ba9
Fix bad import
dwoz Oct 18, 2021
a3b35b2
Not all transports have daemons
dwoz Oct 29, 2021
1354f9b
Clear funcs cache channels
dwoz Oct 30, 2021
df22723
Add connect method to connect pub server channels
dwoz Nov 1, 2021
26418d9
Fix pre-commit
dwoz Nov 1, 2021
932851d
add changelog
dwoz Nov 1, 2021
9c97ff0
Fix broken test
dwoz Nov 1, 2021
c40444c
Cleanup based on review comments
dwoz Nov 2, 2021
1fa33c6
Fix ZeroMQ references
dwoz Nov 2, 2021
349fad7
Remove rabbitmq stuff for now
dwoz Nov 3, 2021
2e31aec
Cleanup and address PR comments
dwoz Nov 4, 2021
96d7c86
fix pre-commit
dwoz Nov 4, 2021
a862359
Add missing logic from refactor
dwoz Nov 19, 2021
901b118
Remove port info from channel doc strings
dwoz Nov 20, 2021
335c344
Fix param docs
dwoz Nov 20, 2021
509f357
Update publish_daemon docstring
dwoz Nov 20, 2021
b1f59a9
Remove un-needed import
dwoz Nov 20, 2021
474a70b
Use deepcopy for opts
dwoz Nov 20, 2021
45b05a7
Remove un-used import
dwoz Nov 20, 2021
c23d1b7
Remove un-needed imports
dwoz Nov 20, 2021
4bd68be
Add deprecations for salt.transport.(client,server)
dwoz Nov 20, 2021
81671d5
Document deprecation in docstring
dwoz Nov 20, 2021
3abd5b8
Call parent class no-op __init__
dwoz Nov 21, 2021
f82c391
Use salt.channel.client instead of salt.transport.client
dwoz Nov 24, 2021
a72d198
fix unit tests
dwoz Nov 24, 2021
b3868c5
Fix more tests
dwoz Nov 24, 2021
1b5e437
Clean up salt.transport.(client,server) references
dwoz Nov 24, 2021
0249f4f
Fix reference to salt.transport.client
dwoz Nov 25, 2021
c2f0697
Test tcp test fix
dwoz Nov 25, 2021
b5bbe08
Try tcp test fix
dwoz Nov 26, 2021
4148c46
Add message logging
dwoz Nov 26, 2021
d68e4af
test tcp
dwoz Dec 1, 2021
20cc434
Test fix
dwoz Dec 12, 2021
20d0e6a
Fix pre-commit
dwoz Dec 12, 2021
8810214
Test tcp message client refactor fix
dwoz Dec 13, 2021
684eef8
fix pre-commit
dwoz Dec 13, 2021
14561f7
Fix broken unit test
dwoz Dec 13, 2021
9a24e9d
Clean up doc strings
dwoz Dec 14, 2021
78f9c5a
Enable topics for tcp transport
dwoz Dec 14, 2021
2832063
Deltaproxy does not work with subscriptions
dwoz Dec 15, 2021
c32d5af
Fix docstrings
dwoz Jan 11, 2022
56322bf
add ci build fix
dwoz Jan 11, 2022
8afdb73
Skip new deltaproxy tests on tcp transport
dwoz Jan 12, 2022
eff10f2
Address PR comments
dwoz Dec 22, 2021
1ed3464
Add NotImplimentedError to stubs
dwoz Jan 12, 2022
f36002f
Fix lint error
dwoz Jan 12, 2022
6d9d350
Fix typo
dwoz Jan 13, 2022
8830a05
Fix base class init methods
dwoz Jan 13, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/61161.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Re-factor transport to make them more plug-able
32 changes: 32 additions & 0 deletions doc/topics/channels/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. _channels:

=============
Salt Channels
=============

One of the fundamental features of Salt is remote execution. Salt has two basic
"channels" for communicating with minions. Each channel requires a client
(minion) and a server (master) implementation to work within Salt. These pairs
of channels will work together to implement the specific message passing
required by the channel interface. Channels use :ref:`Transports <transports>`
for sending and receiving messages.


Pub Channel
===========
The pub (or pubish) channel is how a master sends a job (payload) to a
minion. This is a basic pub/sub paradigm, which has specific targeting semantics.
All data which goes across the publish system should be encrypted such that only
members of the Salt cluster can decrypt the published payloads.


Req Channel
===========
The req channel is how the minions send data to the master. This interface is
primarily used for fetching files and returning job returns. The req channels
have two basic interfaces when talking to the master. ``send`` is the basic
method that guarantees the message is encrypted at least so that only minions
attached to the same master can read it-- but no guarantee of minion-master
confidentiality, whereas the ``crypted_transfer_decode_dictentry`` method does
guarantee minion-master confidentiality. The req channel is also used by the
salt cli to publish jobs to the master.
1 change: 1 addition & 0 deletions doc/topics/configuration/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ secure and troubleshoot, and how to perform many other administrative tasks.
../tutorials/cron
../hardening
../../security/index
../channels/index
../transports/index
../master_tops/index
../../ref/returners/index
Expand Down
54 changes: 29 additions & 25 deletions doc/topics/transports/index.rst
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
.. _transports:
.. _transports:

==============
Salt Transport
==============

One of fundamental features of Salt is remote execution. Salt has two basic
"channels" for communicating with minions. Each channel requires a
client (minion) and a server (master) implementation to work within Salt. These
pairs of channels will work together to implement the specific message passing
required by the channel interface.


Pub Channel
===========
The pub channel, or publish channel, is how a master sends a job (payload) to a
minion. This is a basic pub/sub paradigm, which has specific targeting semantics.
All data which goes across the publish system should be encrypted such that only
members of the Salt cluster can decrypt the publishes.


Req Channel
===========
The req channel is how the minions send data to the master. This interface is
primarily used for fetching files and returning job returns. The req channels
have two basic interfaces when talking to the master. ``send`` is the basic
method that guarantees the message is encrypted at least so that only minions
attached to the same master can read it-- but no guarantee of minion-master
confidentiality, whereas the ``crypted_transfer_decode_dictentry`` method does
guarantee minion-master confidentiality.

Transports in Salt are used by :ref:`Channels <channels>` to send messages between Masters, Minions,
and the Salt CLI. Transports can be brokerless or brokered. There are two types
of server / client implementations needed to implement a channel.


Publish Server
==============

The publish server implements a publish / subscribe paradigm and is used by
Minions to receive jobs from Masters.

Publish Client
==============

The publish client subscribes to, and receives messages from a Publish Server.


Request Server
==============

The request server implements a request / reply paradigm. Every request sent by
the client must recieve exactly one reply.

Request Client
==============

The request client sends requests to a Request Server and recieves a reply message.


.. toctree::
Expand Down
18 changes: 9 additions & 9 deletions doc/topics/transports/tcp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
TCP Transport
=============

The tcp transport is an implementation of Salt's channels using raw tcp sockets.
The tcp transport is an implementation of Salt's transport using raw tcp sockets.
Since this isn't using a pre-defined messaging library we will describe the wire
protocol, message semantics, etc. in this document.

Expand Down Expand Up @@ -83,17 +83,17 @@ Crypto
The current implementation uses the same crypto as the ``zeromq`` transport.


Pub Channel
===========
For the pub channel we send messages without "message ids" which the remote end
interprets as a one-way send.
Publish Server and Client
=========================
For the publish server and client we send messages without "message ids" which
the remote end interprets as a one-way send.

.. note::

As of today we send all publishes to all minions and rely on minion-side filtering.


Req Channel
===========
For the req channel we send messages with a "message id". This "message id" allows
us to multiplex messages across the socket.
Request Server and Client
=========================
For the request server and client we send messages with a "message id". This
"message id" allows us to multiplex messages across the socket.
31 changes: 16 additions & 15 deletions doc/topics/transports/zeromq.rst
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
================
Zeromq Transport
ZeroMQ Transport
================

.. note::

Zeromq is the current default transport within Salt
ZeroMQ is the current default transport within Salt

Zeromq is a messaging library with bindings into many languages. Zeromq implements
ZeroMQ is a messaging library with bindings into many languages. ZeroMQ implements
a socket interface for message passing, with specific semantics for the socket type.


Pub Channel
===========
The pub channel is implemented using zeromq's pub/sub sockets. By default we don't
use zeromq's filtering, which means that all publish jobs are sent to all minions
and filtered minion side. Zeromq does have publisher side filtering which can be
enabled in salt using :conf_master:`zmq_filtering`.
Publish Server and Client
=========================
The publish server and client are implemented using ZeroMQ's pub/sub sockets. By
default we don't use ZeroMQ's filtering, which means that all publish jobs are
sent to all minions and filtered minion side. ZeroMQ does have publisher side
filtering which can be enabled in salt using :conf_master:`zmq_filtering`.


Req Channel
===========
The req channel is implemented using zeromq's req/rep sockets. These sockets
enforce a send/recv pattern, which forces salt to serialize messages through these
socket pairs. This means that although the interface is asynchronous on the minion
we cannot send a second message until we have received the reply of the first message.
Request Server and Client
=========================
The request server and client are implemented using ZeroMQ's req/rep sockets.
These sockets enforce a send/recv pattern, which forces salt to serialize
messages through these socket pairs. This means that although the interface is
asynchronous on the minion we cannot send a second message until we have
received the reply of the first message.
2 changes: 1 addition & 1 deletion kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ provisioner:
- 139
max_retries: 2
remote_states:
name: git://github.com/saltstack/salt-jenkins.git
name: https://github.com/saltstack/salt-jenkins.git
branch: master
repo: git
testingdir: /testing
Expand Down
4 changes: 2 additions & 2 deletions salt/auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
import time
from collections.abc import Iterable, Mapping

import salt.channel.client
import salt.config
import salt.exceptions
import salt.loader
import salt.payload
import salt.transport.client
import salt.utils.args
import salt.utils.dictupdate
import salt.utils.files
Expand Down Expand Up @@ -511,7 +511,7 @@ def _send_token_request(self, load):
salt.utils.zeromq.ip_bracket(self.opts["interface"]),
str(self.opts["ret_port"]),
)
with salt.transport.client.ReqChannel.factory(
with salt.channel.client.ReqChannel.factory(
self.opts, crypt="clear", master_uri=master_uri
) as channel:
return channel.send(load)
Expand Down
File renamed without changes.
Loading